Esempio n. 1
0
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'])
Esempio n. 2
0
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/')
Esempio n. 3
0
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')
Esempio n. 4
0
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()))
Esempio n. 5
0
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)
Esempio n. 6
0
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()))
Esempio n. 7
0
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')
Esempio n. 8
0
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)
Esempio n. 9
0
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()))
Esempio n. 10
0
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)
Esempio n. 11
0
def download_options():
    rsync(
        '-av',
        '{host_string}:/usr/local/etc/poudriere.d/111amd64-briefkasten-options',
        'roles/poudriere/files/')
Esempio n. 12
0
def upload_packages():
    rsync('-av', '{host_string}:/usr/jails/basejail/poudriere_data/packages/',
          'downloads/packages/')
Esempio n. 13
0
def download_distfiles():
    rsync('-av', '{host_string}:/usr/local/poudriere/distfiles', 'downloads/')
Esempio n. 14
0
def upload_packages():
    rsync('-av', '{host_string}:/usr/jails/basejail/poudriere_data/packages/',
        'downloads/packages/')
Esempio n. 15
0
def download_distfiles():
    rsync('-av', '{host_string}:/usr/local/poudriere/distfiles', 'downloads/')
Esempio n. 16
0
def upload_packages():
    rsync('-av',
        'downloads/packages/',
        '{host_string}:/data/tomster/briefkasten-poudriere/')
Esempio n. 17
0
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'])
Esempio n. 18
0
def download_options():
    rsync('-av', '{host_string}:/usr/local/etc/poudriere.d/111amd64-briefkasten-options', 'roles/poudriere/files/')
Esempio n. 19
0
def upload_packages():
    rsync('-av', 'downloads/packages/',
          '{host_string}:/data/tomster/briefkasten-poudriere/')
Esempio n. 20
0
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/')
Esempio n. 21
0
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/")