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

Conversation

t-lo
Copy link
Member

@t-lo t-lo commented Nov 24, 2022

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
    • create a new package, assign to a channel
    • 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
    • Package still present in web interface

@t-lo t-lo requested review from illume and wrl November 24, 2022 16:00
@t-lo t-lo force-pushed the t-lo/improve-backend-docker-compose branch from 45f496d to 2bc1261 Compare November 24, 2022 16:02
@joaquimrocha joaquimrocha requested a review from yolossn November 24, 2022 18:01
Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Thanks.

I wonder if it makes sense to add a make target for the persistence. For documentation/ease of use.

backend/docker-compose.test.yaml Show resolved Hide resolved
@t-lo t-lo force-pushed the t-lo/improve-backend-docker-compose branch 2 times, most recently from 78ca8a4 to 784cb39 Compare November 25, 2022 07:35
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.

Signed-off-by: Thilo Fromm <[email protected]>
@t-lo t-lo force-pushed the t-lo/improve-backend-docker-compose branch from 784cb39 to f1f0704 Compare November 25, 2022 07:36
@t-lo t-lo requested a review from illume November 25, 2022 08:05
@t-lo t-lo merged commit 83330dc into main Dec 1, 2022
@t-lo t-lo deleted the t-lo/improve-backend-docker-compose branch December 1, 2022 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants