Linux
- 1 ответ
- 0 вопросов
1
Вклад в тег
stages:
- deploy
deploy_master:
image: alpine
stage: deploy
script:
- apk update && apk upgrade
- apk add openssh bash rsync
- echo "====== Deploy to production server ======"
- echo "====== Add target servers secret key ======"
- mkdir ~/.ssh
- echo $TARGET_SERVER_SECRET_KEY > ~/.ssh/id_rsa
- chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
- echo "====== Test ssh connection ======"
- ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T "root@target_server"
- echo "====== Sync local and remote directory ======"
- rsync -av -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --delete ./ "root@target_server:/home/webserver/"
only:
- master