持续交付部署

在此之前,应该准备好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

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

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

    1. env:
    2. open:
    3. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://hzero-register.c7n-system:8000/eureka/
    4. SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/workflow_service?useUnicode=true&characterEncoding=utf-8&useSSL=false?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
    5. SPRING_DATASOURCE_USERNAME: choerodon
    6. SPRING_DATASOURCE_PASSWORD: password
  • 部署服务

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

    • 验证命令
  1. ```
  2. 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
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 gitlab service

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

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

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

    • 验证命令
  1. ```
  2. 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
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```

部署 devops service

  • 若需了解项目详情及各项参数含义,请移步 choerodon/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. env:
    16. open:
    17. SPRING_REDIS_HOST: c7n-redis.c7n-system
    18. SPRING_REDIS_PORT: 6379
    19. SPRING_REDIS_DATABASE: 9
    20. EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://hzero-register.c7n-system:8000/eureka/
    21. 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
    22. SPRING_DATASOURCE_USERNAME: choerodon
    23. SPRING_DATASOURCE_PASSWORD: password
    24. SERVICES_GITLAB_URL: https://gitlab.example.choerodon.io/
    25. SERVICES_GITLAB_SSHURL: gitlab.example.choerodon.io
    26. SERVICES_GITLAB_PROJECTLIMIT: 100
    27. SERVICES_HELM_URL: http://chart.example.choerodon.io
    28. SERVICES_HARBOR_BASEURL: https://registry.example.choerodon.io
    29. SERVICES_HARBOR_USERNAME: choerodon
    30. SERVICES_HARBOR_PASSWORD: password
    31. SERVICES_HARBOR_INSECURESKIPTLSVERIFY: true
    32. SERVICES_GATEWAY_URL: https://api.example.choerodon.io
    33. AGENT_VERSION: 0.22.3
    34. AGENT_SERVICEURL: wss://devops.example.choerodon.io/websocket
    35. AGENT_REPOURL: https://openchart.choerodon.com.cn/choerodon/c7n/
    36. AGENT_CERTMANAGERURL: https://openchart.choerodon.com.cn/choerodon/c7n/on/c7n/
    37. ingress:
    38. enabled: true
    39. host: devops.example.choerodon.io
  • 部署服务

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

    • 验证命令
  1. ```
  2. 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
  3. ```
  4. - 出现以下类似信息即为成功部署
  5. ```
  6. UP
  7. ```