Skip to content

Commit 04a2235

Browse files
palypsterdriesvintstaylorotwell
authored
[1.x] PostgreSQL Support (#28)
* Introducing pgsql in docker-compose * CLI * Adding php module to runtimes * Fix * Just found #23 fixes the issue with passing variables, refactored * Fixing: incorrect php version Co-authored-by: Dries Vints <dries@vints.io> * Removing duplicated php-pgsql package * Fixing incorrect env variables * PG requires non-empty password, providing the default * Update sail * Update docker-compose.yml Co-authored-by: Dries Vints <dries@vints.io> Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 8c8a787 commit 04a2235

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

bin/sail

+12
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ if [ $# -gt 0 ]; then
210210
sail_is_not_running
211211
fi
212212

213+
# Initiate a PostgreSQL CLI terminal session within the "pgsql" container...
214+
elif [ "$1" == "psql" ]; then
215+
shift 1
216+
217+
if [ "$EXEC" == "yes" ]; then
218+
docker-compose exec \
219+
pgsql \
220+
bash -c 'PGPASSWORD=${PGPASSWORD} psql -U ${POSTGRES_USER} ${POSTGRES_DB}'
221+
else
222+
sail_is_not_running
223+
fi
224+
213225
# Initiate a Bash shell within the application container...
214226
elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then
215227
shift 1

stubs/docker-compose.yml

+16
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- sail
2020
depends_on:
2121
- mysql
22+
# - pgsql
2223
- redis
2324
# - selenium
2425
# selenium:
@@ -43,6 +44,19 @@ services:
4344
- sail
4445
healthcheck:
4546
test: ["CMD", "mysqladmin", "ping"]
47+
# pgsql:
48+
# image: postgres:13
49+
# ports:
50+
# - '${FORWARD_DB_PORT:-5432}:5432'
51+
# environment:
52+
# PGPASSWORD: '${DB_PASSWORD:-secret}'
53+
# POSTGRES_DB: '${DB_DATABASE}'
54+
# POSTGRES_USER: '${DB_USERNAME}'
55+
# POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
56+
# volumes:
57+
# - 'sailpostgresql:/var/lib/postgresql/data'
58+
# networks:
59+
# - sail
4660
redis:
4761
image: 'redis:alpine'
4862
ports:
@@ -72,5 +86,7 @@ networks:
7286
volumes:
7387
sailmysql:
7488
driver: local
89+
# sailpostgresql:
90+
# driver: local
7591
sailredis:
7692
driver: local

0 commit comments

Comments
 (0)