持续交付部署

在此之前,应该准备好Mysql、Harbor、Gitlab、Minio,Chartmuseum这些组件的信息。按以下搭建顺序进行搭建,请不要随意调整搭建顺序。

添加choerodon chart仓库

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

创建数据库

  • 编写参数配置文件 create-c7ncd-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 devops_service DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    9. CREATE DATABASE IF NOT EXISTS workflow_service DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    10. GRANT ALL PRIVILEGES ON devops_service.* TO choerodon@'%';
    11. GRANT ALL PRIVILEGES ON workflow_service.* TO choerodon@'%';
    12. FLUSH PRIVILEGES;
  • 执行安装

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

部署 workflow service

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

  • 编写参数配置文件 workflow-service.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. datasources:
    8. # 多数据源初始化初始化菜单数据
    9. # 支持框架数据和devops进行分库 指定菜单初始化地址
    10. platform:
    11. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    12. username: choerodon
    13. password: password
    14. driver: com.mysql.jdbc.Driver
    15. message:
    16. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    17. username: choerodon
    18. password: password
    19. driver: com.mysql.jdbc.Driver
    20. env:
    21. open:
    22. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    23. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/workflow_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    24. SPRING_DATASOURCE_USERNAME: choerodon
    25. SPRING_DATASOURCE_PASSWORD: password
    26. SPRING_REDIS_HOST: c7n-redis.c7n-system.svc
    27. SPRING_REDIS_PORT: 6379
    28. # 不可以修改 REDIS DB
    29. SPRING_REDIS_DATABASE: 1
    30. HWKF_WEB_DOMAIN_NAME: http://app.example.choerodon.io
    31. resources:
    32. limits:
    33. memory: 3Gi
    34. requests:
    35. memory: 3Gi
  • 部署服务

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

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

部署 gitlab service

  • 若需了解项目详情及各项参数含义,请移步 open-hand/gitlab-service
  • 如何获取 GITLAB_PRIVATETOKEN 请查看这里
  • 编写参数配置文件 gitlab-service.yaml

    1. env:
    2. open:
    3. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    4. GITLAB_URL: http://gitlab.example.choerodon.io
    5. GITLAB_PRIVATETOKEN: xxxxxxxxxxxxxx
  • 部署服务

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

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

部署 devops service

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

  • 编写参数配置文件 devops-service.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. datasources:
    8. # 多数据源初始化初始化菜单数据
    9. # 支持框架数据和devops进行分库 指定菜单初始化地址
    10. platform:
    11. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    12. username: choerodon
    13. password: password
    14. driver: com.mysql.jdbc.Driver
    15. message:
    16. url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    17. username: choerodon
    18. password: password
    19. driver: com.mysql.jdbc.Driver
    20. env:
    21. open:
    22. SPRING_REDIS_HOST: c7n-redis.c7n-system.svc
    23. SPRING_REDIS_PORT: 6379
    24. SPRING_REDIS_DATABASE: 9
    25. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
    26. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/devops_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    27. SPRING_DATASOURCE_USERNAME: choerodon
    28. SPRING_DATASOURCE_PASSWORD: password
    29. SERVICES_GITLAB_URL: http://gitlab.example.choerodon.io/
    30. SERVICES_GITLAB_SSHURL: gitlab.example.choerodon.io:30022
    31. SERVICES_GITLAB_PROJECTLIMIT: 100
    32. SERVICES_HELM_URL: http://chart.example.choerodon.io
    33. SERVICES_HELM_USERNAME: choerodon
    34. SERVICES_HELM_PASSWORD: password
    35. SERVICES_SONARQUBE_URL: https://sonarqube.example.choerodon.io
    36. SERVICES_SONARQUBE_PASSWORD: admin
    37. SERVICES_SONARQUBE_USERNAME: admin
    38. SERVICES_GATEWAY_URL: http://api.example.choerodon.io
    39. AGENT_VERSION: 0.25.2
    40. AGENT_SERVICEURL: ws://devops.example.choerodon.io/websocket
    41. AGENT_REPOURL: https://openchart.choerodon.com.cn/choerodon/c7n/
    42. AGENT_CERTMANAGERURL: https://openchart.choerodon.com.cn/choerodon/c7n/
    43. DEVOPS_ANSIBLE_IMAGE: registry.cn-shanghai.aliyuncs.com/c7n/kubeadm-ha:0.1.3
    44. ingress:
    45. enabled: true
    46. host: devops.example.choerodon.io
  • 部署服务

    1. helm upgrade --install devops-service c7n/devops-service \
    2. -f devops-service.yaml \
    3. --version 0.25.9 \
    4. --namespace c7n-system
  • 验证部署

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