Ejemplo n.º 1
0
def get_dumps(delete=False, *args, **kwargs):
    delete = fab_arg_to_bool(delete)

    with cd(env.deploy_path):
        colors.blue("Rsyncing local backups with remote")

        rsync_project(local_dir='data/',
                      remote_dir='data/backup',
                      exclude=['.git*', 'cache*', 'filer_*'],
                      delete=delete,
                      upload=False)

    colors.green("Done.")
Ejemplo n.º 2
0
def deploy(upgrade=False, *args, **kwargs):
    start = time.time()

    _print_simple_table('Deployment started')

    upgrade = fab_arg_to_bool(upgrade)

    check()

    with cd(env.deploy_path):
        # Create backup
        # dump_db()

        # Source code
        colors.blue("Pulling from git")
        run('git reset --hard')
        run('git checkout {0}'.format(env.source_branch))
        run('git pull --no-edit origin {0}'.format(env.source_branch))

        # Dependencies
        npm(upgrade)

        # Dependencies
        colors.blue("Installing bower dependencies")

        with settings(warn_only=True):  # Bower may not be installed
            run('bower prune --config.interactive=false')  # Uninstalls local extraneous packages.
            run('bower %s --config.interactive=false' % ('update' if upgrade else 'install'))

        gulp()

        colors.blue("Installing pip dependencies")
        venv_run('pip install --no-input --exists-action=i -r requirements/production.txt --use-wheel %s' % ('--upgrade' if upgrade  else ''))

        # Django tasks
        colors.blue("Running Django commands")
        venv_run('python src/manage.py collectstatic --noinput')
        venv_run('python src/manage.py migrate')
        venv_run('python src/manage.py compress')

        clean()

        venv_run('python src/manage.py compilemessages')

    graceful_restart() if env.graceful_restart else restart()

    status()
    check_urls()

    total_time_msg = "Deployed :)\nTotal time: {0} seconds.".format(time.time() - start)
    _print_simple_table(total_time_msg)