首页 文章

部署到多个 生产环境 服务器

提问于
浏览
1

我们有一个基于Gitlab CD / CI的主存储库 . 现在随着我们的成长,我们很难通过使用Git进行自动部署来更新我们客户的每个应用程序 .

现在,我们正在寻找一个解决方案,当 生产环境 阶段成功和测试通过,然后我们所有的客户都会获得最新的部署并自动提取更新 . (继续交付)

在Gitlab中有一个deploy to production,但它适用于单个 生产环境 ,我们想为每个镜像复制这些步骤 .

2 回答

  • -1

    Gitlab-CI部署阶段可以有多个环境,您可以将每个环境设置为自动/手动部署 .

    示例:只需将登台更改为customer1,将 生产环境 更改为customer2,然后根据需要添加 .

    stages:
      - test
      - build
      - deploy
    
    test:
      stage: test
      script: echo "Running tests"
    
    build:
      stage: build
      script: echo "Building the app"
    
    deploy_staging:
      stage: deploy
      script:
        - echo "Deploy to staging server"
      environment:
        name: staging
        url: https://staging.example.com
      only:
      - master
    
    deploy_prod:
      stage: deploy
      script:
        - echo "Deploy to production server"
      environment:
        name: production
        url: https://example.com
      when: manual
      only:
      - master
    

    如果您无法访问客户环境,则另一种解决方案是应用程序自动更新 .

    同时结帐 Spinnaker ,这似乎是专门为CD设计的 .

  • 0

    您可以查看DeployHQ . 它支持同时部署到无限制的服务器 .

相关问题