微服务开发框架部署

在此之前,应该准备好Mysql、Harbor、Gitlab、Minio,Chartmuseum这些组件的信息。按以下搭建顺序进行搭建,请不要随意调整搭建顺序。 以下验证部署是否成功如未特别说明则执行验证的环境为任意一台集群Master节点。

  • 如果您的主机性能或网络较差,建议您添加额外的参数以延长超时时间 --set preJob.timeout=1000 ,其中1000表示1000秒后超时。

部署成功后Choerodon平台默认登录名为admin,默认密码为Admin@123!。

添加Choerodon Chart仓库

  1. helm repo add c7n https://openchart.choerodon.com.cn/choerodon/c7n/
  2. helm repo update

创建数据库

  • 编写参数配置文件 create-c7nfw-db.yaml

    1. env:
    2. MYSQL_HOST: c7n-mysql.c7n-system.svc
    3. MYSQL_PORT: "3306"
    4. MYSQL_USER: root
    5. MYSQL_PASS: password
    6. SQL_SCRIPT: |
    7. CREATE USER IF NOT EXISTS 'choerodon'@'%' IDENTIFIED BY 'password';
    8. CREATE DATABASE IF NOT EXISTS hzero_platform DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    9. CREATE DATABASE IF NOT EXISTS hzero_message DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    10. CREATE DATABASE IF NOT EXISTS hzero_file DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    11. CREATE DATABASE IF NOT EXISTS hzero_monitor DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    12. CREATE DATABASE IF NOT EXISTS hzero_admin DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    13. CREATE DATABASE IF NOT EXISTS asgard_service DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    14. GRANT ALL PRIVILEGES ON hzero_platform.* TO choerodon@'%';
    15. GRANT ALL PRIVILEGES ON hzero_message.* TO choerodon@'%';
    16. GRANT ALL PRIVILEGES ON hzero_file.* TO choerodon@'%';
    17. GRANT ALL PRIVILEGES ON hzero_monitor.* TO choerodon@'%';
    18. GRANT ALL PRIVILEGES ON hzero_admin.* TO choerodon@'%';
    19. GRANT ALL PRIVILEGES ON asgard_service.* TO choerodon@'%';
    20. FLUSH PRIVILEGES;
  • 执行安装

    1. helm upgrade --install create-c7nfw-db c7n/mysql-client \
    2. -f create-c7nfw-db.yaml \
    3. --create-namespace \
    4. --version 0.1.0 \
    5. --namespace c7n-system

部署 choerodo register

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-register

  • 编写参数配置文件 choerodon-register.yaml

    1. env:
    2. open:
    3. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
  • 执行安装

    1. helm upgrade --install choerodon-register c7n/choerodon-register \
    2. -f choerodon-register.yaml \
    3. --create-namespace \
    4. --version 0.23.1 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get svc choerodon-register -o jsonpath="{.spec.clusterIP}" -n c7n-system):8001/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon platform

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-platform

  • 编写参数配置文件 choerodon-platform.yaml

    1. preJob:
    2. preInitDB:
    3. datasource:
    4. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    5. username: choerodon
    6. password: password
    7. driver: com.mysql.jdbc.Driver
    8. env:
    9. open:
    10. HZERO_PLATFORM_HTTP_PROTOCOL: http
    11. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    12. SPRING_REDIS_HOST: c7n-redis.c7n-system
    13. SPRING_REDIS_PORT: 6379
    14. # 此db不可更改
    15. SPRING_REDIS_DATABASE: 1
    16. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_platform?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    17. SPRING_DATASOURCE_USERNAME: choerodon
    18. SPRING_DATASOURCE_PASSWORD: password
    19. HZERO_EXPORT_COREPOOLSIZE: 1
  • 部署服务

    1. helm upgrade --install choerodon-platform c7n/choerodon-platform \
    2. -f choerodon-platform.yaml \
    3. --create-namespace \
    4. --version 0.23.4 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-platform -o jsonpath="{.items[0].status.podIP}"):8101/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon admin

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-admin

  • 编写参数配置文件 choerodon-admin.yaml

    1. preJob:
    2. preInitDB:
    3. datasource:
    4. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    5. username: choerodon
    6. password: password
    7. env:
    8. open:
    9. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    10. HZERO_AUTO_REFRESH_SWAGGER_ENABLE: true
    11. SPRING_REDIS_HOST: c7n-redis.c7n-system
    12. SPRING_REDIS_PORT: 6379
    13. # 此db不可更改
    14. SPRING_REDIS_DATABASE: 1
    15. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_admin?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    16. SPRING_DATASOURCE_USERNAME: choerodon
    17. SPRING_DATASOURCE_PASSWORD: password
  • 部署服务

    1. helm upgrade --install choerodon-admin c7n/choerodon-admin \
    2. -f choerodon-admin.yaml \
    3. --create-namespace \
    4. --version 0.23.1 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
    1. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-admin -o jsonpath="{.items[0].status.podIP}"):8063/actuator/health | jq -r .status
    • 出现以下类似信息即为成功部署
  1. ```
  2. UP
  3. ```

部署 choerodon iam

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-iam

  • 编写参数配置文件 choerodon-iam.yaml

    1. preJob:
    2. preInitDB:
    3. datasource:
    4. url: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    5. username: choerodon
    6. password: password
    7. driver: com.mysql.jdbc.Driver
    8. env:
    9. open:
    10. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    11. CHOERODON_GATEWAY_URL: http://api.example.choerodon.io
    12. SPRING_REDIS_HOST: c7n-redis.c7n-system.svc
    13. SPRING_REDIS_PORT: 6379
    14. # 此db不可更改
    15. SPRING_REDIS_DATABASE: 1
    16. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_platform?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    17. SPRING_DATASOURCE_USERNAME: choerodon
    18. SPRING_DATASOURCE_PASSWORD: password
    19. HZERO_EXPORT_COREPOOLSIZE: 1
  • 部署服务

    1. helm upgrade --install choerodon-iam c7n/choerodon-iam \
    2. -f choerodon-iam.yaml \
    3. --create-namespace \
    4. --version 0.23.6 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-iam -o jsonpath="{.items[0].status.podIP}"):8031/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon asgard

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-asgard

  • 编写参数配置文件 choerodon-asgard.yaml

    1. preJob:
    2. preInitDB:
    3. datasource:
    4. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    5. username: choerodon
    6. password: password
    7. driver: com.mysql.jdbc.Driver
    8. env:
    9. open:
    10. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    11. SPRING_REDIS_HOST: c7n-redis.c7n-system.svc
    12. SPRING_REDIS_PORT: 6379
    13. SPRING_REDIS_DATABASE: 7
    14. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/asgard_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    15. SPRING_DATASOURCE_USERNAME: choerodon
    16. SPRING_DATASOURCE_PASSWORD: password
  • 部署服务

    1. helm upgrade --install choerodon-asgard c7n/choerodon-asgard \
    2. -f choerodon-asgard.yaml \
    3. --create-namespace \
    4. --version 0.23.3 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-asgard -o jsonpath="{.items[0].status.podIP}"):8041/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon swagger

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-swagger

  • 编写参数配置文件 choerodon-swagger.yaml

    1. env:
    2. open:
    3. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    4. HZERO_OAUTH_URL: http://api.example.choerodon.io/oauth/oauth/authorize
    5. SPRING_REDIS_HOST: c7n-redis.c7n-system
    6. SPRING_REDIS_PORT: 6379
    7. # 此db不可更改
    8. SPRING_REDIS_DATABASE: 1
    9. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_admin?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    10. SPRING_DATASOURCE_USERNAME: choerodon
    11. SPRING_DATASOURCE_PASSWORD: password
  • 部署服务

    1. helm upgrade --install choerodon-swagger c7n/choerodon-swagger \
    2. -f choerodon-swagger.yaml \
    3. --create-namespace \
    4. --version 0.23.1 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-swagger -o jsonpath="{.items[0].status.podIP}"):8051/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon gateway

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-gateway

  • 编写参数配置文件 choerodon-gateway.yaml

    1. env:
    2. open:
    3. SPRING_REDIS_HOST: c7n-redis.c7n-system
    4. SPRING_REDIS_PORT: 6379
    5. # 此db不可更改
    6. SPRING_REDIS_DATABASE: 4
    7. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_platform?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    8. SPRING_DATASOURCE_USERNAME: choerodon
    9. SPRING_DATASOURCE_PASSWORD: password
    10. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    11. ingress:
    12. enabled: true
    13. host: api.example.choerodon.io
  • 部署服务

    1. helm upgrade --install choerodon-gateway c7n/choerodon-gateway \
    2. -f choerodon-gateway.yaml \
    3. --create-namespace \
    4. --version 0.23.1 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-gateway -o jsonpath="{.items[0].status.podIP}"):8081/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon oauth

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-oauth

  • 编写参数配置文件 hzero-oauth.yaml

    1. env:
    2. open:
    3. # 如果使用https 该参数设置为true
    4. HZERO_OAUTH_LOGIN_ENABLE_HTTPS: false
    5. HZERO_OAUTH_LOGIN_SUCCESS_URL: http://app.example.choerodon.io
    6. HZERO_OAUTH_LOGIN_DEFAULT_CLIENT_ID: choerodon
    7. HZERO_GATEWAY_URL: http://api.example.choerodon.io
    8. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    9. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_platform?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    10. SPRING_DATASOURCE_USERNAME: choerodon
    11. SPRING_DATASOURCE_PASSWORD: password
    12. SPRING_REDIS_HOST: c7n-redis.c7n-system
    13. SPRING_REDIS_PORT: 6379
    14. # 此db不可更改
    15. SPRING_REDIS_DATABASE: 3
  • 部署服务

    1. helm upgrade --install choerodon-oauth c7n/choerodon-oauth \
    2. -f choerodon-oauth.yaml \
    3. --create-namespace \
    4. --version 0.23.1 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-oauth -o jsonpath="{.items[0].status.podIP}"):8021/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon monitor

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-monitor

  • 编写参数配置文件 choerodon-monitor.yaml

    1. preJob:
    2. preInitDB:
    3. datasource:
    4. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    5. username: choerodon
    6. password: password
    7. env:
    8. open:
    9. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    10. SPRING_REDIS_HOST: c7n-redis.c7n-system
    11. SPRING_REDIS_PORT: 6379
    12. # 此db不可更改
    13. SPRING_REDIS_DATABASE: 1
    14. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_monitor?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    15. SPRING_DATASOURCE_USERNAME: choerodon
    16. SPRING_DATASOURCE_PASSWORD: password
  • 部署服务

    1. helm upgrade --install choerodon-monitor c7n/choerodon-monitor \
    2. -f choerodon-monitor.yaml \
    3. --create-namespace \
    4. --version 0.23.1 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-monitor -o jsonpath="{.items[0].status.podIP}"):8261/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon file

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-file

  • 编写参数配置文件 choerodon-file.yaml

    1. preJob:
    2. preInitDB:
    3. datasource:
    4. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    5. username: choerodon
    6. password: password
    7. driver: com.mysql.jdbc.Driver
    8. env:
    9. open:
    10. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    11. MINIO_ACCESSKEY: accesskey
    12. MINIO_ENDPOINT: http://minio.example.choerodon.io
    13. MINIO_SECRETKEY: secretkey
    14. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_file?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    15. SPRING_DATASOURCE_USERNAME: choerodon
    16. SPRING_DATASOURCE_PASSWORD: password
    17. SPRING_REDIS_HOST: c7n-redis.c7n-system
    18. SPRING_REDIS_PORT: 6379
    19. # 此db不可更改
    20. SPRING_REDIS_DATABASE: 1
    21. SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE: 200MB
    22. SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE: 200MB
    23. FILE_GATEWAY_URL: http://api.example.choerodon.io/hfle
  • 部署服务

    1. helm upgrade --install choerodon-file c7n/choerodon-file \
    2. -f choerodon-file.yaml \
    3. --create-namespace \
    4. --version 0.23.1 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-file -o jsonpath="{.items[0].status.podIP}"):8111/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 choerodon message

  • 若需了解项目详情及各项参数含义,请移步 open-hand/choerodon-message

  • 编写参数配置文件 choerodon-message.yaml

    1. preJob:
    2. preInitDB:
    3. datasource:
    4. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    5. username: choerodon
    6. password: password
    7. env:
    8. open:
    9. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    10. HZERO_WEBSOCKET_OAUTHURL: http://choerodon-oauth/oauth/api/user
    11. SPRING_REDIS_HOST: c7n-redis.c7n-system
    12. SPRING_REDIS_PORT: 6379
    13. # 此db不可更改
    14. SPRING_REDIS_DATABASE: 1
    15. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_message?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    16. SPRING_DATASOURCE_USERNAME: choerodon
    17. SPRING_DATASOURCE_PASSWORD: password
    18. ingress:
    19. enabled: true
    20. host: notify.example.choerodon.io
  • 部署服务

    1. helm upgrade --install choerodon-message c7n/choerodon-message \
    2. -f choerodon-message.yaml \
    3. --create-namespace \
    4. --version 0.23.7 \
    5. --namespace c7n-system
  • 验证部署

    • 验证命令
  1. ```
  2. curl -s $(kubectl get po -n c7n-system -l choerodon.io/release=choerodon-message -o jsonpath="{.items[0].status.podIP}"):8121/actuator/health | jq -r .status
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```