Changeset - 55ee5b53b6f6
[Not reviewed]
12 0 13
Ben Sturmfels (bsturmfels) - 2 months ago 2024-02-23 04:39:54
ben@sturm.com.au
Add a basic script to "push" deploy

Currently updates are published by the "conservancy-www-update.sh" that does a
"pull" deploy with a 5-minutely job that runs on the web server. This doesn't
run `migrate`, `collectstatic` or restart the application, so certain types of
changes don't take effect, and even template changes often don't due to caching
template loader.

This script allows you to deploy more significant updates on-demand, but
requires SSH access.
13 files changed with 13 insertions and 0 deletions:
0 comments (0 inline, 0 general)
bin/deploy/install.yml
Show inline comments
 
file renamed from deploy/install.yml to bin/deploy/install.yml
bin/deploy/inventory.ini
Show inline comments
 
file renamed from deploy/inventory.ini to bin/deploy/inventory.ini
bin/deploy/postfix/main.cf
Show inline comments
 
file renamed from deploy/postfix/main.cf to bin/deploy/postfix/main.cf
bin/deploy/systemd/README.md
Show inline comments
 
file renamed from deploy/systemd/README.md to bin/deploy/systemd/README.md
bin/deploy/systemd/conservancy-www-cleanup.service
Show inline comments
 
file renamed from deploy/systemd/conservancy-www-cleanup.service to bin/deploy/systemd/conservancy-www-cleanup.service
bin/deploy/systemd/conservancy-www-db.path
Show inline comments
 
file renamed from deploy/systemd/conservancy-www-db.path to bin/deploy/systemd/conservancy-www-db.path
bin/deploy/systemd/conservancy-www-db.service
Show inline comments
 
file renamed from deploy/systemd/conservancy-www-db.service to bin/deploy/systemd/conservancy-www-db.service
bin/deploy/systemd/conservancy-www-linkchecker.service
Show inline comments
 
file renamed from deploy/systemd/conservancy-www-linkchecker.service to bin/deploy/systemd/conservancy-www-linkchecker.service
bin/deploy/systemd/conservancy-www-linkchecker.timer
Show inline comments
 
file renamed from deploy/systemd/conservancy-www-linkchecker.timer to bin/deploy/systemd/conservancy-www-linkchecker.timer
bin/deploy/systemd/conservancy-www-update.service
Show inline comments
 
file renamed from deploy/systemd/conservancy-www-update.service to bin/deploy/systemd/conservancy-www-update.service
bin/deploy/systemd/conservancy-www-update.sh
Show inline comments
 
file renamed from deploy/systemd/conservancy-www-update.sh to bin/deploy/systemd/conservancy-www-update.sh
bin/deploy/systemd/conservancy-www-update.timer
Show inline comments
 
file renamed from deploy/systemd/conservancy-www-update.timer to bin/deploy/systemd/conservancy-www-update.timer
deploy.sh
Show inline comments
 
new file 100755
 
#!/bin/sh
 

	
 
ssh debian@hickory.sfconservancy.org 'bash -s' << EOF
 
set -x  # Show output
 
set -e  # Abort on failure
 
cd /var/www/website
 
sudo -u www-data git pull
 
sudo -u www-data /var/www/venv-website/bin/python manage.py check
 
sudo -u www-data /var/www/venv-website/bin/python manage.py migrate
 
sudo -u www-data /var/www/venv-website/bin/python manage.py collectstatic -v0 --noinput --link
 
sudo systemctl restart apache2
 
curl --silent --head https://sfconservancy.org | grep --perl-regexp "^HTTP/.+ 200"
 
EOF
0 comments (0 inline, 0 general)