Browse Source

Take a pass on preparing for new deployment

main
decentral1se 4 years ago
parent
commit
1265c41da5
No known key found for this signature in database GPG Key ID: 92DAD76BD9567B8A
  1. 0
      LICENSE
  2. 6
      README.md
  3. 4
      bin/clear-archives
  4. 8
      bin/copy-fixed-archive
  5. 4
      bin/voicegardens-cron-daily
  6. 3
      bin/voicegardens-cron-hourly
  7. 67
      fabfile.py
  8. 8
      makefile

0
LICENSE.txt → LICENSE

6
README.md

@ -12,7 +12,7 @@
## Interwebz
- [live site voicegardens.org](https://voicegardens.org)
- [test site doesitsparkjoy.voicegardens.org](http://doesitsparkjoy.voicegardens.org)
- ["offline" installation version of voicegardens.org](https://offline.voicegardens.org)
- [barbican.org.uk: This is Public Space](https://www.barbican.org.uk/whats-on/2019/event/this-is-public-space)
- [upprojects.com: This is Public Space](https://www.upprojects.com/projects/this-is-public-space/)
@ -52,7 +52,7 @@ $ sudo -i # you have root access too
Then it's possible to release the site with the following targets.
```bash
$ make doesitsparkjoy # https://doesitsparkjoy.voicegardens.org
$ make offline # https://offline.voicegardens.org
$ make voicegardens # https://voicegardens.org
```
@ -63,4 +63,4 @@ $ make voicegardens # https://voicegardens.org
## License
- [AGPL](LICENSE.txt)
- [AGPL](LICENSE)

4
bin/clear-archives

@ -3,8 +3,8 @@
echo "Spitting out todays date and time for the archive deletion cron ..."
date
echo "Deleting doesitsparkjoy.voicegardens.org archive ..."
rm -rf /var/www/doesitsparkjoy.voicegardens.org/voicegardens/archive/*
echo "Deleting offline.voicegardens.org archive ..."
rm -rf /var/www/offline.voicegardens.org/voicegardens/archive/*
echo "Deleting voicegardens.org archive ..."
rm -rf /var/www/voicegardens.org/voicegardens/archive/*

8
bin/copy-fixed-archive

@ -3,10 +3,10 @@
echo "Spitting out todays date and time for the fixed archive copying cron ..."
date
echo "Copying over the doesitsparkjoy.voicegardens.org fixed archive ..."
rm -rf /var/www/doesitsparkjoy.voicegardens.org/voicegardens/archive/*
cp /var/www/doesitsparkjoy.voicegardens.org/voicegardens/fixed-archive/* /var/www/doesitsparkjoy.voicegardens.org/voicegardens/archive/
chown -R voicegardens:voicegardens /var/www/doesitsparkjoy.voicegardens.org/voicegardens/archive/
echo "Copying over the offline.voicegardens.org fixed archive ..."
rm -rf /var/www/offline.voicegardens.org/voicegardens/archive/*
cp /var/www/offline.voicegardens.org/voicegardens/fixed-archive/* /var/www/doesitsparkjoy.voicegardens.org/voicegardens/archive/
chown -R voicegardens:voicegardens /var/www/offline.voicegardens.org/voicegardens/archive/
echo "Copying over the voicegardens.org fixed archive ..."
rm -rf /var/www/voicegardens.org/voicegardens/archive/*

4
bin/voicegardens-cron-daily

@ -1,4 +1,4 @@
#!/bin/sh
/var/www/doesitsparkjoy.voicegardens.org/bin/clear-archives | tee -a /var/log/voicegardens.org.log
/var/www/doesitsparkjoy.voicegardens.org/bin/copy-fixed-archive | tee -a /var/log/voicegardens.org.log
/var/www/offline.voicegardens.org/bin/clear-archives | tee -a /var/log/voicegardens.org.log
/var/www/offline.voicegardens.org/bin/copy-fixed-archive | tee -a /var/log/voicegardens.org.log

3
bin/voicegardens-cron-hourly

@ -3,5 +3,6 @@
echo "Spitting out todays date and time for the 0 filesize cron ..."
date
find /var/www/doesitsparkjoy.voicegardens.org/voicegardens/archive/ -maxdepth 1 -type f -size 0 | xargs -I {} rm -v {} | tee -a /var/log/voicegardens.org.log
find /var/www/offline.voicegardens.org/voicegardens/archive/ -maxdepth 1 -type f -size 0 | xargs -I {} rm -v {} | tee -a /var/log/voicegardens.org.log
find /var/www/voicegardens.org/voicegardens/archive/ -maxdepth 1 -type f -size 0 | xargs -I {} rm -v {} | tee -a /var/log/voicegardens.org.log

67
fabfile.py

@ -2,55 +2,60 @@
from fabric import task
@task
def doesitsparkjoy(c):
"""Release doesitsparkjoy.voicegardens.org."""
print('Releasing doesitsparkjoy.voicegardens.org ...')
with c.cd('/var/www/doesitsparkjoy.voicegardens.org'):
c.run('git pull origin master')
c.run('sudo supervisorctl restart apps:doesitsparkjoy')
c.run('sudo systemctl restart nginx')
print('Released <3')
def offline(c):
"""Release offline.voicegardens.org."""
print("Releasing offline.voicegardens.org ...")
with c.cd("/var/www/offline.voicegardens.org"):
c.run("git pull origin main")
c.run("sudo supervisorctl restart apps:offline")
c.run("sudo systemctl restart nginx")
print("Released <3")
@task
def voicegardens(c):
"""Release voicegardens.org."""
print('Releasing voicegardens.org ...')
with c.cd('/var/www/voicegardens.org'):
c.run('git pull origin master')
c.run('sudo supervisorctl restart apps:voicegardens')
c.run('sudo systemctl restart nginx')
print('Released <3')
print("Releasing voicegardens.org ...")
with c.cd("/var/www/voicegardens.org"):
c.run("git pull origin main")
c.run("sudo supervisorctl restart apps:voicegardens")
c.run("sudo systemctl restart nginx")
print("Released <3")
@task
def dailycron(c):
"""Copy new daily crontab."""
print('Copy over new daily crontab ...')
print("Copy over new daily crontab ...")
# 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')
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")
@task
def hourlycron(c):
"""Copy new hourly crontab."""
print('Copy over new hourly crontab ...')
print("Copy over new hourly crontab ...")
# 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')
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")
@task
def cleanarchives(c):
"""Remove all archives."""
print('Removing the doesitsparkjoy.voicegardens.org archives ...')
with c.cd('/var/www/doesitsparkjoy.voicegardens.org'):
c.run('rm -rf ./voicegardens/archive/*')
print("Removing the offline.voicegardens.org archives ...")
with c.cd("/var/www/offline.voicegardens.org"):
c.run("rm -rf ./voicegardens/archive/*")
print('Removing the voicegardens.org archives ...')
with c.cd('/var/www/voicegardens.org'):
c.run('rm -rf ./voicegardens/archive/*')
print("Removing the voicegardens.org archives ...")
with c.cd("/var/www/voicegardens.org"):
c.run("rm -rf ./voicegardens/archive/*")
print('Deleted <3')
print("Deleted <3")

8
makefile

@ -15,8 +15,8 @@ prod-serve:
clear-local-archive:
@rm -rf $(ARCHIVE_DIR)/* && cp $(FIXED_ARCHIVE_DIR)/* $(ARCHIVE_DIR)
doesitsparkjoy:
@fab -H $(REMOTE_HOST) doesitsparkjoy
offline:
@fab -H $(REMOTE_HOST) offline
voicegardens:
@fab -H $(REMOTE_HOST) voicegardens
@ -30,6 +30,6 @@ dailycron:
hourlycron:
@fab -H $(REMOTE_HOST) hourlycron
release: doesitsparkjoy voicegardens
release: offline voicegardens
.PHONY: dev-serve prod-serve clear-local-archive doesitsparkjoy voicegardens cleanarchives dailycron release
.PHONY: dev-serve prod-serve clear-local-archive offline voicegardens cleanarchives dailycron release

Loading…
Cancel
Save