Skip to content

Commit 18529eb

Browse files
committed
Added Travis
1 parent 3698534 commit 18529eb

File tree

9 files changed

+230
-7
lines changed

9 files changed

+230
-7
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.travis.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: bash
2+
script: true
3+
sudo: required
4+
before_install:
5+
- bash scripts/install.sh

core/.DS_Store

6 KB
Binary file not shown.

platform-services.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/bin/bash
22
kubectl create -f platform/controller.yaml
33
kubectl create -f platform/couchdb.yaml
4-
kubectl create -f platform/es.yaml
5-
kubectl create -f platform/gateway.yaml
64
kubectl create -f platform/kafka.yaml
7-
kubectl create -f platform/kibana.yaml
8-
kubectl create -f platform/logstash.yaml
95
kubectl create -f platform/redis.yaml
10-
kubectl create -f platform/registry.yaml
6+
kubectl create -f platform/registry.yaml

platform/controller.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ metadata:
55
labels:
66
app: gameon
77
spec:
8+
type: NodePort
89
ports:
910
- port: 8080
1011
protocol: TCP
1112
targetPort: 8080
13+
nodePort: 31200
1214
selector:
1315
app: gameon
1416
tier: controller
@@ -40,4 +42,4 @@ spec:
4042
value: redis://redis:6379
4143
ports:
4244
- containerPort: 8080
43-
name: controller
45+
name: controller

platform/registry.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ metadata:
55
labels:
66
app: gameon
77
spec:
8+
type: NodePort
89
ports:
910
- port: 8080
1011
protocol: TCP
1112
targetPort: 8080
13+
nodePort: 31300
1214
selector:
1315
app: gameon
1416
tier: registry
@@ -38,4 +40,4 @@ spec:
3840
value: redis:6379
3941
ports:
4042
- containerPort: 8080
41-
name: registry
43+
name: registry
File renamed without changes.

sample-rooms/swiftroom.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: swiftroom
5+
labels:
6+
app: gameon
7+
spec:
8+
ports:
9+
- port: 8080
10+
protocol: TCP
11+
targetPort: 8080
12+
selector:
13+
app: gameon
14+
tier: swiftroom
15+
---
16+
apiVersion: extensions/v1beta1
17+
kind: Deployment
18+
metadata:
19+
name: swiftroom
20+
labels:
21+
app: gameon
22+
spec:
23+
strategy:
24+
type: Recreate
25+
template:
26+
metadata:
27+
labels:
28+
app: gameon
29+
tier: swiftroom
30+
spec:
31+
containers:
32+
- image: anthonyamanse/sample-room-swift:3.0
33+
name: swiftroom
34+
ports:
35+
- containerPort: 8080
36+
volumeMounts:
37+
- name: keystore
38+
mountPath: /opt/ibm/wlp/usr/servers/defaultServer/resources/security
39+
volumes:
40+
- name: keystore
41+
persistentVolumeClaim:
42+
claimName: keystore-claim

scripts/install.sh

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#!/bin/sh
2+
3+
function install_bluemix_cli() {
4+
#statements
5+
echo "Installing Bluemix cli"
6+
curl -L "https://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar -zx
7+
sudo mv cf /usr/local/bin
8+
sudo curl -o /usr/share/bash-completion/completions/cf https://raw.githubusercontent.com/cloudfoundry/cli/master/ci/installers/completion/cf
9+
cf --version
10+
curl -L public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/Bluemix_CLI_0.5.1_amd64.tar.gz > Bluemix_CLI.tar.gz
11+
tar -xvf Bluemix_CLI.tar.gz
12+
cd Bluemix_CLI
13+
sudo ./install_bluemix_cli
14+
}
15+
16+
function bluemix_auth() {
17+
echo "Authenticating with Bluemix"
18+
echo "1" | bx login -a https://api.ng.bluemix.net -u $BLUEMIX_USER -p $BLUEMIX_PASS
19+
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
20+
bx plugin install container-service -r Bluemix
21+
echo "Installing kubectl"
22+
chmod +x ./kubectl
23+
sudo mv ./kubectl /usr/local/bin/kubectl
24+
}
25+
26+
function cluster_setup() {
27+
bx cs workers cluster-travis
28+
$(bx cs cluster-config cassandra-demo | grep export)
29+
git clone https://github.com/IBM/kubernetes-container-service-gameon-java-microservices.git
30+
cd kubernetes-container-service-gameon-java-microservices
31+
kubectl delete pvc -l app=gameon
32+
kubectl delete --ignore-not-found=true -f core
33+
kubectl delete --ignore-not-found=true -f platform
34+
kubectl delete --ignore-not-found=true -f setup.yaml
35+
kuber=$(kubectl get pods -l app=gameon)
36+
while [ ${#kuber} -ne 0 ]
37+
do
38+
sleep 5s
39+
kubectl get pods -l app=gameon
40+
kuber=$(kubectl get pods -l app=gameon)
41+
done
42+
kubectl delete --ignore-not-found=true -f local-volume.yaml
43+
}
44+
45+
function initial_setup() {
46+
kubectl create -f local-volume.yaml
47+
sleep 5s
48+
kubectl create -f setup.yaml
49+
echo "Waiting for container to setup"
50+
sleep 15s
51+
52+
keystore=$(kubectl logs setup | grep Import | awk '{print $4}')
53+
TRIES=0
54+
while [ "$keystore" != "104" ]
55+
do
56+
echo "Setting up keystore values..."
57+
keystore=$(kubectl logs setup | grep Import | awk '{print $4}')
58+
if [ "$keystore" = "104" ]
59+
then
60+
echo "Setup successfull"
61+
break
62+
fi
63+
if [ $TRIES -eq 10 ]
64+
then
65+
echo "Failed setting up keystore values."
66+
exit 1
67+
fi
68+
TRIES=$((TRIES+1))
69+
sleep 5s
70+
done
71+
}
72+
73+
function create_platform_services() {
74+
IP=$(kubectl get nodes | grep Ready | awk '{print $1}')
75+
kubectl create -f platform
76+
77+
echo "Waiting for pods to setup"
78+
sleep 10s
79+
PODS=$(kubectl get pods | grep ContainerCreating | grep Pending)
80+
while [ ${#PODS} -ne 0 ]
81+
do
82+
echo "Pods are not yet Running..."
83+
PODS=$(kubectl get pods | grep ContainerCreating | grep Pending)
84+
sleep 5s
85+
done
86+
87+
TRIES=0
88+
while true
89+
do
90+
code=$(curl -w '%{http_code}' http://$IP:31200/health -o /dev/null)
91+
if [ "$code" = "200" ]; then
92+
echo "Controller is up"
93+
break
94+
fi
95+
if [ $TRIES -eq 10 ]
96+
then
97+
echo "Failed setting up controlplane."
98+
exit 1
99+
fi
100+
TRIES=$((TRIES+1))
101+
sleep 5s
102+
done
103+
104+
TRIES=0
105+
while true
106+
do
107+
code=$(curl -w '%{http_code}' http://$IP:31300/uptime -o /dev/null)
108+
if [ "$code" = "200" ]; then
109+
echo "Registry is up"
110+
break
111+
fi
112+
if [ $TRIES -eq 10 ]
113+
then
114+
echo "Failed setting up controlplane."
115+
exit 1
116+
fi
117+
TRIES=$((TRIES+1))
118+
sleep 5s
119+
done
120+
}
121+
122+
function create_core_services() {
123+
IP=$(kubectl get nodes | grep Ready | awk '{print $1}')
124+
125+
sed -i s#169.47.241.213#$IP#g core/*
126+
127+
kubectl create -f core
128+
129+
echo "Waiting for pods to setup"
130+
sleep 10s
131+
PODS=$(kubectl get pods | grep Pending)
132+
while [ ${#PODS} -ne 0 ]
133+
do
134+
echo "Some Pods are Pending..."
135+
PODS=$(kubectl get pods | grep Pending)
136+
sleep 5s
137+
done
138+
139+
PODS=$(kubectl get pods | grep ContainerCreating)
140+
while [ ${#PODS} -ne 0 ]
141+
do
142+
echo "Some Pods are not yet Running..."
143+
PODS=$(kubectl get pods | grep ContainerCreating)
144+
sleep 5s
145+
done
146+
147+
# kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | tail -10
148+
149+
TRIES=0
150+
151+
while true
152+
do
153+
CORE=$(kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | grep UP | awk '{print $8}' | xargs | sed -e s/,//g)
154+
155+
if [ $CORE = "UP UP UP UP UP" ]
156+
then
157+
echo "You can now access your Gameon App at https://$IP:30443"
158+
echo "If you'd like to add social logins, please follow the instructions in the Repository's README"
159+
fi
160+
161+
if [ $TRIES -eq 60 ]
162+
then
163+
echo "Failed to setup core services."
164+
echo "Printing running services detected by proxy:"
165+
kubectl logs $(kubectl get pods | grep proxy | awk '{print $1}') | grep UP | awk '{print $6}'
166+
exit 1
167+
fi
168+
sleep 10s
169+
}
170+
171+
172+
install_bluemix_cli
173+
bluemix_auth
174+
initial_setup
175+
create_platform_services
176+
create_core_services

0 commit comments

Comments
 (0)