Skip to content

Commit

Permalink
[1.x] PostgreSQL Support (#28)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
3 people authored Jan 12, 2021
1 parent 8c8a787 commit 04a2235
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bin/sail
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,18 @@ if [ $# -gt 0 ]; then
sail_is_not_running
fi

# Initiate a PostgreSQL CLI terminal session within the "pgsql" container...
elif [ "$1" == "psql" ]; then
shift 1

if [ "$EXEC" == "yes" ]; then
docker-compose exec \
pgsql \
bash -c 'PGPASSWORD=${PGPASSWORD} psql -U ${POSTGRES_USER} ${POSTGRES_DB}'
else
sail_is_not_running
fi

# Initiate a Bash shell within the application container...
elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then
shift 1
Expand Down
16 changes: 16 additions & 0 deletions stubs/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
- sail
depends_on:
- mysql
# - pgsql
- redis
# - selenium
# selenium:
Expand All @@ -43,6 +44,19 @@ services:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping"]
# pgsql:
# image: postgres:13
# ports:
# - '${FORWARD_DB_PORT:-5432}:5432'
# environment:
# PGPASSWORD: '${DB_PASSWORD:-secret}'
# POSTGRES_DB: '${DB_DATABASE}'
# POSTGRES_USER: '${DB_USERNAME}'
# POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
# volumes:
# - 'sailpostgresql:/var/lib/postgresql/data'
# networks:
# - sail
redis:
image: 'redis:alpine'
ports:
Expand Down Expand Up @@ -72,5 +86,7 @@ networks:
volumes:
sailmysql:
driver: local
# sailpostgresql:
# driver: local
sailredis:
driver: local

0 comments on commit 04a2235

Please sign in to comment.