持续交付部署

在此之前,应该准备好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 gitlab_service DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  10. CREATE DATABASE IF NOT EXISTS workflow_service DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  11. GRANT ALL PRIVILEGES ON devops_service.* TO choerodon@'%';
  12. GRANT ALL PRIVILEGES ON gitlab_service.* TO choerodon@'%';
  13. GRANT ALL PRIVILEGES ON workflow_service.* TO choerodon@'%';
  14. FLUSH PRIVILEGES;
  • 执行安装
  1. helm install c7n/mysql-client \
  2. -f create-c7ncd-db.yaml \
  3. --version 0.1.0 \
  4. --name create-c7ncd-db \
  5. --namespace c7n-system

部署 workflow service

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

  • 编写参数配置文件 workflow-service.yaml

  1. env:
  2. open:
  3. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://register-server.c7n-system:8000/eureka/
  4. SPRING_CLOUD_CONFIG_URI: http://register-server.c7n-system:8000/
  5. SPRING_DATASOURCE_PASSWORD: password
  6. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/workflow_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
  7. SPRING_DATASOURCE_USERNAME: choerodon
  8. SPRING_REDIS_DATABASE: 8
  9. SPRING_REDIS_HOST: c7n-redis.c7n-system.svc
  10. preJob:
  11. timeout: 1800
  12. preInitDB:
  13. datasource:
  14. password: password
  15. url: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/workflow_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
  16. username: choerodon
  • 部署服务
  1. helm install c7n/workflow-service \
  2. -f workflow-service.yaml \
  3. --name workflow-service \
  4. --version 0.21.0 \
  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

  • 若需了解项目详情及各项参数含义,请移步 choerodon/gitlab-service
  • 如何获取 GITLAB_PRIVATETOKEN 请查看这里
  • 编写参数配置文件 gitlab-service.yaml
  1. env:
  2. open:
  3. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://register-server.c7n-system:8000/eureka/
  4. GITLAB_PRIVATETOKEN: Gitlab 中获取的 private token
  5. GITLAB_URL: http://gitlab.example.choerodon.io
  6. SPRING_CLOUD_CONFIG_URI: http://register-server.c7n-system:8000/
  • 部署服务
  1. helm install c7n/gitlab-service \
  2. -f gitlab-service.yaml \
  3. --name gitlab-service \
  4. --version 0.21.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

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

  • 编写参数配置文件 devops-service.yaml

  1. env:
  2. open:
  3. AGENT_CERTMANAGERURL: https://openchart.choerodon.com.cn/choerodon/infra/
  4. AGENT_REPOURL: https://openchart.choerodon.com.cn/choerodon/c7n/
  5. AGENT_SERVICEURL: ws://devops.example.choerodon.io/agent/
  6. AGENT_VERSION: 0.21.1
  7. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://register-server.c7n-system:8000/eureka/
  8. SERVICES_GATEWAY_URL: http://api.example.choerodon.io
  9. SERVICES_GITLAB_PROJECTLIMIT: 100
  10. SERVICES_GITLAB_SSHURL: gitlab.example.choerodon.io:32222
  11. SERVICES_GITLAB_URL: http://gitlab.example.choerodon.io
  12. SERVICES_HARBOR_BASEURL: https://registry.example.choerodon.io
  13. SERVICES_HARBOR_INSECURESKIPTLSVERIFY: true
  14. SERVICES_HARBOR_PASSWORD: Harbor12345
  15. SERVICES_HARBOR_USERNAME: admin
  16. SERVICES_HELM_URL: http://chart.example.choerodon.io
  17. SPRING_CLOUD_CONFIG_URI: http://register-server.c7n-system:8000/
  18. SPRING_DATASOURCE_PASSWORD: password
  19. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/devops_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
  20. SPRING_DATASOURCE_USERNAME: choerodon
  21. SPRING_REDIS_DATABASE: 7
  22. SPRING_REDIS_HOST: c7n-redis.c7n-system.svc
  23. ingress:
  24. enabled: true
  25. host: devops.example.choerodon.io
  26. preJob:
  27. timeout: 1800
  28. preInitDB:
  29. datasource:
  30. password: password
  31. url: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/devops_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
  32. username: choerodon
  33. service:
  34. enabled: true
  • 部署服务
  1. helm install c7n/devops-service \
  2. -f devops-service.yaml \
  3. --name devops-service \
  4. --version 0.21.0 \
  5. --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