Esempio n. 1
0
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()
Esempio n. 2
0
def clean():
    require('hosts', provided_by=[dev, staging, production])
    require('basedir')
    require('virtualenv')

    try:
        webapp.stop()
    except: pass

    try:
        sudo('rm -fr %(basedir)s' % env)
    except: pass
Esempio n. 3
0
def clean():
    require('hosts', provided_by=[dev, staging, production])
    require('basedir')
    require('virtualenv')

    try:
        webapp.stop()
    except:
        pass

    try:
        sudo('rm -fr %(basedir)s' % env)
    except:
        pass
Esempio n. 4
0
def setup():
    require('hosts', provided_by=[dev, staging, production])
    require('webapp_user')
    require('basedir')
    require('virtualenv')

    try:
        webapp.stop()
    except: pass

    prepare()

    setup_postgis()
    setup_db()

    if not exists('/etc/init.d/nginx'):
        nginx.install()
Esempio n. 5
0
def setup():
    require('hosts', provided_by=[dev, staging, production])
    require('webapp_user')
    require('basedir')
    require('virtualenv')

    try:
        webapp.stop()
    except:
        pass

    prepare()

    setup_postgis()
    setup_db()

    if not exists('/etc/init.d/nginx'):
        nginx.install()
Esempio n. 6
0
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()