Skip to content

Files

Latest commit

 

History

History
69 lines (54 loc) · 3.47 KB

readme.md

File metadata and controls

69 lines (54 loc) · 3.47 KB

Blueapps BkResource Pedestal

(English Documents Available)

一、环境依赖

  1. 环境依赖: python 3.6、MySQL 5.7+、Redis 3.2

  2. PIP源

    [global]
    index-url=https://mirrors.tencent.com/repository/pypi/tencent_pypi/simple
    extra-index-url=http://mirrors.cloud.tencent.com/pypi/simple/
    trusted-host = mirrors.tencent.com, mirrors.cloud.tencent.com
    
  3. PIP版本

    PIP 版本需要满足 pip==20.2.3,在 Paas 中增加环境变量 PIP_VERSION=20.2.3 声明,本地可以使用 pip install --upgrade pip==20.2.3 安装指定版本

二、快速开始

1. 申请蓝鲸APP

  • 申请git仓库
  • 创建蓝鲸APP,获取app_id、app_secret

2. 通过Cookiecutter快速生成Blueapps Restful项目

  • 参考 README - Installation

  • 提交代码

    cd {app_id}
    git init
    git add .
    git commit -m "minor: init repo"
    git remote add origin {git_url}
    git push -u origin master
    

3. 根据README.md 部署开发环境

三、BkResource Framework with 12 Factor

  1. Codebase - One codebase tracked in revision control, many deploys
    Manage project code and version easily with Git repository, all services of project can be stored in one repo
  2. Dependencies - Explicitly declare and isolate dependencies
    Declare dependencies in requirements.txt and manage them with PIP
  3. Config - Store config in the environment
    All variable configs are loaded from environment for safe and reusable, .env file is also helpful for deploying and migrating services
  4. Backing services - Treat backing services as attached resources
    Using Django ORM or Django Cache Client, MySQL, Redis or other backing services are attached resources
  5. Build, release, run - Strictly separate build and run stages
    Running stages are seperated by Blueking PaaS, which provides two environment, staging and prodcution, the PaaS build service first and the deploy it on BCS
  6. Processes - Execute the app as one or more stateless processes
    Service is stateless with DRF, receives request and then sends response, all data a response needs comes from database or request
  7. Port binding - Export services via port binding
    Binding a port is necessary to run service
  8. Concurrency - Scale out via the process model
    Using Gunicorn for HTTP request and Celery for backend service, both of them support concurrency
  9. Disposability - Maximize robustness with fast startup and graceful shutdown
    Services start and shutdown fast, and when deploying on Blueking PaaS, it's undetectable when rollup
  10. Dev/prod parity - Keep development, staging, and production as similar as possible
    Blueking PaaS provides almost the same running environment for staging and production
  11. Logs - Treat logs as event streams
    All logs is collected to BkLog while using Blueking PaaS
  12. Admin processes - Run admin/management tasks as one-off processes
    Django's manage commands are all running as one-off processes, run and then exit