How do you create rsync files from Gitlab CI to another server
I am not clear on how to get my build files from Gitlab CI (hosted at https://ci.gitlab.com ) on my personal server using rsync.
I have 1 test setup and 1 deployment .
Under the deploy tab, I entered bash commands in:
- Install rsync
- Update packages
- Finally, the rsync command to transfer files over SSH to my personal server.
When I enter SSH credentials (with verbose flag enabled) for my personal private server, it looks like the SSH key is the problem. In Gitlab I have already installed the deployment key (for hooks - tested it and works).
Where can I find the public SSH key for the Gitlab deployment instance so that I can install that key on my server?
Below is the exact script injected into the CI deployment job to deploy the Gitlab script:
# Run as root
(
set -e
set -u
set -x
apt-get update -y
apt-get -y install rsync
)
git clone https://github.com/bla/deployments.git $HOME/deploy/deployments
SVR_WEB1_WEBSERVER="000.11.22.333"
USER1="franklin"
GROUP1="team1"
FROM_DIR="/gitlab-ci-runner/tmp/builds/myrepo-1/"
DEST1="subdomains/gitlab/myrepo"
EXCLUSIONS_LIST="${HOME}/deploy/deployments/exclusions/exclusions.txt"
ssh -v "$USER1@$SVR_WEB1_WEBSERVER"
/usr/bin/rsync -avzh --progress --delete -e ssh --group=$GROUP1 -p --exclude-from "$EXCLUSIONS_LIST" "$FROM_DIR" "$USER1@$SVR_WEB1_WEBSERVER:$DEST1"
source to share
Providing your private ssh key is dangerous unless you use your own gitlab-ci runners for deployment. Therefore it is better to use rsync modules .
source to share