Пример #1
0
def virtualenv():
    """Intializes the virtual env"""

    virtualenv_dir = os.path.join(env.config.ApiServer.document_root, "env")

    if files.exists(virtualenv_dir):
        print "The virtualenv directory already exists at %s." % virtualenv_dir
        query = "Do you want to delete it and reinitialize it?"
        if prompt(query):
            run("rm -rf %s" % virtualenv_dir)
        else:
            return

    with cd(env.config.ApiServer.document_root):
        run("virtualenv env")

        if files.exists("/usr/lib/x86_64-linux-gnu/libfreetype.so"):
            run("ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so `pwd`/env/lib/"
                )
            run("ln -s /usr/lib/x86_64-linux-gnu/libz.so `pwd`/env/lib/")
            run("ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so `pwd`/env/lib/")
        else:
            run("ln -s /usr/lib/i386-linux-gnu/libfreetype.so `pwd`/env/lib/")
            run("ln -s /usr/lib/i386-linux-gnu/libz.so `pwd`/env/lib/")
            run("ln -s /usr/lib/i386-linux-gnu/libjpeg.so `pwd`/env/lib/")

    pip_requirements()
Пример #2
0
def update():
    """Updates the project server code and executes migrations."""
    with settings(warn_only=True):
        if env.host == 'prod':
            if not confirm("Are you sure you want to deploy code to Production?", default=False):
               sys.exit(1)
            
            result = backup_db()

            if not result:
                msg = "Could not backup db. Continue?"
                if not prompt(msg):
                    print "Aborting..."
                    sys.exit(1)
                    
    with cd(env.config.ApiServer.document_root):
        run("git fetch origin")
        run("git checkout %s" % env.config.branch)
        run("git pull origin %s" % env.config.branch)
        run("./env/bin/pip install --requirement ./scripts/requirements.pip")
        configure_api()
        compile_static()

    sudo("/etc/init.d/celeryd restart")
    sudo("/etc/init.d/memcached restart")
    sudo("supervisorctl stop klooff")
    sudo("supervisorctl start klooff")
Пример #3
0
def update():
    """Updates the project server code and executes migrations."""
    with settings(warn_only=True):
        if env.host == 'prod':
            if not confirm(
                    "Are you sure you want to deploy code to Production?",
                    default=False):
                sys.exit(1)

            result = backup_db()

            if not result:
                msg = "Could not backup db. Continue?"
                if not prompt(msg):
                    print "Aborting..."
                    sys.exit(1)

    with cd(env.config.ApiServer.document_root):
        run("git fetch origin")
        run("git checkout %s" % env.config.branch)
        run("git pull origin %s" % env.config.branch)
        run("./env/bin/pip install --requirement ./scripts/requirements.pip")
        configure_api()
        compile_static()

    sudo("/etc/init.d/celeryd restart")
    sudo("/etc/init.d/memcached restart")
    sudo("supervisorctl stop klooff")
    sudo("supervisorctl start klooff")
Пример #4
0
def virtualenv():
    """Intializes the virtual env"""

    virtualenv_dir = os.path.join(env.config.ApiServer.document_root, "env")

    if files.exists(virtualenv_dir):
        print "The virtualenv directory already exists at %s." % virtualenv_dir
        query = "Do you want to delete it and reinitialize it?"
        if prompt(query):
            run("rm -rf %s" % virtualenv_dir)
        else:
            return

    with cd(env.config.ApiServer.document_root):
        run("virtualenv env")

        if files.exists("/usr/lib/x86_64-linux-gnu/libfreetype.so"):
            run("ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so `pwd`/env/lib/")
            run("ln -s /usr/lib/x86_64-linux-gnu/libz.so `pwd`/env/lib/")
            run("ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so `pwd`/env/lib/")
        else:
            run("ln -s /usr/lib/i386-linux-gnu/libfreetype.so `pwd`/env/lib/")
            run("ln -s /usr/lib/i386-linux-gnu/libz.so `pwd`/env/lib/")
            run("ln -s /usr/lib/i386-linux-gnu/libjpeg.so `pwd`/env/lib/")

    pip_requirements()
Пример #5
0
def api():
    """Setups a project database using django on the remote server."""
    wsgi_file = os.path.join(env.config.ApiServer.document_root, "django.wsgi")
    repo = "[email protected]:klooff/klooff-server.git"

    if not files.exists(wsgi_file):
        print "Can't file the project code at %s." % env.config.ApiServer.document_root
        query = "Do you want to clone it from github?"
        if prompt(query):
            git.clone(repo, env.config.ApiServer.document_root, env.config.branch)
            run("chmod 777 %s" % os.path.join(env.config.ApiServer.document_root, "media", "user_uploads"))
        else:
            print "Aborting."
            sys.exit(1)

    virtualenv()
    project.configure_api()
Пример #6
0
def api():
    """Setups a project database using django on the remote server."""
    wsgi_file = os.path.join(env.config.ApiServer.document_root, "django.wsgi")
    repo = "[email protected]:klooff/klooff-server.git"

    if not files.exists(wsgi_file):
        print "Can't file the project code at %s." % env.config.ApiServer.document_root
        query = "Do you want to clone it from github?"
        if prompt(query):
            git.clone(repo, env.config.ApiServer.document_root,
                      env.config.branch)
            run("chmod 777 %s" % os.path.join(
                env.config.ApiServer.document_root, "media", "user_uploads"))
        else:
            print "Aborting."
            sys.exit(1)

    virtualenv()
    project.configure_api()
Пример #7
0
    def StaticServer__use_ssl(self):
        query = "Use SSL for Static?"

        return prompt(query, default=True)
Пример #8
0
    def ApiServer__use_ssl(self):
        query = "Use SSL for Api?"

        return prompt(query, default=True)
Пример #9
0
    def StaticServer__use_ssl(self):
        query = "Use SSL for Static?"

        return prompt(query, default=True)
Пример #10
0
    def ApiServer__use_ssl(self):
        query = "Use SSL for Api?"

        return prompt(query, default=True)