Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing first deployment #36

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
24 changes: 15 additions & 9 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,32 @@ jobs:
run: |-
docker build \
--tag "eu.gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA" \
--tag "eu.gcr.io/$PROJECT_ID/$IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
.

# Push the Docker image to Google Container Registry
- name: Publish
run: |-
docker push "eu.gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA"
docker push "eu.gcr.io/$PROJECT_ID/$IMAGE" --all-tags

#another build
# # Set up kustomize
- name: Rollout with kubectl
working-directory: sharecare-user
run: |-
kubectl apply -f user-conf.yml
kubectl rollout status deployment/$DEPLOYMENT_NAME

##another build
# # # Set up kustomize
# - name: Set up Kustomize
# run: |-
# curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
# chmod u+x ./kustomize
# ./kustomize edit set image eu.gcr.io/$PROJECT_ID/IMAGE:TAG=eu.gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA
# ./kustomize build . | kubectl apply -f user-conf.yml
# kubectl rollout status deployment/$DEPLOYMENT_NAME
# kubectl get services -o wide

# # Deploy the Docker image to the GKE cluster
# - name: Deploy
# run: |-
# ./kustomize edit set image gcr.io/PROJECT_ID/IMAGE:TAG=gcr.io/$PROJECT_ID/$IMAGE:$GITHUB_SHA
# ./kustomize build . | kubectl apply -f -
# kubectl rollout status deployment/$DEPLOYMENT_NAME
# kubectl get services -o wide

1 change: 1 addition & 0 deletions sharecare-user/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ const port = process.env.PORT || "3000";

app.listen(port, () => {
console.log(`Server Running at ${port} 🚀`);
console.log('Hello world')
});
160 changes: 160 additions & 0 deletions sharecare-user/user-conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
### Charity API
apiVersion: apps/v1
kind: Deployment
metadata:
name: sharecare-user
labels:
app: user-api
spec:
replicas: 2
selector:
matchLabels:
app: user-api
template:
metadata:
labels:
app: user-api
spec:
containers:
- name: user-api
image: eu.gcr.io/lloyds-hackathon-team-1/sharecare-user:latest
env:
- name: DATABASE_HOST
value: "35.195.26.117"
- name: DATABASE_PORT
value: "5432"
- name: DATABASE_NAME
value: "user"
- name: DATABASE_USERNAME
value: "postgres"
- name: DATABASE_PASSWORD
value: "hackPassword1!"
ports:
- containerPort: 3000
readinessProbe:
initialDelaySeconds: 1
periodSeconds: 2
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 1
httpGet:
host:
scheme: HTTP
path: /users
port: 3000
---
apiVersion: v1
kind: Service
metadata:
name: user-api-service
spec:
type: NodePort #gives us an external IP address
selector:
app: user-api
ports:
- protocol: TCP
port: 80
targetPort: 3000



# ### Charity API
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: sharecare-charity
# labels:
# app: charity-api
# spec:
# replicas: 2
# selector:
# matchLabels:
# app: charity-api
# template:
# metadata:
# labels:
# app: charity-api
# spec:
# containers:
# - name: charity-api
# image: eu.gcr.io/lloyds-hackathon-team-1/sharecare-charity:latest
# env:
# - name: DATABASE_HOST
# value: "35.195.26.117"
# - name: DATABASE_PORT
# value: "5432"
# - name: DATABASE_NAME
# value: "charity"
# - name: DATABASE_USERNAME
# value: "postgres"
# - name: DATABASE_PASSWORD
# value: "hackPassword1!"
# ports:
# - containerPort: 3000
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: charity-api-service
# annotations:
# cloud.google.com/neg: '{"ingress": true}'
# spec:
# type: NodePort #gives us an external IP address
# selector:
# app: charity-api
# ports:
# - protocol: TCP
# port: 80
# targetPort: 3000




# ### User API
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: sharecare-user
# labels:
# app: user-api
# spec:
# replicas: 2
# selector:
# matchLabels:
# app: user-api
# template:
# metadata:
# labels:
# app: user-api
# spec:
# containers:
# - name: user-api
# image: eu.gcr.io/lloyds-hackathon-team-1/sharecare-user:latest
# env:
# - name: DATABASE_HOST
# value: "35.195.26.117"
# - name: DATABASE_PORT
# value: "5432"
# - name: DATABASE_NAME
# value: "user"
# - name: DATABASE_USERNAME
# value: "postgres"
# - name: DATABASE_PASSWORD
# value: "hackPassword1!"
# ports:
# - containerPort: 3000
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: user-api-service
# annotations:
# cloud.google.com/neg: '{"ingress": true}' # sets this services a NEG
# spec:
# type: NodePort
# selector:
# app: user-api
# ports:
# - protocol: TCP
# port: 80
# targetPort: 3000