Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docker): set up a local shared postgres for development #1272

Merged
merged 4 commits into from Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion Makefile
Expand Up @@ -73,7 +73,12 @@ DEV_SUFFIX=-dev
DEPLOYS_API_KEY?=gateway4deployes

# this should use the same version as our prod RDS database
LOGGER_POSTGRES_TAG?=15
CONTROL_DB_POSTGRES_TAG?=15
CONTROL_DB_POSTGRES_PASSWORD?=postgres
CONTROL_DB_POSTGRES_URI?=postgres://postgres:${CONTROL_DB_POSTGRES_PASSWORD}@control-postgres:5432/postgres

# use the same version as control DB
LOGGER_POSTGRES_TAG?=${CONTROL_DB_POSTGRES_TAG}
oddgrd marked this conversation as resolved.
Show resolved Hide resolved
LOGGER_POSTGRES_PASSWORD?=postgres
LOGGER_POSTGRES_URI?=postgres://postgres:${LOGGER_POSTGRES_PASSWORD}@logger-postgres:5432/postgres
endif
Expand Down Expand Up @@ -114,6 +119,9 @@ DOCKER_COMPOSE_ENV=\
PROVISIONER_TAG=$(PROVISIONER_TAG)\
RESOURCE_RECORDER_TAG=$(RESOURCE_RECORDER_TAG)\
POSTGRES_TAG=${POSTGRES_TAG}\
CONTROL_DB_POSTGRES_TAG=${CONTROL_DB_POSTGRES_TAG}\
CONTROL_DB_POSTGRES_PASSWORD=${CONTROL_DB_POSTGRES_PASSWORD}\
CONTROL_DB_POSTGRES_URI=${CONTROL_DB_POSTGRES_URI}\
LOGGER_POSTGRES_TAG=${LOGGER_POSTGRES_TAG}\
LOGGER_POSTGRES_PASSWORD=${LOGGER_POSTGRES_PASSWORD}\
LOGGER_POSTGRES_URI=${LOGGER_POSTGRES_URI}\
Expand Down
48 changes: 47 additions & 1 deletion docker-compose.dev.yml
Expand Up @@ -2,7 +2,7 @@ version: "3"

volumes:
logger-postgres-vol:

control-db-postgres-vol:

services:
provisioner:
Expand Down Expand Up @@ -30,6 +30,39 @@ services:
resource-recorder:
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved
ports:
- 8007:8000
depends_on:
- control-db
entrypoint:
- /bin/bash
- -c
- |
until </dev/tcp/control-db/5432
do
>&2 echo "The control DB is not available yet - sleeping"
sleep 1
done

>&2 echo "The control DB is available - starting shuttle-resource-recorder"

exec /usr/local/bin/service "$${@:0}"
auth-dev:
ports:
- 8006:8000
depends_on:
- control-db
entrypoint:
- /bin/bash
- -c
- |
until </dev/tcp/control-db/5432
do
>&2 echo "The control DB is not available yet - sleeping"
sleep 1
done

>&2 echo "The control DB is available - starting shuttle-auth"

exec /usr/local/bin/service "$${@:0}"
otel-collector:
ports:
- 4317:4317
Expand Down Expand Up @@ -71,3 +104,16 @@ services:
- 8003:8000
# the shared postgres already uses 5432
- 5433:5432
control-db:
image: "docker.io/library/postgres:${CONTROL_DB_POSTGRES_TAG}"
restart: always
networks:
user-net:
environment:
POSTGRES_PASSWORD: ${CONTROL_DB_POSTGRES_PASSWORD}
volumes:
- control-db-postgres-vol:/var/lib/postgresql/data
ports:
- 8004:8000
# the shared postgres already uses 5432
- 5434:5432