Skip to content

Commit

Permalink
Add cron with docker socket to restart nassl worker every hour
Browse files Browse the repository at this point in the history
  • Loading branch information
aequitas authored and mxsasha committed Mar 12, 2024
1 parent 89bf57b commit c2d8697
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,23 @@ services:
command: celery --app internetnl worker --without-gossip --pool=eventlet --time-limit=300 --concurrency=$WORKER_CONCURRENCY
--queues nassl_worker

# cron daemon with access to Docker socket to restart worker-nassl periodically to solve memory issues
restart-nassl-worker:
image: alpinelinux/docker-cli:latest
command: crond -f -d7
configs:
- source: restart_nassl_worker_cron
target: /etc/periodic/hourly/restart_nassl_worker
mode: 0755
restart: unless-stopped
logging:
driver: $LOGGING_DRIVER
options:
tag: '{{.Name}}'
network_mode: "none"
volumes:
- /var/run/docker.sock:/var/run/docker.sock

# worker for slow and long running tasks that could require a lot of memory (eg: hof update)
worker-slow:
# copy all attributes from 'worker' service and overwrite specific settings below
Expand Down Expand Up @@ -882,6 +899,12 @@ configs:
}
restart_nassl_worker_cron:
content: |
#!/bin/sh
set -e
# find nassl worker and restart the container
docker restart $(docker ps --filter label=com.docker.compose.service=worker-nassl --quiet)
networks:
# disable default network
Expand Down

0 comments on commit c2d8697

Please sign in to comment.