def setup():
    # Create postgresql data path
    run("mkdir -p /home/%s/var/lib/postgresql/data" % ssh_user)

    # Create postgres db
    container_fabric().startup('db')

    # Create nginx path
    run("mkdir -p /home/%s/var/nginx/conf" % ssh_user)

    # Upload nginx config
    config_path = os.path.join(os.getcwd(), "files", "nginx.conf")
    put(config_path, "/home/%s/var/nginx/conf/nginx.conf" % ssh_user)
def production():
    """Remote production environment"""
    env.docker = docker_fabric()
    bootstrap_environment('production')
    env.project_path = '/home/{user}/{{cookiecutter.app_name}}'.format(**env)
    env.forward_agent = True
    env.map_client = container_fabric(env.container_map)
    env.run = run
    env.roledefs = {
        'web': ['{user}@{site_url}'.format(**env)],
    }
Beispiel #3
0
def development():
    """Remote staging/development environment"""
    env.docker = docker_fabric()
    bootstrap_environment('development')
    env.project_path = '/home/{user}/jenkins-test'.format(**env)
    env.forward_agent = True
    env.map_client = container_fabric(env.container_map)
    env.run = run
    env.roledefs = {
        'web': ['{user}@{site_url}'.format(**env)],
    }
def deploy():
    """
    Deploy the latest image on remote machine
    """
    # Stop web
    container_fabric().stop('web')

    # Pull latest repro changes
    run("docker pull %s:%s" % (env.WEB_REPOSITORY, env.RELEASE_TAG))

    # Update web
    container_fabric().update('web')

    # Start nginx
    container_fabric().startup('nginx')