diff --git a/README.md b/README.md index c3f064e7e0563d947741ca5378096f1faeeb4e67..ba45344a8b789591d8cc8e29b493d46a1057459b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # scaling_scheduler Use this command when cloning this repo for submodules to clone as well +Clone in home directory of ubuntu user git clone --recurse-submodules repo_url * Edit scale_env.yaml with all necessary values from openstack -* Run setup.sh on a manager instance that is authenticated in the openstack cli (e.g run service user script) +* Run setup.sh on a manager instance (Ubuntu) that is authenticated in the openstack cli (e.g run service user script) Example environment variables ``` diff --git a/infcode-golang b/infcode-golang index 55bb21e55ec9abe3c64ce684d5418e773ab9200a..be2b11ca9bb586deda8ad24cc22a79a922b214b2 160000 --- a/infcode-golang +++ b/infcode-golang @@ -1 +1 @@ -Subproject commit 55bb21e55ec9abe3c64ce684d5418e773ab9200a +Subproject commit be2b11ca9bb586deda8ad24cc22a79a922b214b2 diff --git a/autoscaling.yaml b/scaling_scheduler.yaml similarity index 100% rename from autoscaling.yaml rename to scaling_scheduler.yaml diff --git a/setup.sh b/setup.sh index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..089309450f57a19eeb6b8f20052e33f698edfa6d 100644 --- a/setup.sh +++ b/setup.sh @@ -0,0 +1,27 @@ +#!/bin/bash -v +# CREATE STACK +openstack stack create -t scaling_scheduler.yaml -e scale_env.yaml scaling_scheduler + +# Wait 3 minutes while stack is being created +secs=$((3 * 60)) +while [ $secs -gt 0 ]; do + echo -ne "Leeway countdown for stack CREATE to finish: $secs\033[0K\r" + sleep 1 + : $((secs--)) +done + +# Get both downscale and upscale webhooks from stack output and feed to service project directory +openstack stack output show --all autoscale_scheduler | grep -Eo "(https)://[a-zA-Z0-9./?&=_%:-]*" > infcode-golang/scheduleroutputdata.txt + +# Install golang if not installed +sudo apt-get -y install golang-golang + +# Create symlink for systemctl to run go service +sudo ln -s infcode-golang/scheduler.service /etc/systemd/system/scheduler.service + +# Activate service with systemd +sudo systemctl daemon-reload +sudo systemctl enable scheduler +sudo systemctl start scheduler + +