Skip to content

Commit 39e7fe7

Browse files
committed
feature/implemented-release-scripts
Implementing a system for the install scripts pulling down the right version
1 parent 4dc9747 commit 39e7fe7

File tree

2 files changed

+43
-15
lines changed

2 files changed

+43
-15
lines changed

code/local-kubernetes-cluster-installation/install-application-stack.sh

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,33 @@
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
1727
echo "Starting BigBitBus Kubernetes Automation Toolkit (KAT) cluster application installations"
1828

1929
if [ ! -z $1 ]
2030
then
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
2243
else
2344
export INSTALLUSER=$(ls /home/* -d | head -n 1 | cut -d/ -f3)
2445
fi
@@ -27,44 +48,44 @@ export KUBECONFIG=/home/$INSTALLUSER/.kube/config
2748
kubectl config set-context microk8s
2849
cd /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/
3859
helm repo add bitnami https://charts.bitnami.com/bitnami
3960
helm repo update
4061
helm 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/
4465
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
4566
helm repo add stable https://charts.helm.sh/stable
4667
helm repo update
4768
helm 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/
5172
helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
5273
helm repo update
5374
helm upgrade --install k8sdashboard kubernetes-dashboard/kubernetes-dashboard -f ./dashboard-values.yaml --namespace dashboard --create-namespace
5475

5576
# Backend
5677
kubectl 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/
5879
skaffold run --default-repo localhost:32000
5980

6081
# Frontend
6182
kubectl 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/
6384
skaffold run --default-repo localhost:32000
6485

65-
chown -R $INSTALLUSER:$INSTALLUSER /home/$INSTALLUSER/bigbitbus-kat-main/
86+
chown -R $INSTALLUSER:$INSTALLUSER /home/$INSTALLUSER/$RELEASEDIRNAME/
6687
cd /home/$INSTALLUSER
67-
rm bigbitbus-kat-main.zip
88+
rm $RELEASENAME.zip
6889
# Print what was deployed for later debugging
6990
kubectl get all --all-namespaces
7091
echo "Ended BigBitBus Kubernetes Automation Toolkit (KAT) application installation script"

code/local-kubernetes-cluster-installation/install-microk8s-on-ubuntu.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@
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 KUBERNETES VERSION
20+
# $2 is the USER for whom to install this.
21+
22+
DEFAULTKUBERNETESVERSION="1.19"
23+
date
1724
echo "Starting BigBitBus Kubernetes Automation Toolkit (KAT) Microk8s installation script"
1825
if [ ! -z $1 ]
1926
then
2027
export KUBEVERSION=$1
2128
else
22-
export KUBEVERSION="1.19"
29+
export KUBEVERSION=$DEFAULTKUBERNETESVERSION
2330
fi
2431

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

4451
# Note - we pegged the Kubernetes version here
4552
snap install microk8s --classic --channel=1.19
46-
snap install docker --channel=19.03
53+
snap install --stable docker
4754
snap install kubectl --classic --channel=1.19
48-
snap install helm --classic --channel=3.4.2
55+
snap install helm --classic --channel=3.4
4956
sleep 60 # Sometimes microk8s needs time to stabilize
5057
cd /tmp
5158
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \

0 commit comments

Comments
 (0)