Allow specifying python binary for common backup app environment

also be sure to upgrade setuptools, wheel for it.  this is needed esp. when
deploying to older machines e.g. debian 8
This commit is contained in:
Lance Edgar 2020-09-29 17:59:31 -05:00
parent c67cc74d3d
commit d744257af6

View file

@ -53,6 +53,7 @@ def deploy_backup_everything(c, **context):
def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
python_exe='/usr/bin/python3',
install_borg=False,
link_borg_to_bin=True,
install_luigi=False,
@ -86,12 +87,14 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail',
c.sudo('supervisorctl stop backup:')
# virtualenv
if mkvirtualenv:
python.mkvirtualenv(c, envname, python='/usr/bin/python3', runas_user=user)
envpath = '/srv/envs/{}'.format(envname)
if mkvirtualenv and not exists(c, envpath):
python.mkvirtualenv(c, envname, python=python_exe, runas_user=user)
# TODO: this should not be necessary, right?
c.sudo('chown -R {}: {}'.format(user, envpath))
mkdir(c, os.path.join(envpath, 'src'), use_sudo=True, runas_user=user)
c.sudo("bash -l -c 'workon {} && pip install --upgrade pip'".format(envname), user=user)
c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install -U pip setuptools wheel'".format(envpath),
user=user)
if install_rattail: