示例#1
0
文件: build.py 项目: shuiziliu/garage
def resetdb():
    """ this function will reset the entire database with new fixture """
    if not env.hosts:
        print "Error: must use enviroment (e.g fab staging resetdb)"
        exit()
    with cd(env.project_dir):
        virtualenv("python manage.py dba_init_db")
示例#2
0
文件: build.py 项目: shuiziliu/garage
def build_cars_base(arg):
    """ this function will cars into the database randomly based on the number given in the args """
    if not env.hosts:
        print "Error: must use enviroment (e.g fab staging build_cars_base)"
        exit()
    with cd(env.project_dir):
        virtualenv("python manage.py build_cars_base %s" % arg)
示例#3
0
文件: build.py 项目: shuiziliu/garage
def deploy(resetdb=False):
    """ deployment function """
    if not env.hosts:
        print "Error: must use enviroment (e.g fab staging deploy)"
        exit()

    if not exists(env.project_dir):
        print "Error: the project directory does not exists."
        exit()

    # install pip requirements
    now = datetime.datetime.utcnow().strftime("%Y%m%d-%H%M%S")

    with cd(env.project_dir):
        git_pull(env.git_merge_with)
        git_pull(env.git_branch)
        git("merge %s" % env.git_merge_with)
        git("tag %s" % now)
        git("push")
        if exists("garcom/misc/setting_templates/local_env.py"):
            run("rm garcom/misc/setting_templates/local_env.py")

        run(
            "cp %(TEMPLATE_SETTING_DIR)s%(TEMPLATE_SETTING)s garcom/misc/setting_templates/local_env.py"
            % {"TEMPLATE_SETTING_DIR": env.config_template_dir, "TEMPLATE_SETTING": env.template_setting}
        )

        virtualenv("pip install -r requirements.pip ")

        virtualenv("python manage.py syncdb --noinput")

        virtualenv("python manage.py collectstatic --noinput")

    restart_celery()
    restart_uwsgi()
示例#4
0
def restart_celery():
    '''Restart celery daemon'''
    with cd(env.project_dir):
        virtualenv(
            'python manage.py celeryd_multi restart celery -B -E --logfile=%scelery.log --pidfile=%scelery.pid --loglevel=INFO' % (
            env.celery_log_dir, env.celery_log_dir))
示例#5
0
def stop_celery():
    '''Stop celery daemon'''
    with cd(env.project_dir):
        virtualenv('python manage.py celeryd_multi stop celery --pidfile=%scelery.pid' % env.celery_log_dir)
示例#6
0
def stop_celerycam():
    '''Stop celerycam daemon'''
    with cd(env.project_dir):
        virtualenv("kill `ps ax| grep -v awk| awk '/celerycam/{print $1}'`")
示例#7
0
def start_celerycam():
    '''Start celerycam daemon'''
    with cd(env.project_dir):
        virtualenv('python manage.py celerycam --logfile=%scelerycam.log --pidfile=%scelerycam.pid --detach' % (
        env.celery_log_dir, env.celery_log_dir))