Use celery tasks instead of systemd timers for periodic work; and add more tests
All checks were successful
Deploy to Server / deploy (push) Successful in 26s
All checks were successful
Deploy to Server / deploy (push) Successful in 26s
This commit is contained in:
parent
333476b30b
commit
66ea46cf23
25 changed files with 2133 additions and 104 deletions
|
|
@ -1,10 +0,0 @@
|
|||
[Unit]
|
||||
Description=TTVDrops database backup
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=ttvdrops
|
||||
Group=ttvdrops
|
||||
WorkingDirectory=/home/ttvdrops/ttvdrops
|
||||
EnvironmentFile=/home/ttvdrops/ttvdrops/.env
|
||||
ExecStart=/usr/bin/uv run python manage.py backup_db
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
[Unit]
|
||||
Description=Nightly TTVDrops database backup
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 02:15:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
27
tools/systemd/ttvdrops-celery-beat.service
Normal file
27
tools/systemd/ttvdrops-celery-beat.service
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
[Unit]
|
||||
Description=TTVDrops Celery Beat scheduler
|
||||
After=network-online.target valkey.service ttvdrops-celery-worker.service
|
||||
Wants=network-online.target valkey.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=ttvdrops
|
||||
Group=ttvdrops
|
||||
SupplementaryGroups=http
|
||||
UMask=0002
|
||||
WorkingDirectory=/home/ttvdrops/ttvdrops
|
||||
EnvironmentFile=/home/ttvdrops/ttvdrops/.env
|
||||
ExecStart=/usr/bin/uv run celery -A config beat \
|
||||
--scheduler django_celery_beat.schedulers:DatabaseScheduler \
|
||||
--loglevel INFO
|
||||
ExecStop=/bin/kill -s TERM $MAINPID
|
||||
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=ttvdrops-celery-beat
|
||||
|
||||
Restart=on-failure
|
||||
RestartSec=10s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
31
tools/systemd/ttvdrops-celery-worker.service
Normal file
31
tools/systemd/ttvdrops-celery-worker.service
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[Unit]
|
||||
Description=TTVDrops Celery worker
|
||||
After=network-online.target valkey.service
|
||||
Wants=network-online.target valkey.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=ttvdrops
|
||||
Group=ttvdrops
|
||||
SupplementaryGroups=http
|
||||
UMask=0002
|
||||
WorkingDirectory=/home/ttvdrops/ttvdrops
|
||||
EnvironmentFile=/home/ttvdrops/ttvdrops/.env
|
||||
ExecStart=/usr/bin/uv run celery -A config worker \
|
||||
--queues imports,api-fetches,default \
|
||||
--concurrency 4 \
|
||||
--loglevel INFO
|
||||
ExecStop=/bin/kill -s TERM $MAINPID
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
|
||||
MemoryLimit=512M
|
||||
CPUQuota=75%
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=ttvdrops-celery-worker
|
||||
|
||||
Restart=on-failure
|
||||
RestartSec=10s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
[Unit]
|
||||
Description=TTVDrops watch and import drops from pending directory
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=ttvdrops
|
||||
Group=ttvdrops
|
||||
SupplementaryGroups=http
|
||||
UMask=0002
|
||||
WorkingDirectory=/home/ttvdrops/ttvdrops
|
||||
EnvironmentFile=/home/ttvdrops/ttvdrops/.env
|
||||
ExecStart=/usr/bin/uv run python manage.py watch_imports /mnt/fourteen/Data/Responses/pending --verbose
|
||||
|
||||
# Restart policy
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
# Process management
|
||||
KillMode=mixed
|
||||
KillSignal=SIGTERM
|
||||
|
||||
# Resource limits
|
||||
MemoryLimit=512M
|
||||
CPUQuota=50%
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=ttvdrops-watch
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
[Unit]
|
||||
Description=TTVDrops import Kick drops
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=ttvdrops
|
||||
Group=ttvdrops
|
||||
SupplementaryGroups=http
|
||||
UMask=0002
|
||||
WorkingDirectory=/home/ttvdrops/ttvdrops
|
||||
EnvironmentFile=/home/ttvdrops/ttvdrops/.env
|
||||
ExecStart=/usr/bin/uv run python manage.py import_kick_drops
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=ttvdrops-import-kick
|
||||
|
||||
# Resource limits
|
||||
MemoryLimit=512M
|
||||
CPUQuota=50%
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
[Unit]
|
||||
Description=TTVDrops import Kick drops at :01, :16, :31, and :46
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* *:01,16,31,46:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue