0

这是我第一次使用 GitLab 或 Docker 镜像部署 Laravel 应用程序,我可能对这个过程有些困惑。

我遵循了本指南:laravel_with_gitlab_and_envoy,在部署开始之前一切似乎都正常。我可以看到我的文件实际上已上传到服务器,但部署作业总是以错误结束。

目标生产服务器是简单的共享主机,我有 ssh 连接到那里(虽然 sudo 似乎不起作用,所以我不能例如编辑实际的 ssh 配置)。

我对 的@server指令有点困惑Envoy.blade.php,并且已经在那里尝试了不同的凭据。但现在我很确定我应该在ssh_username@production_ip那里,但 GitLab 部署工作以这个错误结束:

$ [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
$ ~/.composer/vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA"
[ssh_username@production_ip]: Cloning repository
[ssh_username@production_ip]: Cloning into 'app/releases/20200522043301'...
[ssh_username@production_ip]: Permission denied (publickey).
[ssh_username@production_ip]: fatal: Could not read from remote repository.
[ssh_username@production_ip]: Please make sure you have the correct access rights
[ssh_username@production_ip]: and the repository exists.
[✗] This task did not complete successfully on one of your servers.

现在我不确定我缺少哪些权限,因为主要的应用程序文件已经上传到app_dir. 这是否意味着由于某种原因无法从 GitLab 或其他地方获取发布文件?

或者此时我的 Docker 映像可能有问题?

4

1 回答 1

0

呵呵,终于找到问题了。我必须手动创建.ssh/config具有以下内容的文件:

Host gitlab.com
User git
Hostname gitlab.com
IdentityFile ~/.ssh/deploy_key
TCPKeepAlive yes
IdentitiesOnly yes

现在部署过程也终于可以上传发布版本了!

于 2020-05-23T08:26:04.117 回答