def upload_theme(): """ upload and/or update the theme with the current git state""" get_vars() with fab.settings(fab.hide('running')): local_theme_path = path.abspath( path.join(fab.env['config_base'], fab.env.instance.config['local_theme_path'])) rsync('-av', '--delete', local_theme_path, '{host_string}:%s/' % AV['themes_dir'])
def update_frontend(clean=False, build=True, config_path='production.ini', **kwargs): """ upload the frontend to the remote server """ rsync('-av', '--delete', '../frontend/', '{host_string}:/home/halfnarp/frontend/')
def upload_theme(): """ upload and/or update the theme with the current git state""" get_vars() with fab.settings(): local_theme_path = path.abspath( path.join(fab.env['config_base'], fab.env.instance.config['local_theme_path'])) rsync('-av', '--delete', '%s/' % local_theme_path, '{{host_string}}:{themes_dir}/{ploy_theme_name}'.format(**AV)) briefkasten_ctl('restart')
def download_db(cleanup=True): hostname = env.host_string.split("@")[-1] timestamp = datetime.now().strftime("%Y%m%d-%H%M") dump_file_name = "{hostname}-{timestamp}.sql.gz".format(**locals()) remote_dump = "/tmp/{dump_file_name}".format(**locals()) local_dump = "./downloads/{dump_file_name}".format(**locals()) latest_dump = "./downloads/{hostname}-latest.sql.gz".format(**locals()) dumped = fab.sudo("pg_dump -c halfnarp_backend | gzip -c > {remote_dump}".format(**locals()), user="******") if dumped.succeeded: rsync("-av", "{host_string}:%s" % remote_dump, local_dump) fab.run("rm {remote_dump}".format(remote_dump=remote_dump)) fab.local("ln -sf {dump_file_name} {latest_dump}".format(**locals())) print("Downloaded dump available at '{local_dump}'".format(**locals()))
def upload_pgp_keys(): """ upload and/or update the PGP keys for editors, import them into PGP""" # TODO: use env vars instead: appuser = '******' apphome = '/usr/local/briefkasten' with fab.settings(fab.hide('running')): local_key_path = path.join(fab.env['config_base'], fab.env.instance.config['local_pgpkey_path']) remote_key_path = '%s/var/pgp_pubkeys/' % apphome rsync('-av', local_key_path, '{host_string}:%s' % remote_key_path) fab.run('chown -R %s %s' % (appuser, remote_key_path)) with fab.shell_env(GNUPGHOME=remote_key_path): fab.sudo('''gpg --import %s/*.gpg''' % remote_key_path, user=appuser, shell_escape=False)
def download_db(cleanup=True): hostname = env.host_string.split('@')[-1] timestamp = datetime.now().strftime('%Y%m%d-%H%M') dump_file_name = '{hostname}-{timestamp}.sql.gz'.format(**locals()) remote_dump = '/tmp/{dump_file_name}'.format(**locals()) local_dump = './downloads/{dump_file_name}'.format(**locals()) latest_dump = './downloads/{hostname}-latest.sql.gz'.format(**locals()) dumped = fab.sudo('pg_dump -c halfnarp_backend | gzip -c > {remote_dump}'.format(**locals()), user='******') if dumped.succeeded: rsync('-av', '{host_string}:%s' % remote_dump, local_dump) fab.run('rm {remote_dump}'.format(remote_dump=remote_dump)) fab.local('ln -sf {dump_file_name} {latest_dump}'.format(**locals())) print("Downloaded dump available at '{local_dump}'".format(**locals()))
def upload_theme(): """ upload and/or update the theme with the current git state""" get_vars() with fab.settings(): local_theme_path = path.abspath( path.join(fab.env['config_base'], fab.env.instance.config['local_theme_path'])) rsync( '-av', '--delete', '%s/' % local_theme_path, '{{host_string}}:{themes_dir}/{ploy_theme_name}'.format(**AV) ) briefkasten_ctl('restart')
def upload_pgp_keys(): """ upload and/or update the PGP keys for editors, import them into PGP""" get_vars() upload_target = '/tmp/pgp_pubkeys.tmp' with fab.settings(fab.hide('running')): fab.run('rm -rf %s' % upload_target) fab.run('mkdir %s' % upload_target) local_key_path = path.join(fab.env['config_base'], fab.env.instance.config['local_pgpkey_path']) remote_key_path = '/var/briefkasten/pgp_pubkeys/'.format(**AV) rsync('-av', local_key_path, '{host_string}:%s' % upload_target) fab.run('chown -R %s %s' % (AV['appuser'], remote_key_path)) fab.run('chmod 700 %s' % remote_key_path) with fab.shell_env(GNUPGHOME=remote_key_path): fab.sudo('''gpg --import %s/*.*''' % upload_target, user=AV['appuser'], shell_escape=False) fab.run('rm -rf %s' % upload_target)
def download_db(cleanup=True): hostname = env.host_string.split('@')[-1] timestamp = datetime.now().strftime('%Y%m%d-%H%M') dump_file_name = '{hostname}-{timestamp}.sql.gz'.format(**locals()) remote_dump = '/tmp/{dump_file_name}'.format(**locals()) local_dump = './downloads/{dump_file_name}'.format(**locals()) latest_dump = './downloads/{hostname}-latest.sql.gz'.format(**locals()) dumped = fab.sudo( 'pg_dump -c halfnarp_backend | gzip -c > {remote_dump}'.format( **locals()), user='******') if dumped.succeeded: rsync('-av', '{host_string}:%s' % remote_dump, local_dump) fab.run('rm {remote_dump}'.format(remote_dump=remote_dump)) fab.local('ln -sf {dump_file_name} {latest_dump}'.format(**locals())) print("Downloaded dump available at '{local_dump}'".format(**locals()))
def upload_pgp_keys(): """ upload and/or update the PGP keys for editors, import them into PGP""" get_vars() upload_target = '/tmp/pgp_pubkeys.tmp' with fab.settings(fab.hide('running')): fab.run('rm -rf %s' % upload_target) fab.run('mkdir %s' % upload_target) local_key_path = path.join( fab.env['config_base'], fab.env.instance.config['local_pgpkey_path']) remote_key_path = '/var/briefkasten/pgp_pubkeys/'.format(**AV) rsync('-av', local_key_path, '{host_string}:%s' % upload_target) fab.run('chown -R %s %s' % (AV['appuser'], remote_key_path)) fab.run('chmod 700 %s' % remote_key_path) with fab.shell_env(GNUPGHOME=remote_key_path): fab.sudo('''gpg --import %s/*.pgp''' % upload_target, user=AV['appuser'], shell_escape=False) fab.run('rm -rf %s' % upload_target)
def download_options(): rsync( '-av', '{host_string}:/usr/local/etc/poudriere.d/111amd64-briefkasten-options', 'roles/poudriere/files/')
def upload_packages(): rsync('-av', '{host_string}:/usr/jails/basejail/poudriere_data/packages/', 'downloads/packages/')
def download_distfiles(): rsync('-av', '{host_string}:/usr/local/poudriere/distfiles', 'downloads/')
def upload_packages(): rsync('-av', 'downloads/packages/', '{host_string}:/data/tomster/briefkasten-poudriere/')
def upload_theme(): """ upload and/or update the theme with the current git state""" get_vars() with fab.settings(fab.hide('running')): local_theme_path = path.abspath(path.join(fab.env['config_base'], fab.env.instance.config['local_theme_path'])) rsync('-av', '--delete', local_theme_path, '{host_string}:%s/' % AV['themes_dir'])
def download_options(): rsync('-av', '{host_string}:/usr/local/etc/poudriere.d/111amd64-briefkasten-options', 'roles/poudriere/files/')
def update_frontend(clean=False, build=True, config_path="production.ini", **kwargs): """ upload the frontend to the remote server """ rsync("-av", "--delete", "../frontend/", "{host_string}:/home/halfnarp/frontend/")