Skip to content

Commit

Permalink
fix(oncall): misc cleanup and tunning
Browse files Browse the repository at this point in the history
  • Loading branch information
raisedadead committed Jan 16, 2025
1 parent d1a3c8e commit c363a55
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions stacks/oncall/stack-oncall.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
services:
# CRON service
svc-cronjob:
image: crazymax/swarm-cronjob
image: crazymax/swarm-cronjob:latest
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
environment:
- "TZ=UTC"
- "LOG_LEVEL=info"
# Set log level to "debug" because we want to see
# detailed updates about the jobs
- "LOG_LEVEL=debug"
- "LOG_JSON=false"
deploy:
placement:
Expand All @@ -19,38 +21,41 @@ services:
environment:
- "TZ=UTC"
- "FILTER_SERVICES=label=org.freecodecamp.autoupdate"
- "IGNORELIST_SERVICES=oncall_shepherd oncall_cronjob oncall_cleanup portainer_agent portainer_portainer"
- "RUN_ONCE_AND_EXIT=true"
- "WITH_REGISTRY_AUTH=true"
- "VERBOSE=true"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/home/freecodecamp/.docker/config.json:/root/.docker/config.json"
- "/home/freecodecamp/.docker/config.json:/root/.docker/config.json:ro"
deploy:
mode: replicated
replicas: 0
restart_policy:
condition: none
labels:
- "swarm.cronjob.enable=true"
- "swarm.cronjob.replicas=1"
# Fire every hour, on the 45th minute mark
- "swarm.cronjob.schedule=0 45 0/1 * * *"
# Fire every 1 minute -- for testing
# - "swarm.cronjob.schedule=* * * * *"
- "swarm.cronjob.skip-running=true"
placement:
constraints:
- "node.role == manager"

# Cleanup Service
# Cleanup Service
svc-cleanup:
image: docker
command: [ "docker", "system", "prune", "--volumes", "--all", "-f" ]
command: ["docker", "system", "prune", "--volumes", "--all", "-f"]
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
mode: global
labels:
- "swarm.cronjob.enable=true"
# Fire every 8 hours, on the 15th minute mark
- "swarm.cronjob.schedule=0 15 0/8 * * *"
# Fire every 6 hours, on the 15th minute mark
- "swarm.cronjob.schedule=0 15 0/6 * * *"
- "swarm.cronjob.skip-running=false"
restart_policy:
condition: none

0 comments on commit c363a55

Please sign in to comment.