backend/docker-compose: remove race condition and improve interactive dev experience #627
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds a dependency to the (nebraska) "server" service on the "postgres" service in docker-compose.test.yaml. Motivation of the change is to prevent a race condition where the "server" container starts faster than "postgres", fails to connect to the database, and shuts down.
Additionally, an optional persistent storage for postgres is added. DB contents can be persisted across docker-compose runs to aid manual, interactive testing. Usage instructions have been added to the YAML files as comments. The local directory used for persiting postgres data has been added to .gitignore to prevent accidental commits.
Tested locally with:
docker-compose --file docker-compose.test.yaml build
(works as expected)docker-compose --file docker-compose.test.yaml up
(works as expected)docker-compose --file docker-compose.test.yaml --file docker-compose.pg-persist.yaml up
docker-compose --file docker-compose.test.yaml --file docker-compose.pg-persist.yaml down
docker-compose --file docker-compose.test.yaml --file docker-compose.pg-persist.yaml up