docker - 部署到多个生产服务器

标签 docker github gitlab autodeploy

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

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

Gitlab中有一个deploy to production,但是它用于单次生产,我们想为每个镜像重复此步骤。

最佳答案

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

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

还可以 check out 大三角帆,它似乎是专门为CD设计的。

关于docker - 部署到多个生产服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51578776/

相关文章:

docker - 使用 -v 挂载 VOLUME 时文件不可用

docker run hello-world 结果为 "Incorrect Usage"错误 : "flag provided but not defined: -console"

api - 通过其 API 更新要点

gitlab - 从 GitLab 工件存档下载单个文件

docker - 云运行和发布容器

mysql - 错误 : database is uninitialized and MYSQL_ROOT_PASSWORD not set

git - 在本地与卡在 pull 请求中的本地分支远程工作

git - GitHub 中一个分支的代码审查

go - 如何将 Go dep 与 GitLab 子组一起使用

docker - 有关如何使用Helm和Kubernetes进行个人服务设置的建议