forked from DGNum/gestioCOF
Vagrant: toutes les units systemd sont là
This commit is contained in:
parent
df222f18a3
commit
7f58b5fa00
9 changed files with 49 additions and 20 deletions
|
@ -57,7 +57,7 @@ mkdir -p /srv/gestiocof/static
|
|||
chown -R vagrant:www-data /srv/gestiocof
|
||||
|
||||
# Nginx
|
||||
ln -s -f /vagrant/provisioning/nginx.conf /etc/nginx/sites-enabled/gestiocof.conf
|
||||
ln -s -f /vagrant/provisioning/nginx/gestiocof.conf /etc/nginx/sites-enabled/gestiocof.conf
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
systemctl reload nginx
|
||||
|
||||
|
@ -78,16 +78,21 @@ sudo -H -u vagrant \
|
|||
--noinput \
|
||||
--settings "$DJANGO_SETTINGS_MODULE"
|
||||
|
||||
# Installation du cron pour les mails de rappels
|
||||
# TODO: FIXME
|
||||
# sudo -H -u vagrant crontab provisioning/cron.dev
|
||||
|
||||
# Daphne + runworker
|
||||
# TODO: explain
|
||||
ln -sf /vagrant/provisioning/daphne.service /etc/systemd/system/daphne.service
|
||||
ln -sf /vagrant/provisioning/worker.service /etc/systemd/system/worker.service
|
||||
# Quelques units systemd:
|
||||
# - Daphne fait tourner le serveur asgi
|
||||
# - worker = https://channels.readthedocs.io/en/stable/topics/worker.html
|
||||
# - Mails de rappels du BdA
|
||||
# - Mails de revente du BdA
|
||||
ln -sf /vagrant/provisioning/systemd/daphne.service /etc/systemd/system/daphne.service
|
||||
ln -sf /vagrant/provisioning/systemd/worker.service /etc/systemd/system/worker.service
|
||||
ln -sf /vagrant/provisioning/systemd/reventes.service /etc/systemd/system/reventes.service
|
||||
ln -sf /vagrant/provisioning/systemd/rappels.service /etc/systemd/system/rappels.service
|
||||
ln -sf /vagrant/provisioning/systemd/reventes.timer /etc/systemd/system/reventes.timer
|
||||
ln -sf /vagrant/provisioning/systemd/rappels.timer /etc/systemd/system/rappels.timer
|
||||
systemctl enable --now daphne.service
|
||||
systemctl enable --now worker.service
|
||||
systemctl enable rappels.timer
|
||||
systemctl enable reventes.timer
|
||||
|
||||
# Configure le bash de l'utilisateur 'vagrant' pour utiliser le bon fichier de
|
||||
# settings et et bon virtualenv.
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# On utilise la version de développement de GestioCOF
|
||||
DJANGO_SETTINGS_MODULE='cof.settings.dev'
|
||||
|
||||
# Identifiants MySQL
|
||||
DBUSER="cof_gestion"
|
||||
DBNAME="cof_gestion"
|
||||
DBPASSWD="4KZt3nGPLVeWSvtBZPSM3fSzXpzEU4"
|
||||
|
||||
19 */12 * * * date >> /vagrant/rappels.log ; /ubuntu/home/venv/bin/python /vagrant/manage.py sendrappels >> /vagrant/rappels.log 2>&1
|
||||
*/5 * * * * /ubuntu/home/venv/bin/python /vagrant/manage.py manage_revente >> /vagrant/reventes.log 2>&1
|
|
@ -1,4 +1,4 @@
|
|||
Description="GestioCOF"
|
||||
Description="GestioCOF - Daphne"
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
8
provisioning/systemd/rappels.service
Normal file
8
provisioning/systemd/rappels.service
Normal file
|
@ -0,0 +1,8 @@
|
|||
[Unit]
|
||||
Description=Envoi des mails de rappel des spectales BdA
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=vagrant
|
||||
Environment="DJANGO_SETTINGS_MODULE=cof.settings.dev"
|
||||
ExecStart=/home/vagrant/venv/bin/python /vagrant/manage.py sendrappels
|
9
provisioning/systemd/rappels.timer
Normal file
9
provisioning/systemd/rappels.timer
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Envoi des mails de rappel des spectales BdA
|
||||
|
||||
[Timer]
|
||||
OnBootSec=10min
|
||||
OnUnitActiveSec=3h
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
8
provisioning/systemd/reventes.service
Normal file
8
provisioning/systemd/reventes.service
Normal file
|
@ -0,0 +1,8 @@
|
|||
[Unit]
|
||||
Description=Envoi des mails de BdA-Revente
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=vagrant
|
||||
Environment="DJANGO_SETTINGS_MODULE=cof.settings.dev"
|
||||
ExecStart=/home/vagrant/venv/bin/python /vagrant/manage.py manage_reventes
|
9
provisioning/systemd/reventes.timer
Normal file
9
provisioning/systemd/reventes.timer
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Envoi des mails de BdA-Revente
|
||||
|
||||
[Timer]
|
||||
OnBootSec=15min
|
||||
OnUnitActiveSec=15min
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Loading…
Reference in a new issue