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

backend/docker-compose: remove race condition and improve interactive dev experience #627

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
*.swp
*sublime*
backend/__postgres_testing_volume/
8 changes: 8 additions & 0 deletions backend/docker-compose.pg-persist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Persistent postgres storage drop-in for interactive testing.
# This drop-in will persist postgres data in $(pwd)/__postgres_testing_volume
# across restarts of docker-compose.

services:
postgres:
volumes:
- ./__postgres_testing_volume:/var/lib/postgresql/data
16 changes: 16 additions & 0 deletions backend/docker-compose.test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Docker-compose file for interactive and for automated testing.
#
# Build docker image from local sources:
# docker-compose --file docker-compose.test.yaml build
#
# Run:
# docker-compose --file docker-compose.test.yaml run
# Run with persistent storage:
# docker-compose --file docker-compose.test.yaml --file docker-compose.test-db-persist.yaml up
#
# See docker-compose.pg-persist.yaml for more informatino on persistent storage.

version: "3.9"

services:
Expand All @@ -23,6 +35,10 @@ services:
network: host
ports:
- "8002:8000"
# The "long form" depends_on silently fails in some scenarios (we've seen this with podman)
# so the short form is added for compatibility.
depends_on:
- postgres
t-lo marked this conversation as resolved.
Show resolved Hide resolved
depends_on:
pothos marked this conversation as resolved.
Show resolved Hide resolved
postgres:
condition: service_healthy
Expand Down