set up cronjob and timer
This commit is contained in:
@@ -46,6 +46,7 @@ services:
|
||||
post_start:
|
||||
- command:
|
||||
- rm
|
||||
- -f
|
||||
- "/var/www/app/config/packages/chill_doc_store.yaml"
|
||||
user: root
|
||||
|
||||
@@ -67,17 +68,17 @@ services:
|
||||
- "-c"
|
||||
- "touch /tmp/kill_me && bin/console messenger:stop-workers"
|
||||
|
||||
cron:
|
||||
<<: *defaultApp
|
||||
entrypoint: "/usr/bin/env"
|
||||
command: ["bin/console", "chill:cron-job:execute", "-v"]
|
||||
|
||||
{% if item.add_postgres %}
|
||||
|
||||
database:
|
||||
image: "{{ database_image }}"
|
||||
env_file:
|
||||
- postgres.env
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-app}
|
||||
# You should definitely change the password in production
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-app}
|
||||
volumes:
|
||||
- ./docker/db/data:/var/lib/postgresql/data:rw
|
||||
networks:
|
||||
|
9
templates/systemd/chill-cronjob@.service
Normal file
9
templates/systemd/chill-cronjob@.service
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Execute cron job for chill with environment %i
|
||||
|
||||
[Service]
|
||||
User={{ as_user }}
|
||||
ExecStart=/usr/bin/docker compose --file {{ install_dir }}/%i/compose.yaml up cron
|
||||
Type=simple
|
||||
# execute maximum 30 minutes
|
||||
RuntimeMaxSec=1800
|
10
templates/systemd/chill-cronjob@.timer
Normal file
10
templates/systemd/chill-cronjob@.timer
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Run chill cron-jobs
|
||||
|
||||
[Timer]
|
||||
Unit=chill-cronjob@%i.service
|
||||
OnCalendar=*-*-* *:0,15,30,45:00
|
||||
RandomizedDelaySec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user