From 433f714b08fd942c6b8244bea53580f2faff6dd0 Mon Sep 17 00:00:00 2001 From: Levi Olson Date: Fri, 11 May 2018 16:22:53 -0500 Subject: [PATCH] Update ci --- .gitlab-ci.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd82049..a04d420 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,14 @@ cache: paths: - node_modules/ +before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "$SSH_PRIV_KEY" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config + stages: - test - deploy @@ -22,13 +30,8 @@ deploy_prod: stage: deploy script: - echo "Deploying to Production" - - apt-get update -qq && apt-get install -y -qq sshpass - npm install - - sshpass -V - - export SSHPASS=$SSH_PASS - - mkdir ~/.ssh - - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config - - sshpass -e ssh root@45.55.44.195 "cd /home/forge/leviolson-website && git pull && bash -c \"pm2 stop LeviOlson.com && pm2 delete LeviOlson.com && pm2 start app.js --name LeviOlson.com && pm2 logs --nostream --lines 2 LeviOlson.com && exit 0\" && exit 0" + - ssh root@206.189.236.142 "cd /opt/apps/leviolson.com && git pull && npm install && bash -c \"pm2 stop LeviOlson.com && pm2 delete LeviOlson.com && pm2 start app.js --name LeviOlson.com && pm2 logs --nostream --lines 2 LeviOlson.com && exit 0\" && exit 0" environment: name: production url: https://leviolson.com