Add upgrade, restart-overnight-backups scripts for generic backup app
This commit is contained in:
parent
067c02e965
commit
0b5f6234ad
4 changed files with 46 additions and 17 deletions
rattail_fabric2
|
@ -104,7 +104,7 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
|
|||
# config
|
||||
c.sudo("bash -l -c 'workon {} && cdvirtualenv && rattail make-appdir'".format(envname), user=user)
|
||||
# note, config is owned by root regardless of `user` - since we always run backups as root
|
||||
deploy(c, config, os.path.join(envpath, 'app/rattail.conf'), owner='root', mode='0600', use_sudo=True, context=context)
|
||||
deploy(c, config, os.path.join(envpath, 'app/rattail.conf'), owner='root:{}'.format(user), mode='0640', use_sudo=True, context=context)
|
||||
c.sudo("bash -l -c 'workon {} && cdvirtualenv && bin/rattail -c app/rattail.conf make-config -T quiet -O app/'".format(envname), user=user)
|
||||
c.sudo("bash -l -c 'workon {} && cdvirtualenv && bin/rattail -c app/rattail.conf make-config -T silent -O app/'".format(envname), user=user)
|
||||
|
||||
|
@ -156,6 +156,9 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
|
|||
deploy_generic(c, 'backup/luigi-logging.conf.mako', '{}/app/luigi/luigi-logging.conf'.format(envpath),
|
||||
owner=user, use_sudo=True, context={'envpath': envpath})
|
||||
|
||||
# needed for restarting luigi tasks
|
||||
apt.install(c, 'at')
|
||||
|
||||
# app/luigitasks/overnight.py - should define the OvernightBackups wrapper task
|
||||
path = '{}/luigi-overnight.py'.format(envname)
|
||||
if deploy.local_exists(path):
|
||||
|
@ -169,6 +172,10 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
|
|||
deploy_generic(c, 'backup/overnight-backups.sh.mako', '{}/app/overnight-backups.sh'.format(envpath),
|
||||
owner=user, mode='0755', use_sudo=True, context={'envpath': envpath})
|
||||
|
||||
# app/restart-overnight-backups.sh - generic script to restart OvernightBackups task
|
||||
deploy_generic(c, 'backup/restart-overnight-backups.sh.mako', '{}/app/restart-overnight-backups.sh'.format(envpath),
|
||||
owner=user, mode='0755', use_sudo=True, context={'envpath': envpath})
|
||||
|
||||
# supervisor / luigid
|
||||
apt.install(c, 'supervisor')
|
||||
deploy_generic(c, 'backup/supervisor.conf.mako', '/etc/supervisor/conf.d/backup.conf',
|
||||
|
@ -178,6 +185,11 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
|
|||
c.sudo('supervisorctl update')
|
||||
c.sudo('supervisorctl start backup:')
|
||||
|
||||
# upgrade script
|
||||
if install_rattail:
|
||||
deploy_generic(c, 'backup/upgrade.sh.mako', '{}/app/upgrade.sh'.format(envpath),
|
||||
owner=user, mode='0755', use_sudo=True, context={'envpath': envpath, 'user': user})
|
||||
|
||||
# backup-everything script
|
||||
if install_rattail or everything:
|
||||
everything_context = dict(context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue