示例#1
0
文件: web.py 项目: TeamNext/EmpressX
def delete_config(target):
    app_info, uuid = target
    app_name = app_info['app_name']

    conf_home = settings.RETINUE_NGINX_UPSTREAM_HOME
    localcommand("rm -f %(conf_home)s/%(app_name)s.conf" % locals())
    return target
示例#2
0
文件: web.py 项目: TeamNext/EmpressX
def _reload_nginx():
    last_reload_request = cache.get('web_nginx_last_reload_request')
    now = time.mktime(timezone.now().timetuple())
    if not last_reload_request or now - last_reload_request >= 5:
        nginx_path = settings.ROUTER_NGINX_PATH
        conf = settings.ROUTER_NGINX_CONF if settings.ROUTER_NGINX_CONF else 'conf/nginx.conf'
        localcommand("%(nginx_path)s -s reload -c %(conf)s" % locals())
示例#3
0
文件: app.py 项目: TeamNext/EmpressX
def delete_uwsgi_config(target):
    app_info, uuid = target
    app_name = app_info['app_name']

    conf_home = settings.RETINUE_VASSAL_HOME
    localcommand("rm -f %(conf_home)s/%(app_name)s.ini" % locals())
    return target
示例#4
0
文件: app.py 项目: TeamNext/EmpressX
def delete_nginx_config(target):
    app_info, uuid = target
    app_name = app_info['app_name']

    conf_home = settings.RETINUE_NGINX_STATICFILE_HOME
    localcommand("rm -f %(conf_home)s/%(app_name)s.ini" % locals())
    return target
示例#5
0
文件: app.py 项目: TeamNext/EmpressX
def pull_source_code(target):
    app_info, uuid = target
    app_name = app_info['app_name']

    project_home = '%s/%s' % (settings.RETINUE_APP_HOME, app_name)

    vcs_type = app_info.get('vcs', {}).get('type')
    vcs_path = app_info.get('vcs', {}).get('path')
    vcs_username = app_info.get('vcs', {}).get('username')
    vcs_password = app_info.get('vcs', {}).get('password')

    cmd = """
export LC_CTYPE=zh_CN.utf8

if [ -d %(project_home)s/.svn ]
then
    cd %(project_home)s
    svn cleanup --non-interactive --username=%(vcs_username)s --password=%(vcs_password)s
    svn update --non-interactive --username=%(vcs_username)s --password=%(vcs_password)s
else
    cd %(project_home)s
    svn checkout %(vcs_path)s/ . --non-interactive --no-auth-cache --username=%(vcs_username)s --password=%(vcs_password)s
fi

if [ "${DJANGO_CONF_MODULE}" = "conf.testing" ]
then
    fp_root_dir="/data/BKTest_App_FilePool"
elif [ "${DJANGO_CONF_MODULE}" = "conf.production" ]
then
    fp_root_dir="/data/BK_App_FilePool"
fi

if [ ! -z "${fp_root_dir}" -a -d ${fp_root_dir} ]
then
    fpdir="${fp_root_dir}/%(app_name)s"
    [ -d ${fpdir} ] || install -d ${fpdir} -m 1777
    if [ $? -eq 0 ]
    then
        cd %(project_home)s
        [ -L USERRES ] || ln -s ${fpdir} USERRES
    fi
fi
    """ % locals()

    print cmd

    localcommand(cmd)

    return target