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

Use Docker Compose and add test that the server comes up #175

Merged
merged 11 commits into from
Jan 29, 2024
Merged

Conversation

smarr
Copy link
Owner

@smarr smarr commented Jan 20, 2024

This PR changes how the docker-based setup works.

Instead of starting the PostgreSQL server and the Node.js server in the same container, docker-compose.yml defines both as separate containers.

This should improve the ability to use standard docker tooling and container management, and hopefully also avoid issues with the system not starting up properly.

The PR also adds code to wait for Postgres to come up properly, and retry connecting to it.

With Docker, this should be usable with:

docker compose -f ./docker-compose.yml up

For Podman users, podman-compose is needed:

pip3 install podman-compose  # if not already available
podman-compose up

The GitLab CI setup for benchmarking is not using podman-compose, and instead manually starts both containers. Unfortunately, podman-compose is not as full feature as needed. It doesn't fully support its --abort-on-container-exit/--exit-code-from, and dealing with environment variables is problematic, too.

smarr added 9 commits January 20, 2024 12:00
…benchdb container

- switch base image to one with Node.js 21
- add health check to wait for postgres to be avaiable. Though, this is not fully sufficient, because the healthcheck will return true when postgres is merely preparing the database and then still restarts
- add .dockerignore

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
- in the docker setup, the postgres database may not yet be available, so, we’ll retry 5 times to connect to it

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Needed to move up, because otherwise the /:projectSlug endpoint would be selected.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
- also update action versions
- rely on docker compose to also build the images

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr smarr mentioned this pull request Jan 20, 2024
@smarr smarr force-pushed the compose branch 2 times, most recently from 4947b2e to ac2de23 Compare January 20, 2024 14:27
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr smarr merged commit fe92ad1 into master Jan 29, 2024
3 checks passed
@smarr smarr deleted the compose branch January 29, 2024 16:13
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.

1 participant