1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515
16+ # This script needs to run as the root user.
1617
18+ # There are two command line arguments (both optional) but quite important to understand
19+ # $1 is the RELEASENAME you want to install from github
20+ # $2 is the USER for whom to install this.
21+
22+ # Please make sure the user matches the one for which you installed and configured Kubernetes
23+
24+
25+ DEFAULTRELEASENAME=" candair-0.3" # Change this as required with new tags (before you tag!!!)
26+ date
1727echo " Starting BigBitBus Kubernetes Automation Toolkit (KAT) cluster application installations"
1828
1929if [ ! -z $1 ]
2030then
21- export INSTALLUSER=$1
31+ export RELEASENAME=$1
32+ else
33+ export RELEASENAME=$DEFAULTRELEASENAME
34+ fi
35+
36+ echo " Installing KAT release $RELEASENAME ."
37+
38+ export RELEASEDIRNAME=" kubernetes-automation-toolkit-" $RELEASENAME
39+
40+ if [ ! -z $2 ]
41+ then
42+ export INSTALLUSER=$2
2243else
2344 export INSTALLUSER=$( ls /home/* -d | head -n 1 | cut -d/ -f3)
2445fi
@@ -27,44 +48,44 @@ export KUBECONFIG=/home/$INSTALLUSER/.kube/config
2748kubectl config set-context microk8s
2849cd /home/$INSTALLUSER
2950# Pull zipped files
30- rm -rf bigbitbus-kat-main # Clean out any old run
31- rm bigbitbus-kat-main .zip
32- wget https://github.com/BigBitBusInc/kubernetes-automation-toolkit/archive/candair-0.2 .zip
33- unzip bigbitbus-kat-main .zip
51+ rm -rf $RELEASEDIRNAME # Clean out any old run
52+ rm $RELEASENAME .zip
53+ wget https://github.com/BigBitBusInc/kubernetes-automation-toolkit/archive/$RELEASENAME .zip
54+ unzip $RELEASENAME .zip
3455
3556
3657# Postgres
37- cd /home/$INSTALLUSER /bigbitbus-kat-main /code/k8s-common-code/postgres-db/
58+ cd /home/$INSTALLUSER /$RELEASEDIRNAME /code/k8s-common-code/postgres-db/
3859helm repo add bitnami https://charts.bitnami.com/bitnami
3960helm repo update
4061helm upgrade --install pgdb bitnami/postgresql -f pg-values.yaml --namespace pg --create-namespace
4162
4263# Monitoring
43- cd /home/$INSTALLUSER /bigbitbus-kat-main /code/k8s-common-code/monitoring/
64+ cd /home/$INSTALLUSER /$RELEASEDIRNAME /code/k8s-common-code/monitoring/
4465helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
4566helm repo add stable https://charts.helm.sh/stable
4667helm repo update
4768helm upgrade --install monitoring-stack prometheus-community/kube-prometheus-stack -f ./prometheus-grafana-monitoring-stack-values.yaml --namespace monitoring --create-namespace
4869
4970# K8s Dashboard
50- cd /home/$INSTALLUSER /bigbitbus-kat-main /code/k8s-common-code/k8sdashboard/
71+ cd /home/$INSTALLUSER /$RELEASEDIRNAME /code/k8s-common-code/k8sdashboard/
5172helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
5273helm repo update
5374helm upgrade --install k8sdashboard kubernetes-dashboard/kubernetes-dashboard -f ./dashboard-values.yaml --namespace dashboard --create-namespace
5475
5576# Backend
5677kubectl create namespace be
57- cd /home/$INSTALLUSER /bigbitbus-kat-main /code/app-code/api/todo-python-django/
78+ cd /home/$INSTALLUSER /$RELEASEDIRNAME /code/app-code/api/todo-python-django/
5879skaffold run --default-repo localhost:32000
5980
6081# Frontend
6182kubectl create namespace fe
62- cd /home/$INSTALLUSER /bigbitbus-kat-main /code/app-code/frontend/todo-vuejs/
83+ cd /home/$INSTALLUSER /$RELEASEDIRNAME /code/app-code/frontend/todo-vuejs/
6384skaffold run --default-repo localhost:32000
6485
65- chown -R $INSTALLUSER :$INSTALLUSER /home/$INSTALLUSER /bigbitbus-kat-main /
86+ chown -R $INSTALLUSER :$INSTALLUSER /home/$INSTALLUSER /$RELEASEDIRNAME /
6687cd /home/$INSTALLUSER
67- rm bigbitbus-kat-main .zip
88+ rm $RELEASENAME .zip
6889# Print what was deployed for later debugging
6990kubectl get all --all-namespaces
7091echo " Ended BigBitBus Kubernetes Automation Toolkit (KAT) application installation script"
0 commit comments