[Unit] # The scheduled-job worker (scheduled articles, catalog export, backups, disk # and health probes). This is NOT optional: a web process alone does not # establish that scheduled work runs. The CMS reports it as a failed # diagnostic row when the Redis heartbeat at cms:jobs-worker:heartbeat is # missing, which is exactly what happened while nothing supervised this. # # It runs on the host rather than in a container on purpose: the schedule # shells out to mysqldump, df and docker, none of which exist in the CMS image, # and it must survive CMS deploys (a container is replaced on every release). Description=AtomNext CMS scheduled-job worker Documentation=https://gitlab.epicnabbo.nl/remco/EpicNext-Cms After=network-online.target docker.service mariadb.service Wants=network-online.target # Start ordering only; the worker tolerates the database being briefly absent # and retries, so do not make it hard-fail when mariadb is slow to boot. Wants=docker.service [Service] Type=simple User=root WorkingDirectory=/var/www/atom-nexst Environment=NODE_ENV=production ExecStart=/usr/bin/node --conditions=react-server --import tsx scripts/jobs-worker.ts # The worker's own catch-all logs and exits 1 on a fatal error, so a restart is # always wanted. 10s backoff stops a persistent misconfiguration (missing .env, # bad DATABASE_URL) from spinning. Restart=always RestartSec=10 # Give a crashed job time to finish its DB transaction before the next start, # otherwise a mid-transaction kill can loop on the same failure. TimeoutStopSec=30 KillSignal=SIGTERM StandardOutput=journal StandardError=journal SyslogIdentifier=cms-jobs-worker [Install] WantedBy=multi-user.target