voicegardens/fabfile.py

62 lines
1.9 KiB
Python
Raw Normal View History

2019-12-22 05:36:48 +01:00
"""Deployment with Fabric."""
from fabric import task
2019-12-22 05:36:48 +01:00
@task
def offline(c):
"""Release offline.voicegardens.org."""
print("Releasing offline.voicegardens.org ...")
with c.cd("/var/www/offline.voicegardens.org"):
2021-05-18 09:57:03 +02:00
c.run("git pull origin offline")
2021-05-27 19:55:14 +02:00
c.run("sudo supervisorctl restart voicegardens:offline")
c.run("sudo systemctl restart nginx")
print("Released <3")
2019-12-22 05:36:48 +01:00
2020-02-11 14:27:48 +01:00
@task
def voicegardens(c):
"""Release voicegardens.org."""
print("Releasing voicegardens.org ...")
with c.cd("/var/www/voicegardens.org"):
c.run("git pull origin main")
2021-05-27 19:55:14 +02:00
c.run("sudo supervisorctl restart voicegardens:online")
c.run("sudo systemctl restart nginx")
print("Released <3")
2020-02-11 14:27:48 +01:00
@task
def dailycron(c):
2020-02-19 22:27:40 +01:00
"""Copy new daily crontab."""
print("Copy over new daily crontab ...")
2020-02-11 14:27:48 +01:00
# See https://github.com/fabric/fabric/issues/1750
c.put("./bin/voicegardens-cron-daily", remote="./")
c.sudo("mv voicegardens-cron-daily /etc/cron.daily")
c.sudo("chown root:root /etc/cron.daily/voicegardens-cron-daily")
print("New daily cron in place <3")
2020-02-19 22:27:40 +01:00
@task
def hourlycron(c):
"""Copy new hourly crontab."""
print("Copy over new hourly crontab ...")
2020-02-19 22:27:40 +01:00
# See https://github.com/fabric/fabric/issues/1750
c.put("./bin/voicegardens-cron-hourly", remote="./")
c.sudo("mv voicegardens-cron-hourly /etc/cron.hourly")
c.sudo("chown root:root /etc/cron.hourly/voicegardens-cron-hourly")
print("New hourly cron in place <3")
2020-02-11 14:27:48 +01:00
2019-12-22 05:36:48 +01:00
@task
def cleanarchives(c):
2020-02-11 14:27:48 +01:00
"""Remove all archives."""
print("Removing the offline.voicegardens.org archives ...")
with c.cd("/var/www/offline.voicegardens.org"):
c.run("rm -rf ./voicegardens/archive/*")
2020-02-11 14:27:48 +01:00
print("Removing the voicegardens.org archives ...")
with c.cd("/var/www/voicegardens.org"):
c.run("rm -rf ./voicegardens/archive/*")
2020-02-11 14:27:48 +01:00
print("Deleted <3")