From 17ec5c266611b7097c4c4f7ed4ae626c3f0a201b Mon Sep 17 00:00:00 2001 From: crayon <873217631@qq.com> Date: Fri, 10 Sep 2021 15:41:22 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20paas=E9=83=A8=E7=BD=B2=E9=80=82?= =?UTF-8?q?=E9=85=8D(#19)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_desc.yaml | 63 ++++++++++++++++++++++++++++++++++++++++++++++ config/__init__.py | 4 ++- config/default.py | 4 +-- runtime.txt | 2 +- 4 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 app_desc.yaml diff --git a/app_desc.yaml b/app_desc.yaml new file mode 100644 index 0000000..ab033d9 --- /dev/null +++ b/app_desc.yaml @@ -0,0 +1,63 @@ +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版本 + 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 diff --git a/config/__init__.py b/config/__init__.py index 70a8bb4..2756c0a 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -41,7 +41,9 @@ def get_env_or_raise(key): ENVIRONMENT = {"development": "dev", "testing": "stag", "production": "prod"}.get(PAAS_V2_ENVIRONMENT) # SaaS运行版本,如非必要请勿修改 -RUN_VER = os.environ.get("BKPAAS_ENGINE_REGION", "open") +# 暂时避开开发框架的问题,新版PaaS该值设置为default +# 在开发框架中根据该值导入config,config仅提供open可选 +RUN_VER = os.environ.get("ENGINE_REGION", "open") APP_ID = APP_CODE = os.environ.get("APP_ID", "bk_gsekit") APP_TOKEN = SECRET_KEY = os.environ.get("APP_TOKEN", "28b7b410-c7b7-4537-9a65-8ce55738170e") diff --git a/config/default.py b/config/default.py index 13f7ffb..e1c888f 100644 --- a/config/default.py +++ b/config/default.py @@ -209,7 +209,7 @@ # ============================================================================== # IAM # ============================================================================== -BK_IAM_SYSTEM_ID = "bk_gsekit" +BK_IAM_SYSTEM_ID = os.getenv("BK_IAM_SYSTEM_ID", "bk_gsekit") BK_IAM_SYSTEM_NAME = "GSEKIT" BK_IAM_MIGRATION_APP_NAME = "iam" BK_IAM_SKIP = False @@ -217,7 +217,7 @@ 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_RESOURCE_API_HOST = os.getenv("BKAPP_IAM_RESOURCE_API_HOST", f"{BK_PAAS_INNER_HOST}/o/{APP_CODE}/") +BK_IAM_RESOURCE_API_HOST = os.getenv("BK_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") diff --git a/runtime.txt b/runtime.txt index 07261fe..9fbd3bf 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.7.4 \ No newline at end of file +python-3.6.8