diff --git a/stacks/oncall/stack-oncall.yml b/stacks/oncall/stack-oncall.yml index 3f13394..f74b2fc 100644 --- a/stacks/oncall/stack-oncall.yml +++ b/stacks/oncall/stack-oncall.yml @@ -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: @@ -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