Skip to content

Commit

Permalink
Disable cron's on develop environment
Browse files Browse the repository at this point in the history
Non-application cron's perform various tasks that are not critical to the applications functioning but do incur additonal load (run tests) and changes (restarting container) onto the application which might hinder development, so these are disabled by default.
  • Loading branch information
aequitas authored and mxsasha committed Sep 19, 2024
1 parent f913e95 commit 9319cb0
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker/batch-test.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ INTERNETNL_DOMAINNAME=internet.test
# use unique name to not conflict with integration tests
COMPOSE_PROJECT_NAME=internetnl-batch-test

COMPOSE_PROFILES=batch
COMPOSE_PROFILES=batch,cron

ENABLE_BATCH=True

Expand Down
2 changes: 1 addition & 1 deletion docker/build.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# include all compose files
COMPOSE_FILE=docker/docker-compose.yml:docker/docker-compose-development.yml:docker/docker-compose-integration-tests.yml:docker/docker-compose-test.yml:docker/docker-compose-tools.yml:docker/docker-compose-test-runner-develop.yml:docker/docker-compose-integration-tests.yml
COMPOSE_PROFILES=build
COMPOSE_PROFILES=default,cron,batch,build

# don't expose HTTP(S) and DNS ports to the outside, this also causes issues due to being privileged ports
WEBSERVER_PORT=80
Expand Down
4 changes: 2 additions & 2 deletions docker/defaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ COMPOSE_PROJECT_NAME=internetnl
# configure which compose files are included in this environment
COMPOSE_FILE=docker/docker-compose.yml

# enable all services
COMPOSE_PROFILES=default
# enable all services and crons
COMPOSE_PROFILES=default,cron

# interval for batch processing
BATCH_SCHEDULER_INTERVAL=1
Expand Down
5 changes: 4 additions & 1 deletion docker/develop.env
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,7 @@ CRON_15MIN_RUN_TESTS=False
INTERNETNL_BRANDING=False

# disable caching in development environment
NGINX_PROXY_CACHE=off
NGINX_PROXY_CACHE=off

# only enable application services
COMPOSE_PROFILES=default
6 changes: 6 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,9 @@ services:
start_period: 1m
retries: 10

profiles:
- cron

# cron daemon with access to Docker socket but no networking
cron-docker:
image: alpinelinux/docker-cli:latest
Expand Down Expand Up @@ -739,6 +742,9 @@ services:
volumes:
- /var/run/docker.sock:/var/run/docker.sock

profiles:
- cron

grafana:
image: ${DOCKER_IMAGE_GRAFANA:-${DOCKER_REGISTRY:-ghcr.io/internetstandards}/grafana:${RELEASE:-latest}}
build:
Expand Down
2 changes: 1 addition & 1 deletion documentation/Docker-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ A Prometheus Alertmanager service is available but disabled by default. Enabling

To enable and configure the Alertmanager add the following lines to `docker/local.env` and adjust the values to be applicable for your environment:

COMPOSE_PROFILES=default,alertmanager
COMPOSE_PROFILES=default,cron,alertmanager
[email protected],[email protected]
[email protected]
ALERTMANAGER_SMTP_HOST=smtp.example.com
Expand Down
4 changes: 4 additions & 0 deletions documentation/Docker-development-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,7 @@ During development the version will always be `0.0.0-dev`. This is to prevent dy
## DB Migrations

This project uses [Django Migrations](https://docs.djangoproject.com/en/4.2/topics/migrations/). When bring up the Docker environment, migrations are automatically applied when needed to bring the database in the desired state.

## Cron jobs

There are various cron jobs configured during normal deployments that perform tasks not cricital to the functionality of the application. These can however hinder development as they add additional activity to the application or cause changes like restarting workers. Because of this they are disabled in `develop` environment. You can temporary enable them by adding the line `COMPOSE_PROFILES=default,cron` to `docker/local.env`.

0 comments on commit 9319cb0

Please sign in to comment.