Skip to content

Commit

Permalink
feature: PaaS 部署适配(#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuoZhuoCrayon committed Sep 14, 2021
1 parent 343e87f commit 38a2a61
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 6 deletions.
69 changes: 69 additions & 0 deletions app_desc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
spec_version: 2
app_version: "{{APP_VERSION}}"
app:
region: default
bk_app_code: "bk_gsekit"
bk_app_name: 进程配置管理
market:
category: 运维工具
introduction: 进程配置管理
display_options:
width: 1300
height: 720
is_win_maximize: True
open_mode: "new_tab"
modules:
default:
is_default: True
source_dir: src
language: Python
services:
- name: mysql
- name: redis
- name: rabbitmq
env_variables:
- key: ENGINE_REGION
value: "open"
description: 暂时避开开发框架的问题,新版PaaS该值设置为default
- key: PIP_VERSION
value: "20.2.3"
description: 固化pip版本

svc_discovery:
bk_saas:
- bk_app_code: "bk_iam"
- bk_app_code: "bk_gsekit"

processes:
web:
command: gunicorn --timeout 600 --max-requests 100 --max-requests-jitter 10 wsgi -w 8 -b :5000 --access-logfile - --error-logfile - --access-logformat '[%(h)s] %({request_id}i)s %(u)s %(t)s "%(r)s" %(s)s %(D)s %(b)s "%(f)s" "%(a)s"'
plan: 4C2G5R
replicas: 5
dworker:
command: celery -A blueapps.core.celery worker -Q default -n default@%h -c 5 -l info --maxtasksperchild=50
plan: 4C2G5R
replicas: 5
pworker:
command: celery -A blueapps.core.celery worker -Q pipeline,pipeline_priority -n pipeline_worker@%h -c 5 -l info --maxtasksperchild=50
plan: 4C2G5R
replicas: 5
sworker:
command: celery -A blueapps.core.celery worker -A blueapps.core.celery -Q service_schedule,service_schedule_priority -c 5 -l info -n schedule_worker@%h --maxtasksperchild=50
plan: 4C2G5R
replicas: 5
cworker:
command: celery -A blueapps.core.celery worker -Q pipeline_additional_task,pipeline_additional_task_priority -n common_worker@%h -c 5 -l info --maxtasksperchild=50
plan: 4C2G5R
replicas: 5
erworker:
command: celery -A blueapps.core.celery worker -Q er_execute,er_schedule -n ri_worker@%h -l info -c 10 -l info --maxtasksperchild=50
plan: 4C2G5R
replicas: 5
beat:
command: celery -A blueapps.core.celery beat -l info
plan: 4C2G5R
replicas: 1
pwatch:
command: python manage.py watch_process
plan: 4C2G5R
replicas: 1
2 changes: 1 addition & 1 deletion apps/api/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

ESB_PREFIX = "/api/c/compapi/v2/"

APIGATEWAY_ROOT_PREFIX_FORMAT = "{}{}{{}}/".format(settings.BK_PAAS_INNER_HOST, ESB_PREFIX)
APIGATEWAY_ROOT_PREFIX_FORMAT = "{}{}{{}}/".format(settings.BK_COMPONENT_API_URL, ESB_PREFIX)

CC_APIGATEWAY_ROOT = os.getenv("BKAPP_CC_APIGATEWAY_ROOT") or APIGATEWAY_ROOT_PREFIX_FORMAT.format("cc")
JOB_APIGATEWAY_ROOT_V3 = os.getenv("BKAPP_JOB_APIGATEWAY_ROOT") or APIGATEWAY_ROOT_PREFIX_FORMAT.format("jobv3")
Expand Down
10 changes: 5 additions & 5 deletions config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@
# ===============================================================================
BK_PAAS_HOST = os.environ.get("BK_PAAS_HOST", "")
BK_PAAS_INNER_HOST = os.environ.get("BK_PAAS_INNER_HOST", BK_PAAS_HOST)
BK_COMPONENT_API_URL = os.getenv("BK_COMPONENT_API_URL") or BK_PAAS_INNER_HOST

BK_CC_HOST = os.environ.get("BK_CC_HOST", BK_PAAS_HOST.replace("paas", "cmdb"))
BK_SAAS_HOST = os.environ.get("BK_SAAS_HOST", f"{BK_PAAS_HOST}/o/{APP_CODE}/")

Expand All @@ -209,18 +211,16 @@
# ==============================================================================
# IAM
# ==============================================================================
BK_IAM_SYSTEM_ID = "bk_gsekit"
BK_IAM_SKIP = False
BK_IAM_SYSTEM_NAME = "GSEKIT"
BK_IAM_MIGRATION_APP_NAME = "iam"
BK_IAM_SKIP = False

BK_IAM_INNER_HOST = os.getenv("BK_IAM_V3_INNER_HOST", "http://bkiam.service.consul")

# BK_IAM_RESOURCE_API_HOST = os.getenv("BKAPP_IAM_RESOURCE_API_HOST", f"{BK_PAAS_HOST}/o/{APP_CODE}/")
BK_IAM_SYSTEM_ID = os.getenv("BKAPP_IAM_SYSTEM_ID", "bk_gsekit")
BK_IAM_RESOURCE_API_HOST = os.getenv("BKAPP_IAM_RESOURCE_API_HOST", f"{BK_PAAS_INNER_HOST}/o/{APP_CODE}/")

# 权限中心 SaaS host
BK_IAM_APP_CODE = os.getenv("BK_IAM_V3_APP_CODE", "bk_iam")
BK_IAM_INNER_HOST = os.getenv("BK_IAM_V3_INNER_HOST", "http://bkiam.service.consul")
BK_IAM_SAAS_HOST = os.environ.get("BK_IAM_V3_SAAS_HOST", f"{BK_PAAS_HOST}/o/{BK_IAM_APP_CODE}/")

# TAM
Expand Down

0 comments on commit 38a2a61

Please sign in to comment.