-
Notifications
You must be signed in to change notification settings - Fork 10
Update docker compose #88
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
Merged
olivhoenen
merged 10 commits into
iterorganization:develop
from
Yannicked:feature/docker-compose
Jun 18, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
287d0e1
Update docker files
Yannicked 05cf791
Temporarily comment celery worker and beat
Yannicked fc7c3ef
Add uv lockfile
Yannicked 4fdab64
add docker-compose-pyver.yml, argument PYVER, with_workers profile
Louwrensth fe146c1
server.port as env/config option
Louwrensth 7854b4d
Dockerfile: explicit uv lock
Louwrensth eacea55
Revert "Dockerfile: explicit uv lock"
Louwrensth 38dabab
newline at end of file
Louwrensth 4451edd
add ./validation path for compose server
Louwrensth b2a10df
bug: missing server.imas_remote_host
Louwrensth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,25 @@ | ||
| FROM python:3.7 | ||
| COPY ./ /tmp/simdb/ | ||
| RUN cd /tmp/simdb/ && \ | ||
| pip3 install . && \ | ||
| pip3 install flask flask_caching flask_cors flask_restx gunicorn psycopg2-binary && \ | ||
| rm -rf /tmp/simdb | ||
|
|
||
| ENTRYPOINT ["gunicorn", "--bind=0.0.0.0:5000", "--workers=1", "simdb.remote.wsgi:app"] | ||
| EXPOSE 5000 | ||
| ARG PYVER=3.12 | ||
| FROM ghcr.io/astral-sh/uv:python${PYVER}-trixie-slim | ||
|
|
||
| ENV UV_NO_DEV=1 | ||
| ENV SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0 | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| libpq-dev \ | ||
| libldap2-dev \ | ||
| libsasl2-dev \ | ||
| libmagic1 \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY uv.lock pyproject.toml alembic.ini ./ | ||
| COPY src/ ./src/ | ||
| COPY alembic/ ./alembic/ | ||
| RUN uv sync --locked --extra all | ||
|
|
||
| ENV SIMDB_SITE_CONFIG_PATH=/app/config/simdb.cfg | ||
|
|
||
| CMD ["uv", "run", "simdb_server"] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| [flask] | ||
| flask_env = development | ||
| debug = True | ||
| testing = True | ||
| secret_key = CHANGE ME | ||
|
|
||
| [authentication] | ||
| type=none | ||
|
|
||
| [server] | ||
| upload_folder = /data/simdb/simulations | ||
| port = 5000 | ||
| ssl_enabled = False | ||
| authentication_type = None | ||
| admin_password=CHANGE_ME | ||
| imas_remote_host = localhost | ||
|
|
||
| [database] | ||
| type = postgres | ||
| host = postgres | ||
| port = 5432 | ||
| username = simdb | ||
| password = simdb | ||
| database = simdb | ||
|
|
||
| [validation] | ||
| path = ./validation | ||
| auto_validate = True | ||
| error_on_fail = True | ||
|
|
||
| [celery] | ||
| broker_url = redis://redis:6379/0 | ||
| result_backend = redis://redis:6379/0 | ||
|
|
||
| [partition] | ||
| data = /data/simdb/partition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # This docker-compose-pyver.yml extends the base docker-compose.yml | ||
| # to run three web services for different PYVER (3.11 and 3.13, 3.12 is the default) | ||
| # but they all use the same redis and postgres service. | ||
| # Run `docker compose -f docker-compose-workers.yml up` to start it up. | ||
| include: | ||
| - docker-compose.yml | ||
|
|
||
| services: | ||
| migrations-311: | ||
| extends: | ||
| service: migrations | ||
| build: | ||
| args: | ||
| PYVER: "3.11" | ||
|
|
||
| migrations-313: | ||
| extends: | ||
| service: migrations | ||
| build: | ||
| args: | ||
| PYVER: "3.13" | ||
|
|
||
| web-311: | ||
| extends: | ||
| service: web | ||
| build: | ||
| args: | ||
| PYVER: "3.11" | ||
| ports: !override | ||
| - "5001:5000" | ||
| depends_on: !override | ||
| # !override is necessary to remove the original migrations from depends_on | ||
| redis: | ||
| condition: service_healthy | ||
| postgres: | ||
| condition: service_healthy | ||
| migrations-311: | ||
| condition: service_completed_successfully | ||
|
|
||
| web-313: | ||
| extends: | ||
| service: web | ||
| build: | ||
| args: | ||
| PYVER: "3.13" | ||
| ports: !override | ||
| - "5003:5000" | ||
| depends_on: !override | ||
| redis: | ||
| condition: service_healthy | ||
| postgres: | ||
| condition: service_healthy | ||
| migrations-313: | ||
| condition: service_completed_successfully |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,94 @@ | ||
| version: "3.9" | ||
| services: | ||
| db: | ||
| image: postgres | ||
| migrations: | ||
| build: . | ||
| volumes: | ||
| - db_data:/var/lib/postgresql/data | ||
| - ./config:/app/config:ro | ||
| environment: | ||
| POSTGRES_DB: simdb | ||
| POSTGRES_USER: simdb | ||
| POSTGRES_PASSWORD: simdb | ||
| simdb: | ||
| DATABASE_URL: postgresql+psycopg2://simdb:simdb@postgres:5432/simdb | ||
| depends_on: | ||
| - postgres | ||
| command: uv run alembic upgrade head | ||
| restart: "no" | ||
|
|
||
| web: | ||
| build: . | ||
| environment: | ||
| SIMDB_DATABASE_TYPE: postgres | ||
| SIMDB_DATABASE_HOST: db | ||
| SIMDB_DATABASE_PORT: 5432 | ||
| SIMDB_SERVER_UPLOAD_FOLDER: /simulations | ||
| ports: | ||
| - "5000:5000" | ||
| volumes: | ||
| - simulations:/simulations | ||
| - ./validation:/app/validation:ro | ||
| - ./config:/app/config:ro | ||
| - ./tmp/partition_data:/data/simdb/partition:ro | ||
| - ./upload_folder:/data/simdb/simulations | ||
| depends_on: | ||
| - db | ||
| nginx: | ||
| image: nginx | ||
| ports: | ||
| - 80:80 | ||
| redis: | ||
| condition: service_healthy | ||
| postgres: | ||
| condition: service_healthy | ||
| migrations: | ||
| condition: service_completed_successfully | ||
| restart: unless-stopped | ||
|
|
||
| worker: | ||
| profiles: [with_workers] | ||
| # docker compose --profile with_workers enables this service | ||
| build: . | ||
| command: uv run simdb_worker | ||
| volumes: | ||
| - ./config:/app/config:ro | ||
| - ./tmp/partition_data:/data/simdb/partition:ro | ||
| - ./upload_folder:/data/simdb/simulations | ||
| depends_on: | ||
| redis: | ||
| condition: service_healthy | ||
| postgres: | ||
| condition: service_healthy | ||
| migrations: | ||
| condition: service_completed_successfully | ||
| restart: unless-stopped | ||
|
|
||
| beat: | ||
| profiles: [with_workers] | ||
| # docker compose --profile with_workers enables this service | ||
| build: . | ||
| command: uv run simdb_beat | ||
| volumes: | ||
| - ./config:/app/config:ro | ||
| depends_on: | ||
| - simdb | ||
| redis: | ||
| condition: service_healthy | ||
| postgres: | ||
| condition: service_healthy | ||
| migrations: | ||
| condition: service_completed_successfully | ||
| restart: unless-stopped | ||
|
|
||
| redis: | ||
| image: redis:8-alpine | ||
| volumes: | ||
| - redis_data:/data | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "ping"] | ||
| interval: 1s | ||
| timeout: 5s | ||
| retries: 5 | ||
| restart: unless-stopped | ||
|
|
||
| postgres: | ||
|
Yannicked marked this conversation as resolved.
|
||
| image: postgres:16-alpine | ||
| environment: | ||
| - POSTGRES_USER=simdb | ||
| - POSTGRES_PASSWORD=simdb | ||
| - POSTGRES_DB=simdb | ||
| volumes: | ||
| - ./docker/proxy_params:/etc/nginx/proxy_params | ||
| - ./docker/simdb.nginx:/etc/nginx/conf.d/default.conf | ||
| - postgres_data:/var/lib/postgresql/data | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "pg_isready -U simdb"] | ||
| interval: 1s | ||
| timeout: 5s | ||
| retries: 5 | ||
| restart: unless-stopped | ||
|
|
||
| volumes: | ||
| db_data: {} | ||
| simulations: {} | ||
| redis_data: | ||
| postgres_data: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ | |
|
|
||
| from simdb.remote.wsgi import run | ||
|
|
||
| run(port=5000) | ||
| run() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,4 +15,4 @@ type = sqlite | |
|
|
||
| [validation] | ||
| auto_validate = True | ||
| error_on_fail = True | ||
| error_on_fail = True | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.