Skip to content

Commit

Permalink
feature/implemented-release-scripts
Browse files Browse the repository at this point in the history
Implementing a system for the install scripts pulling down the right version
  • Loading branch information
bigbitbus committed Dec 18, 2020
1 parent 4dc9747 commit 39e7fe7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This script needs to run as the root user.

# There are two command line arguments (both optional) but quite important to understand
# $1 is the RELEASENAME you want to install from github
# $2 is the USER for whom to install this.

# Please make sure the user matches the one for which you installed and configured Kubernetes


DEFAULTRELEASENAME="candair-0.3" # Change this as required with new tags (before you tag!!!)
date
echo "Starting BigBitBus Kubernetes Automation Toolkit (KAT) cluster application installations"

if [ ! -z $1 ]
then
export INSTALLUSER=$1
export RELEASENAME=$1
else
export RELEASENAME=$DEFAULTRELEASENAME
fi

echo "Installing KAT release $RELEASENAME."

export RELEASEDIRNAME="kubernetes-automation-toolkit-"$RELEASENAME

if [ ! -z $2 ]
then
export INSTALLUSER=$2
else
export INSTALLUSER=$(ls /home/* -d | head -n 1 | cut -d/ -f3)
fi
Expand All @@ -27,44 +48,44 @@ export KUBECONFIG=/home/$INSTALLUSER/.kube/config
kubectl config set-context microk8s
cd /home/$INSTALLUSER
# Pull zipped files
rm -rf bigbitbus-kat-main # Clean out any old run
rm bigbitbus-kat-main.zip
wget https://github.com/BigBitBusInc/kubernetes-automation-toolkit/archive/candair-0.2.zip
unzip bigbitbus-kat-main.zip
rm -rf $RELEASEDIRNAME # Clean out any old run
rm $RELEASENAME.zip
wget https://github.com/BigBitBusInc/kubernetes-automation-toolkit/archive/$RELEASENAME.zip
unzip $RELEASENAME.zip


# Postgres
cd /home/$INSTALLUSER/bigbitbus-kat-main/code/k8s-common-code/postgres-db/
cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/postgres-db/
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm upgrade --install pgdb bitnami/postgresql -f pg-values.yaml --namespace pg --create-namespace

# Monitoring
cd /home/$INSTALLUSER/bigbitbus-kat-main/code/k8s-common-code/monitoring/
cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/monitoring/
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add stable https://charts.helm.sh/stable
helm repo update
helm upgrade --install monitoring-stack prometheus-community/kube-prometheus-stack -f ./prometheus-grafana-monitoring-stack-values.yaml --namespace monitoring --create-namespace

# K8s Dashboard
cd /home/$INSTALLUSER/bigbitbus-kat-main/code/k8s-common-code/k8sdashboard/
cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/k8sdashboard/
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
helm repo update
helm upgrade --install k8sdashboard kubernetes-dashboard/kubernetes-dashboard -f ./dashboard-values.yaml --namespace dashboard --create-namespace

# Backend
kubectl create namespace be
cd /home/$INSTALLUSER/bigbitbus-kat-main/code/app-code/api/todo-python-django/
cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/app-code/api/todo-python-django/
skaffold run --default-repo localhost:32000

# Frontend
kubectl create namespace fe
cd /home/$INSTALLUSER/bigbitbus-kat-main/code/app-code/frontend/todo-vuejs/
cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/app-code/frontend/todo-vuejs/
skaffold run --default-repo localhost:32000

chown -R $INSTALLUSER:$INSTALLUSER /home/$INSTALLUSER/bigbitbus-kat-main/
chown -R $INSTALLUSER:$INSTALLUSER /home/$INSTALLUSER/$RELEASEDIRNAME/
cd /home/$INSTALLUSER
rm bigbitbus-kat-main.zip
rm $RELEASENAME.zip
# Print what was deployed for later debugging
kubectl get all --all-namespaces
echo "Ended BigBitBus Kubernetes Automation Toolkit (KAT) application installation script"
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This script needs to run as the root user.

# There are two command line arguments (both optional) but quite important to understand
# $1 is the KUBERNETES VERSION
# $2 is the USER for whom to install this.

DEFAULTKUBERNETESVERSION="1.19"
date
echo "Starting BigBitBus Kubernetes Automation Toolkit (KAT) Microk8s installation script"
if [ ! -z $1 ]
then
export KUBEVERSION=$1
else
export KUBEVERSION="1.19"
export KUBEVERSION=$DEFAULTKUBERNETESVERSION
fi

echo "Installing Kubernetes version " $KUBEVERSION
Expand All @@ -43,9 +50,9 @@ apt-get install unzip

# Note - we pegged the Kubernetes version here
snap install microk8s --classic --channel=1.19
snap install docker --channel=19.03
snap install --stable docker
snap install kubectl --classic --channel=1.19
snap install helm --classic --channel=3.4.2
snap install helm --classic --channel=3.4
sleep 60 # Sometimes microk8s needs time to stabilize
cd /tmp
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \
Expand Down

0 comments on commit 39e7fe7

Please sign in to comment.