Skip to content

Commit 7799bfb

Browse files
authored
Merge pull request #68 from CS3219-AY2425S1/PEER-242-Cloud-Deployment
PEER-242: Add Gcloud Deployment
2 parents 49987c6 + 9ef94b2 commit 7799bfb

22 files changed

+307
-20
lines changed

.github/workflows/build-docker.yaml renamed to .github/workflows/build-deploy-docker.yaml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
echo "Outputs Generated: $formatted_matrix"
106106
echo "matrix=$formatted_matrix" >> $GITHUB_OUTPUT
107107
108-
build-and-push-image:
108+
build-push-deploy-image:
109109
needs: changes
110110
if: ${{ fromJson(needs.changes.outputs.matrix)[0] != null }}
111111
runs-on: ubuntu-latest
@@ -186,14 +186,38 @@ jobs:
186186
cache-from: type=gha
187187
cache-to: type=gha,mode=max
188188

189+
- name: Setup GCloud
190+
uses: google-github-actions/setup-gcloud@v2
191+
if: ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' && env.IS_GKE_CLUSTER_UP }}
192+
with:
193+
service_account_key: ${{ secrets.GKE_SA_KEY }}
194+
project_id: ${{ secrets.GKE_PROJECT }}
195+
196+
- name: Get GKE creds
197+
uses: google-github-actions/get-gke-credentials@v2
198+
if: ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' && env.IS_GKE_CLUSTER_UP }}
199+
with:
200+
cluster_name: ${{ secrets.GKE_CLUSTER }}
201+
location: ${{ secrets.GKE_ZONE }}
202+
credentials: ${{ secrets.GKE_SA_KEY }}
203+
204+
- name: Deploy to GKE
205+
if: ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' && env.IS_GKE_CLUSTER_UP }}
206+
run: |-
207+
deployments=("collab-service" "matching-service" "question-service" "user-service" "frontend")
208+
for dplymnt in "${deployments[@]}"; do
209+
kubectl -n peerprep rollout restart deployment "$dplymnt"
210+
done
211+
212+
189213
results:
190214
if: ${{ always() && !github.event.pull_request.draft }}
191215
runs-on: ubuntu-latest
192216
name: Final Results
193-
needs: build-and-push-image
217+
needs: build-push-deploy-image
194218
steps:
195219
- run: |
196-
result="${{ needs.build-and-push-image.result }}"
220+
result="${{ needs.build-push-deploy-image.result }}"
197221
if [[ $result == "success" || $result == "skipped" ]]; then
198222
exit 0
199223
else

k8s/03-collab-db-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
containerPort: 5432
5757
volumeMounts:
5858
- name: collab-db-vol
59-
mountPath: /data/collab-db
59+
mountPath: /data
6060
volumeClaimTemplates:
6161
- metadata:
6262
name: collab-db-vol

k8s/03-question-db-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
containerPort: 5432
5757
volumeMounts:
5858
- name: question-db-vol
59-
mountPath: /data/question-db
59+
mountPath: /data
6060
volumeClaimTemplates:
6161
- metadata:
6262
name: question-db-vol

k8s/03-user-db-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
containerPort: 5432
5757
volumeMounts:
5858
- name: user-db-vol
59-
mountPath: /data/user-db
59+
mountPath: /data
6060
volumeClaimTemplates:
6161
- metadata:
6262
name: user-db-vol

k8s/04-collab-svc-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
containers:
6565
- name: collab-express
6666
image: ay2425s1cs3219g16/collab-express:latest
67-
imagePullPolicy: IfNotPresent
67+
imagePullPolicy: Always
6868
envFrom:
6969
- secretRef:
7070
name: collaboration-secret

k8s/04-collab-svc-hpa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ spec:
1616
name: cpu
1717
target:
1818
type: Utilization
19-
averageUtilization: 30
19+
averageUtilization: 70

k8s/04-match-svc-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ spec:
7777
containers:
7878
- name: match-express
7979
image: ay2425s1cs3219g16/match-express:latest
80-
imagePullPolicy: IfNotPresent
80+
imagePullPolicy: Always
8181
envFrom:
8282
- secretRef:
8383
name: matching-secret

k8s/04-question-svc-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
containers:
6565
- name: question-express
6666
image: ay2425s1cs3219g16/question-express:latest
67-
imagePullPolicy: IfNotPresent
67+
imagePullPolicy: Always
6868
envFrom:
6969
- secretRef:
7070
name: question-secret

k8s/04-question-svc-hpa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ spec:
1616
name: cpu
1717
target:
1818
type: Utilization
19-
averageUtilization: 30
19+
averageUtilization: 70

k8s/04-user-svc-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
containers:
6565
- name: user-express
6666
image: ay2425s1cs3219g16/user-express:latest
67-
imagePullPolicy: IfNotPresent
67+
imagePullPolicy: Always
6868
envFrom:
6969
- secretRef:
7070
name: user-secret

0 commit comments

Comments
 (0)