Skip to content

Commit

Permalink
Use ~/ain-blockchain for monitoring deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
platfowner committed Jan 9, 2022
1 parent 37dc4cf commit 3686889
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion deploy_blockchain_sandbox_gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ printf "KILL_OPTION=$KILL_OPTION\n"

# Get confirmation.
printf "\n"
read -p "Do you want to proceed? >> (y/N) " -n 1 -r
read -p "Do you want to proceed for $SEASON? [y/N]: " -n 1 -r
printf "\n\n"
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
Expand Down
12 changes: 6 additions & 6 deletions deploy_monitoring_gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ printf "OPTIONS=$OPTIONS\n"

# Get confirmation.
printf "\n"
read -p "Do you want to proceed? >> (y/N) " -n 1 -r
read -p "Do you want to proceed for $SEASON? [y/N]: " -n 1 -r
printf "\n\n"
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi

Expand All @@ -51,14 +50,15 @@ gcloud compute ssh $MONITORING_TARGET_ADDR --command "sudo killall grafana-serve
# deploy files to GCP instances
printf "\nDeploying monitoring..."
printf "\nDeploying files to ${MONITORING_TARGET_ADDR}..."
gcloud compute scp --recurse $FILES_FOR_MONITORING ${MONITORING_TARGET_ADDR}:~/ --project $PROJECT_ID --zone $MONITORING_ZONE
gcloud compute ssh ${MONITORING_TARGET_ADDR} --command "sudo rm -rf ~/ain-blockchain; sudo mkdir ~/ain-blockchain; sudo chmod -R 777 ~/ain-blockchain" --project $PROJECT_ID --zone $MONITORING_ZONE
gcloud compute scp --recurse $FILES_FOR_MONITORING ${MONITORING_TARGET_ADDR}:~/ain-blockchain/ --project $PROJECT_ID --zone $MONITORING_ZONE

# ssh into each instance, set up the ubuntu VM instance (ONLY NEEDED FOR THE FIRST TIME)
if [[ $OPTIONS = "--setup" ]]; then
printf "\n\n##########################\n# Setting up monitoring #\n###########################\n\n"
gcloud compute ssh $MONITORING_TARGET_ADDR --command ". setup_monitoring_ubuntu.sh" --project $PROJECT_ID
gcloud compute ssh $MONITORING_TARGET_ADDR --command "cd ./ain-blockchain; . setup_monitoring_ubuntu.sh" --project $PROJECT_ID
fi

# ssh into each instance, install packages and start up the server
printf "\n\n############################\n# Running monitoring #\n############################\n\n"
gcloud compute ssh $MONITORING_TARGET_ADDR --command ". setup_monitoring_gcp.sh ${SEASON} && . start_monitoring_gcp.sh" --project $PROJECT_ID --zone $MONITORING_ZONE
gcloud compute ssh $MONITORING_TARGET_ADDR --command "cd ./ain-blockchain; . setup_monitoring_gcp.sh ${SEASON} && . start_monitoring_gcp.sh" --project $PROJECT_ID --zone $MONITORING_ZONE
13 changes: 6 additions & 7 deletions setup_monitoring_gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ killall grafana-server


printf 'Setting up working directory..\n'
cd
sudo rm -rf ../ain-blockchain
sudo mkdir ../ain-blockchain
sudo chmod 777 ../ain-blockchain
mv * ../ain-blockchain
cd ../ain-blockchain

sudo rm -rf /home/ain-blockchain
cd ~
sudo mv ain-blockchain /home
sudo chmod -R 777 /home/ain-blockchain
sudo chown -R root:root /home/ain-blockchain
cd /home/ain-blockchain

printf 'Installing Prometheus..\n'
curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest \
Expand Down

0 comments on commit 3686889

Please sign in to comment.