from fabric.api import env

env.client = 'zsoobhan'
env.project_code = 'prometheus'

env.web_dir = 'www'

# Environment-agnostic folders
env.project_dir = '/var/www/%(client)s/%(project_code)s' % env
env.static_dir = '/mnt/static/%(client)s/%(project_code)s' % env
env.builds_dir = '%(project_dir)s/builds' % env


def _configure(build_name):
    env.build = build_name
    env.virtualenv = '%(project_dir)s/virtualenvs/%(build)s/' % env
    env.data_dir = '%(project_dir)s/data/%(build)s/' % env
    env.nginx_conf = 'www/deploy/nginx/%(build)s.conf' % env
    env.supervisord_conf = 'www/deploy/supervisord/%(build)s.conf' % env
    env.wsgi = 'deploy/wsgi/%(build)s.wsgi' % env
    env.webserver_user = 'www-data'


def prod():
    _configure('prod')
    env.hosts = ['ec2-54-77-186-157.eu-west-1.compute.amazonaws.com']
    env.remote_user = 'ubuntu'


def test():
    _configure('test')
    env.remote_user = 'ubuntu'

from fabric.api import env

env.client = 'zsoobhan'
env.project_code = 'prometheus'

env.web_dir = 'www'

# Environment-agnostic folders
env.project_dir = '/var/www/%(client)s/%(project_code)s' % env
env.static_dir = '/mnt/static/%(client)s/%(project_code)s' % env
env.builds_dir = '%(project_dir)s/builds' % env


def _configure(build_name):
    env.build = build_name
    env.virtualenv = '%(project_dir)s/virtualenvs/%(build)s/' % env
    env.data_dir = '%(project_dir)s/data/%(build)s/' % env
    env.nginx_conf = 'www/deploy/nginx/%(build)s.conf' % env
    env.supervisord_conf = 'www/deploy/supervisord/%(build)s.conf' % env
    env.wsgi = 'deploy/wsgi/%(build)s.wsgi' % env
    env.webserver_user = 'www-data'


def prod():
    _configure('prod')
    env.hosts = ['ec2-54-154-143-128.eu-west-1.compute.amazonaws.com']
    env.remote_user = 'ubuntu'


def test():
    _configure('test')
    env.remote_user = 'ubuntu'

Switch to new ec2 instance
Switch to new ec2 instance
