【问题标题】:Gitlab - Google compute engine Continuous deliveryGitlab - 谷歌计算引擎持续交付
【发布时间】:2023-03-30 00:38:01
【问题描述】:

我要做的是启用从 GitLab 到我在 Google Cloude 上的计算引擎的持续交付。我在那里运行 Ubuntu 16.04 TSL。我确实安装了运行我的项目所需的所有组件,例如:Swift、vapor、nginx。 我也设法安装了 Gitlab 运行程序,并创建了一个运行程序,可以从我的 gitlab 存储库访问该运行程序。每次我推动主人时,跑步者都会触发。失败的原因是:

could not create leading directories of '/home/gitlab-runner/builds/2bbbbbd/0/Server/Packages/vapor.git': Permission denied

如果我将权限更改为chmod -R 777,它将在running 上挂起,因为build 阶段在 gitlab 管道上可见。

我做了类似的事情: sudo chown -R gitlab-runner:gitlab-runner /home/gitlab-runner/builds sudo chown -R gitlab-runner:gitlab-runner /home/gitlab-runner/cache 但这没有帮助,错误是相同的Permission denied

下面是我的.gitlab-ci.yml

before_script:
  - swift --version

stages:
  - build
  - deploy

job_build:
  stage: build
  before_script:
  - vapor clean
  script:
  - vapor build --release
  only:
  - master

job_run_app:
  stage: deploy
  script:
    - echo "Deploy a  API"
    - vapor run --name=App --env=production
  environment:
    name: production

job_run_frontend:
  stage: deploy
  script:
    - echo "Deploy a  Frontend"
    - vapor run --name=Frontend --env=production
  environment:
    name: production

但这还没有传递到下一阶段,例如。部署。我已经等了超过 14 小时,但没有结果。 还有……我还有几个问题:

  1. Gitlab 运行器在此位置的/home/gitlab-runner/builds/ 位置下创建构建,每个新作业都有自己的文件夹。例如。 /home/gitlab-runner/builds/2bbbbbd/ 其中是我的项目并执行命令。那么当第一个正在运行并且我确实部署了新版本时会发生什么?端口被第一个实例阻塞等等?
  2. 如果我想启用supervisor,当我每次部署的文件夹都不一样时,我该怎么做?
  3. 谁能解释或向我展示或指导我如何在没有 docker 的情况下进行持续部署?

【问题讨论】:

  • 您是如何解决权限问题的?我自己也面临同样的问题。
  • 我确实使用了适合我的chmod -R 777。我知道这不是完美的解决方案,但出于测试目的它很好。然而它挂在build 上,因为它没有完成的过程。对于 CD,我现在的目标是 dpl
  • 经过一些工作,我得到了build 来从事 gce 工作。现在也在寻找 dpl 的 CD

标签: swift3 gitlab google-compute-engine continuous-deployment vapor


【解决方案1】:

How to start a service using GitLab runner

多亏了长时间的深入搜索,我终于找到了答案!完整的文章可以在上面找到。

GitLab CI 文档简要推荐使用 dpl 进行部署。 Gitlab runner 运行测试和进程应该结束。运行器旨在在完成每个构建后终止所有创建的进程。 GitLab 运行器无法在目录之外执行操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-12-05
    • 2014-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-07
    • 2016-08-26
    • 2021-11-15
    相关资源
    最近更新 更多