예제 #1
0
파일: fabfile.py 프로젝트: Code4SA/pombola
def deploy(db=None, dbuser=None, dbpasswd=None, email_passwd=None,
           version=None, init='yes'):
    """Deploy latest (or a specific version) of the site.

    Deploys a version to the servers, install any required third party
    modules, install the virtual host and then restart the web app server
    """
    require('hosts', provided_by=[dev, staging, production])
    require('basedir')
    require('virtualenv')
    require('webapp_user')
    require('git_branch')

    restart = False

    try:
        webapp.stop()
    except: pass

    if not version:
        #env.version = time.strftime('%Y%m%d%H%M%S')
        env.version = time.strftime('%Y%m%d')

        webapp.upload()
        webapp.install()

        if db and dbuser and dbpasswd:
            configure(db, dbuser, dbpasswd, email_passwd, env.version)

        webapp.configure()

        if init is 'yes':
            webapp.init()

        # ensite nginx.conf -> odekro
        try:
            nginx.dissite('default')
        except: pass

        try:
            nginx.dissite('odekro')
        except: pass

        nginx.ensite('%(basedir)s/releases/%(version)s/conf/nginx.conf' % env,
                     'odekro')

        restart = True
    else:
        #TODO check to see if version exists
        # env.version = version
        # _symlink_current_version()
        pass

    if restart:
        nginx.reload()
        webapp.start()
예제 #2
0
def deploy(version=None, init='yes'):
    """Deploy latest version of the site (or a specific version to be made live)
        
    Deploy a version to the servers, install any required third party 
    modules, install the virtual host and then restart the webserver
    """
    require('hosts', provided_by=[dev, staging, production])
    require('basedir')
    require('webapp_user')
    require('git_branch')

    restart = False

    if not version:
        env.version = time.strftime('%Y%m%d%H%M%S')
        
        # if updating is 'yes':
        #     deactivate_application()
        
        webapp.upload()
        webapp.install()

        if init is 'yes':
            webapp.init()

        # upload gunicorn script
        # upload nginx conf
        # upload supervisord conf

        restart = True
    else:
        #TODO check to see if version exists
        # env.version = version
        # _symlink_current_version()
        pass   

    if restart: 
        nginx.restart()
        supervisor.restart()
예제 #3
0
파일: fabfile.py 프로젝트: teuben/pombola
def deploy(db=None,
           dbuser=None,
           dbpasswd=None,
           email_passwd=None,
           version=None,
           init='yes'):
    """Deploy latest (or a specific version) of the site.

    Deploys a version to the servers, install any required third party
    modules, install the virtual host and then restart the web app server
    """
    require('hosts', provided_by=[dev, staging, production])
    require('basedir')
    require('virtualenv')
    require('webapp_user')
    require('git_branch')

    restart = False

    try:
        webapp.stop()
    except:
        pass

    if not version:
        #env.version = time.strftime('%Y%m%d%H%M%S')
        env.version = time.strftime('%Y%m%d')

        webapp.upload()
        webapp.install()

        if db and dbuser and dbpasswd:
            configure(db, dbuser, dbpasswd, email_passwd, env.version)

        webapp.configure()

        if init is 'yes':
            webapp.init()

        # ensite nginx.conf -> odekro
        try:
            nginx.dissite('default')
        except:
            pass

        try:
            nginx.dissite('odekro')
        except:
            pass

        nginx.ensite('%(basedir)s/releases/%(version)s/conf/nginx.conf' % env,
                     'odekro')

        restart = True
    else:
        #TODO check to see if version exists
        # env.version = version
        # _symlink_current_version()
        pass

    if restart:
        nginx.reload()
        webapp.start()