Port logic for deploying a "backup" app

This commit is contained in:
Lance Edgar 2019-01-06 14:14:47 -06:00
parent c2fe7586da
commit bd4768839a
7 changed files with 196 additions and 0 deletions

View file

@ -0,0 +1,34 @@
#!/bin/sh -e
if [ "$1" = "-v" -o "$1" = "--verbose" ]; then
VERBOSE='--verbose'
QUIET=
PROGRESS='--progress'
CONFIG='/srv/envs/${envname}/app/rattail.conf'
else
VERBOSE=
QUIET='--quiet'
PROGRESS=
CONFIG='/srv/envs/${envname}/app/silent.conf'
fi
RATTAIL="/srv/envs/${envname}/bin/rattail --config=$CONFIG $PROGRESS $VERBOSE"
PIP="sudo -u ${user} PIP_CONFIG_FILE=/srv/envs/${envname}/pip.conf /srv/envs/${envname}/bin/pip"
# upgrade pip
$PIP install $QUIET --upgrade pip
# upgrade rattail
cd /srv/envs/${envname}/src/rattail
if [ "$(sudo -u ${user} git status --porcelain)" != '' ]; then
sudo -u ${user} git status
exit 1
fi
sudo -u ${user} git pull $QUIET
sudo -u ${user} find . -name '*.pyc' -delete
$PIP install $QUIET --upgrade --upgrade-strategy eager --editable .
# run backup
cd /srv/envs/${envname}
$RATTAIL backup

View file

@ -0,0 +1,4 @@
# -*- mode: conf; -*-
# backup everything of importance at ${pretty_time}
${'' if env.machine_is_live else '# '}${cron_time} * * * root /usr/local/bin/backup-everything

View file

@ -0,0 +1 @@
**/__pycache__/