Commit 26756c83 authored by Alexander Sachs's avatar Alexander Sachs

added aws host to use for requests

parent 5fc34c39
Pipeline #35666 passed with stages
in 2 minutes and 54 seconds
# any future command that fails will exit the script
set -e
# Lets write the public key of our aws instance
eval $(ssh-agent -s)
echo "$PRIVATE_KEY_AWS" | tr -d '\r' | ssh-add - > /dev/null
# ** Alternative approach
# echo -e "$PRIVATE_KEY" > /root/.ssh/id_rsa
# chmod 600 /root/.ssh/id_rsa
# ** End of alternative approach
# disable the host key checking.
set -e
mkdir -p ~/.ssh
touch ~/.ssh/config
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config
# we have already setup the DEPLOYER_SERVER in our gitlab settings which is a
# comma seperated values of ip addresses.
# lets split this string and convert this into array
# In UNIX, we can use this commond to do this
# ${string//substring/replacement}
# our substring is "," and we replace it with nothing.
# Lets iterate over this array and ssh into each EC2 instance
# Once inside.
# 1. Stop the server
# 2. Take a pull
# 3. Start the server
for server in "${ALL_SERVERS[@]}"
echo "deploying to ${server}"
ssh ubuntu@${server} 'bash -s' < ./deploy/
# any future command that fails will exit the script
set -e
# Install dependencies if they are missing
which git || (sudo apt-get update -yq --fix-missing && sudo apt-get install -yq git-core)
which npm || (sudo apt-get update -yq --fix-missing && sudo apt-get install -yq npm)
which nvm || (sudo npm install nvm -g)
which pm2 || (sudo npm install pm2 -g)
# stop the previous pm2
echo "Killing previous node instances"
pm2 kill
# Delete the old repo
echo "Delete the old repo"
rm -rf /home/ubuntu/rtls_frontend/
# clone the repo again
echo "clone the repo"
git clone
# starting pm2 daemon
pm2 status
cd /home/ubuntu/rtls_frontend
#install npm packages
echo "Running npm install"
npm install --no-optional
#Restart the node server
echo "Starting the server with pm2"
pm2 start webpack-dev-server --inline --progress --config build/
......@@ -98,7 +98,7 @@
import axios from 'axios';
let host = ''
let host = ''
export default {
name: 'rtlsfrontend',
data() {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment