diff --git a/jenkins/README.md b/jenkins/README.md index 74a1fd8..4990ecb 100644 --- a/jenkins/README.md +++ b/jenkins/README.md @@ -553,7 +553,12 @@ pipeline { } } - + stage('Deploy') { + def dockerRun = 'docker run -p 8080:8080 -d --name my-app kkk/my-app:2.0.0' + sshagent(['dev-server']) { + sh "ssh -o StrictHostKeyChecking=no ec2-user@172.31.18.198 ${dockerRun}" + } + } } @@ -562,4 +567,35 @@ pipeline { ``` - \ No newline at end of file + + +* wallet-api-uat-deploy + +```shell +#!/bin/bash +set +x + +DEPLOY_ENV="UAT" + +# (TODO: NOT SURE ABOUT THIS, ASK JOHAR MAH) +echo "*** Building for ENV=${DEPLOY_ENV}, COUNTRY=${DEPLOY_COUNTRY}" +echo "*** Applying Jenkins configuration file: /home/jenkins/config/${DEPLOY_ENV}_${DEPLOY_COUNTRY}.properties" +source /home/jenkins/config/${DEPLOY_ENV}_${DEPLOY_COUNTRY}.properties + +APP_NAME=wallet-api/// +APP_PATH=./razer-pay-wallet-api + +echo "WALLET_API_HOST_USERNAME: ${WALLET_API_HOST_USERNAME//[$'\t\r\n ']}" +echo "WALLET_API_HOST_IP: ${WALLET_API_HOST_IP//[$'\t\r\n ']}" +ssh -oStrictHostKeyChecking=no "${WALLET_API_HOST_USERNAME//[$'\t\r\n ']}"@"${WALLET_API_HOST_IP//[$'\t\r\n ']}" << EOF + cd ${APP_PATH} + git checkout ${BRANCH_NAME} + git pull + npm install + export NODE_ENV=production + pm2 restart ${APP_NAME} --watch +EOF + +echo "Deployed successfully" +``` +