Exemplo n.º 1
0
def go_setup(stage="development"):
    """
	Install the correct services on each machine
	
    $ fab -i deploy/[your private SSH key here] set_hosts go_setup
	"""
    stage_exists(stage)
    PROVIDER = get_provider_dict()

    # Determine if a master/slave relationship exists for databases in config
    slave = []
    for db in ['mysql', 'postgresql', 'postgresql-client']:
        slave.append(
            any([
                'slave'
                in PROVIDER['machines'][stage][name].get('services',
                                                         {}).get(db, {})
                for name in PROVIDER['machines'][stage]
            ]))
    replication = any(slave)

    # Begin installing and setting up services
    for name in PROVIDER['machines'][stage]:
        node_dict = PROVIDER['machines'][stage][name]
        host = node_dict['public_ip'][0]
        if host == fabric.api.env.host:
            set_hostname(name)
            prepare_server()
            for service in node_dict['services'].keys():
                settings = node_dict['services'][service]
                if service == 'nginx':
                    nginx_install()
                    nginx_setup(stage=stage)
                elif service == 'redis':
                    redis_install()
                    redis_setup()
                elif service == 'uwsgi':
                    uwsgi_install()
                    uwsgi_setup(stage=stage)
                elif service == 'mysql':
                    mysql_install()
                    mysql_setup(stage=stage,
                                replication=replication,
                                **settings)
                elif service == 'postgresql':
                    postgresql_install(name,
                                       node_dict,
                                       stage=stage,
                                       **settings)
                    postgresql_setup(name, node_dict, stage=stage, **settings)
                elif service == 'postgresql-client':
                    postgresql_client_install()
                elif service in ['apache']:
                    fabric.api.warn(
                        fabric.colors.yellow("%s is not yet available" %
                                             service))
                else:
                    fabric.api.warn('%s is not an available service' % service)
Exemplo n.º 2
0
def go_setup(stage="development"):
    """
    Install the correct services on each machine

    $ fab -i deploy/[your private SSH key here] set_hosts go_setup
    """
    stage_exists(stage)
    PROVIDER = get_provider_dict()

    # Determine if a master/slave relationship exists for databases in config
    slave = []
    for db in ['mysql', 'postgresql', 'postgresql-client']:
        slave.append(
            any(['slave' in PROVIDER['machines'][stage][name].get(
                'services', {}).get(
                    db, {}) for name in PROVIDER['machines'][stage]]))
    replication = any(slave)

    # Begin installing and setting up services
    for name in PROVIDER['machines'][stage]:
        instance_dict = PROVIDER['machines'][stage][name]
        host = instance_dict['public_ip'][0]
        if host == fabric.api.env.host:
            set_hostname(name)
            prepare_server()
            for service in instance_dict['services'].keys():
                settings = instance_dict['services'][service]
                if service == 'nginx':
                    nginx_install()
                    nginx_setup(stage=stage)
                elif service == 'redis':
                    redis_install()
                    redis_setup()
                elif service == 'nodejs':
                    nodejs_install()
                    nodejs_setup()
                elif service == 'uwsgi':
                    uwsgi_install()
                    uwsgi_setup(stage=stage)
                elif service == 'mysql':
                    mysql_install()
                    mysql_setup(stage=stage, replication=replication, **settings)
                elif service == 'postgresql':
                    postgresql_install(name, instance_dict, stage=stage, **settings)
                    postgresql_setup(name, instance_dict, stage=stage, **settings)
                elif service == 'postgresql-client':
                    postgresql_client_install()
                elif service in ['apache']:
                    fabric.api.warn(fabric.colors.yellow("%s is not yet available" % service))
                else:
                    fabric.api.warn('%s is not an available service' % service)
Exemplo n.º 3
0
def go_deploy(stage="development", tagname="trunk"):
	"""
	Deploy project and make active on any machine with server software
	
    $ fab -i deploy/[your private SSH key here] set_hosts go_deploy
	"""
	stage_exists(stage)
	PROVIDER = get_provider_dict()
	for name in PROVIDER['machines'][stage]:
		node_dict = PROVIDER['machines'][stage][name]
		host = node_dict['public_ip'][0]

		if host == fabric.api.env.host:
			service = node_dict['services']
			# If any of these services are listed then deploy the project
			if list(set(['nginx','uwsgi','apache']) & set(node_dict['services'])):
				deploy_full(tagname,force=True)
Exemplo n.º 4
0
def go_deploy(stage="development", tagname="trunk"):
    """
	Deploy project and make active on any machine with server software
	
    $ fab -i deploy/[your private SSH key here] set_hosts go_deploy
	"""
    stage_exists(stage)
    PROVIDER = get_provider_dict()
    for name in PROVIDER['machines'][stage]:
        node_dict = PROVIDER['machines'][stage][name]
        host = node_dict['public_ip'][0]

        if host == fabric.api.env.host:
            service = node_dict['services']
            # If any of these services are listed then deploy the project
            if list(
                    set(['nginx', 'uwsgi', 'apache'])
                    & set(node_dict['services'])):
                deploy_full(tagname, force=True)