Skip to content

Commit

Permalink
Enable horizontal scaling of queue workers from docker compose (#2100)
Browse files Browse the repository at this point in the history
Introduce a new environment variable `NUM_WORKERS` that allows us to
specify how many queue workers should be created by docker compose.

Also reconfigure these queue workers to restart automatically upon
failure.
  • Loading branch information
zackgalbreath authored Mar 22, 2024
1 parent 4f72f95 commit b60cbc9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ MIX_APP_URL="${APP_URL}"
# The following two variables are only used for docker compose production installations.
SSL_CERTIFICATE_FILE=/etc/ssl/certs/ssl-cert-snakeoil.pem
SSL_CERTIFICATE_KEY_FILE=/etc/ssl/private/ssl-cert-snakeoil.key
NUM_WORKERS=1

# database.php
DB_DATABASE=cdash
Expand Down
7 changes: 5 additions & 2 deletions docker/docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ services:
- "${SSL_CERTIFICATE_FILE}:/var/www/my-cert.pem"
- "${SSL_CERTIFICATE_KEY_FILE}:/var/www/my-cert.key"
worker:
env_file:
- ../.env
image: kitware/cdash-worker
container_name: cdash_worker
build:
context: ..
target: cdash-worker
environment:
DB_HOST: database
deploy:
replicas: 1
replicas: ${NUM_WORKERS:-1}
restart_policy:
condition: any
depends_on:
cdash:
condition: service_healthy
Expand Down
1 change: 1 addition & 0 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ To set up a CDash production instance using docker compose, follow these steps:
- `APP_URL=https://<my-cdash-url>`
- `SSL_CERTIFICATE_FILE=</path/to/certs/my-cert.pem>`
- `SSL_CERTIFICATE_KEY_FILE=</path/to/certs/my-cert.key>`
- `NUM_WORKERS=<desired number of queue worker replicas, defaults to 1>`
* For postgres only, edit `docker/docker-compose.postgres.yml` and uncomment the `worker` section.
* Run this command to start your CDash containers:
```bash
Expand Down

0 comments on commit b60cbc9

Please sign in to comment.