This is the first time I’m deploying a Laravel application by using GitLab, or Docker images, and I might just have some confusion regarding the process.
I followed this guide: laravel_with_gitlab_and_envoy, and everything seems to work untill deployment begins. I can see that my files were actually uploaded to the server, but the deployment job always ends with error.
Target production server is simple shared hosting, and I have ssh-connection to there (sudo doesn’t seem to work though, so I can't for example edit the actual ssh configs).
I’m a bit confused about the @server
directive of Envoy.blade.php
, and have already tried different credentials there. But now I’m pretty sure I should have my ssh_username@production_ip
there, yet the GitLab deployment job ends with this error:
$ [[ -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.
And now I’m not sure which permissions I’m lacking, because the main app files already got uploaded to app_dir
. Does this mean it for some reason can’t get the release files from GitLab or something else?
Or might I have something wrong in my Docker image at this point?
Huhuh, I finally found the issue. I had to manually create .ssh/config
file with the following content:
Host gitlab.com
User git
Hostname gitlab.com
IdentityFile ~/.ssh/deploy_key
TCPKeepAlive yes
IdentitiesOnly yes
And now deployment process is finally able to upload the release versions too!