I’ve setup a CI/CD pipeline for the deployment of my MEAN App on DigitalOcean Droplet. I am having problems setting up SSH for deployment. Here’s my gitlab CI configuration
image: trion/ng-cli-karma
cache:
paths:
- wiki-quotes-client/node_modules/
- wiki-quotes-server/node_modules/
stages:
- test
- build
- deploy
test_server:
script:
- cd wiki-quotes-server
- npm install
- npm run test
test_client:
script:
- cd wiki-quotes-client
- npm install
- ng test --watch=false
build_angular:
only:
- master
stage: build
script:
- npm install
- cd wiki-quotes-client
- ng build --prod
artifacts:
paths:
- wiki-quotes-client/dist/wiki-quotes-client/.
deploy:
only:
- master
stage: deploy
script:
- apt-get update -qq
- apt-get install -qq git
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ssh goutambseervi@xxx.xx.xxx.xxx -tt -o StrictHostKeyChecking=no 'cd ~/wikiquotesapp; git pull; cd wiki-quotes-server; npm install; npm run start:prod'
This is the ouput for the deploy job…