Skip to content

Commit

Permalink
redid for new domain name and third trial
Browse files Browse the repository at this point in the history
  • Loading branch information
dmastrop committed Jun 14, 2023
1 parent 9c4b539 commit 4791e48
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 25 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/deploy1_multi-k8s-take3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Deploy MultiK8s
on:
workflow_run:
workflows: Frontend unit tests
branches: [master]
types: completed

env:
SHA: $(git rev-parse HEAD)

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Test
run: |-
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t dave123456789/react-test -f ./client/Dockerfile.dev ./client
docker run -e CI=true dave123456789/react-test npm test
- name: Set Service Key
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

- name: Set Project
uses: google-github-actions/setup-gcloud@v0
with:
#project_id: multi-k8s-take2
project_id: multi-k8s-take3
- name: Auth
run: |-
gcloud --quiet auth configure-docker
- name: Get Credentials
uses: google-github-actions/get-gke-credentials@v0
with:
#cluster_name: multi-cluster1
cluster_name: multi-cluster3
location: us-west2-a

- name: Build
# use unique naming for builds here so that I don't overwrite the elastic beanstalk 10-14 images
# note that no nginx images needed because routing done via ingress-service.yaml with K8s and ingress-nginx added separately to GKE
run: |-
# docker build -t dave123456789/multi-client-k8s-gh_take2:latest -t dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }} -f ./client/Dockerfile ./client
# docker build -t dave123456789/multi-server-k8s-pgfix-gh_take2:latest -t dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }} -f ./server/Dockerfile ./server
# docker build -t dave123456789/multi-worker-k8s-gh_take2:latest -t dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }} -f ./worker/Dockerfile ./worker

docker build -t dave123456789/multi-client-k8s-gh_take3:latest -t dave123456789/multi-client-k8s-gh_take3:${{ env.SHA }} -f ./client/Dockerfile ./client
docker build -t dave123456789/multi-server-k8s-pgfix-gh_take3:latest -t dave123456789/multi-server-k8s-pgfix-gh_take3:${{ env.SHA }} -f ./server/Dockerfile ./server
docker build -t dave123456789/multi-worker-k8s-gh_take3:latest -t dave123456789/multi-worker-k8s-gh_take3:${{ env.SHA }} -f ./worker/Dockerfile ./worker

- name: Push
# lastest is pushed because if someone runs kubectl apply -f k8s from build directory we want to insure they load current latest (this image)
run: |-
# docker push dave123456789/multi-client-k8s-gh_take2:latest
# docker push dave123456789/multi-server-k8s-pgfix-gh_take2:latest
# docker push dave123456789/multi-worker-k8s-gh_take2:latest
#
# docker push dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }}
# docker push dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }}
# docker push dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }}

docker push dave123456789/multi-client-k8s-gh_take3:latest
docker push dave123456789/multi-server-k8s-pgfix-gh_take3:latest
docker push dave123456789/multi-worker-k8s-gh_take3:latest

docker push dave123456789/multi-client-k8s-gh_take3:${{ env.SHA }}
docker push dave123456789/multi-server-k8s-pgfix-gh_take3:${{ env.SHA }}
docker push dave123456789/multi-worker-k8s-gh_take3:${{ env.SHA }}

- name: Apply
run: |-
kubectl apply -f k8s
# kubectl set image deployments/server-deployment server=dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }}
# kubectl set image deployments/client-deployment client=dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }}
# kubectl set image deployments/worker-deployment worker=dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }}

kubectl set image deployments/server-deployment server=dave123456789/multi-server-k8s-pgfix-gh_take3:${{ env.SHA }}
kubectl set image deployments/client-deployment client=dave123456789/multi-client-k8s-gh_take3:${{ env.SHA }}
kubectl set image deployments/worker-deployment worker=dave123456789/multi-worker-k8s-gh_take3:${{ env.SHA }}

15 changes: 10 additions & 5 deletions k8s/certficate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ apiVersion: cert-manager.io/v1

kind: Certificate
metadata:
name: holinessinloveofchrist-com-tls
#name: holinessinloveofchrist-com-tls
name: cloudnetworktesting-com-tls
spec:
secretName: holinessinloveofchrist-com
#secretName: holinessinloveofchrist-com
secretName: cloudnetworktesting-com
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
commonName: holinessinloveofchrist.com
#commonName: holinessinloveofchrist.com
commonName: cloudnetworktesting.com
dnsNames:
- holinessinloveofchrist.com
- www.holinessinloveofchrist.com
#- holinessinloveofchrist.com
#- www.holinessinloveofchrist.com
- cloudnetworktesting.com
- www.cloudnetworktesting.com
15 changes: 10 additions & 5 deletions k8s/ingress-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ spec:
# added:
tls:
- hosts:
- holinessinloveofchrist.com
- www.holinessinloveofchrist.com
secretName: holinessinloveofchrist-com
#- holinessinloveofchrist.com
#- www.holinessinloveofchrist.com
- cloudnetworktesting.com
- www.cloudnetworktesting.com
#secretName: holinessinloveofchrist-com
secretName: cloudneworktesting-com
rules:
# added host: and everything needs to indent:
- host: holinessinloveofchrist.com
#- host: holinessinloveofchrist.com
- host: cloudnetworktesting.com
http:
paths:
- path: /?(.*)
Expand All @@ -40,7 +44,8 @@ spec:
port:
number: 5000
# added host and everything else needs to indent:
- host: www.holinessinloveofchrist.com
#- host: www.holinessinloveofchrist.com
- host: www.cloudnetworktesting.com
http:
paths:
- path: /?(.*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,58 @@ jobs:
- name: Set Project
uses: google-github-actions/setup-gcloud@v0
with:
project_id: multi-k8s-take2

#project_id: multi-k8s-take2
project_id: multi-k8s-take3
- name: Auth
run: |-
gcloud --quiet auth configure-docker
- name: Get Credentials
uses: google-github-actions/get-gke-credentials@v0
with:
cluster_name: multi-cluster1
#cluster_name: multi-cluster1
cluster_name: multi-cluster3
location: us-west2-a

- name: Build
# use unique naming for builds here so that I don't overwrite the elastic beanstalk 10-14 images
# note that no nginx images needed because routing done via ingress-service.yaml with K8s and ingress-nginx added separately to GKE
run: |-
docker build -t dave123456789/multi-client-k8s-gh_take2:latest -t dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }} -f ./client/Dockerfile ./client
docker build -t dave123456789/multi-server-k8s-pgfix-gh_take2:latest -t dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }} -f ./server/Dockerfile ./server
docker build -t dave123456789/multi-worker-k8s-gh_take2:latest -t dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }} -f ./worker/Dockerfile ./worker
# docker build -t dave123456789/multi-client-k8s-gh_take2:latest -t dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }} -f ./client/Dockerfile ./client
# docker build -t dave123456789/multi-server-k8s-pgfix-gh_take2:latest -t dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }} -f ./server/Dockerfile ./server
# docker build -t dave123456789/multi-worker-k8s-gh_take2:latest -t dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }} -f ./worker/Dockerfile ./worker

docker build -t dave123456789/multi-client-k8s-gh_take3:latest -t dave123456789/multi-client-k8s-gh_take3:${{ env.SHA }} -f ./client/Dockerfile ./client
docker build -t dave123456789/multi-server-k8s-pgfix-gh_take3:latest -t dave123456789/multi-server-k8s-pgfix-gh_take3:${{ env.SHA }} -f ./server/Dockerfile ./server
docker build -t dave123456789/multi-worker-k8s-gh_take3:latest -t dave123456789/multi-worker-k8s-gh_take3:${{ env.SHA }} -f ./worker/Dockerfile ./worker

- name: Push
# lastest is pushed because if someone runs kubectl apply -f k8s from build directory we want to insure they load current latest (this image)
run: |-
docker push dave123456789/multi-client-k8s-gh_take2:latest
docker push dave123456789/multi-server-k8s-pgfix-gh_take2:latest
docker push dave123456789/multi-worker-k8s-gh_take2:latest
# docker push dave123456789/multi-client-k8s-gh_take2:latest
# docker push dave123456789/multi-server-k8s-pgfix-gh_take2:latest
# docker push dave123456789/multi-worker-k8s-gh_take2:latest
#
# docker push dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }}
# docker push dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }}
# docker push dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }}

docker push dave123456789/multi-client-k8s-gh_take3:latest
docker push dave123456789/multi-server-k8s-pgfix-gh_take3:latest
docker push dave123456789/multi-worker-k8s-gh_take3:latest

docker push dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }}
docker push dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }}
docker push dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }}
docker push dave123456789/multi-client-k8s-gh_take3:${{ env.SHA }}
docker push dave123456789/multi-server-k8s-pgfix-gh_take3:${{ env.SHA }}
docker push dave123456789/multi-worker-k8s-gh_take3:${{ env.SHA }}

- name: Apply
run: |-
kubectl apply -f k8s
kubectl set image deployments/server-deployment server=dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }}
kubectl set image deployments/client-deployment client=dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }}
kubectl set image deployments/worker-deployment worker=dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }}
# kubectl set image deployments/server-deployment server=dave123456789/multi-server-k8s-pgfix-gh_take2:${{ env.SHA }}
# kubectl set image deployments/client-deployment client=dave123456789/multi-client-k8s-gh_take2:${{ env.SHA }}
# kubectl set image deployments/worker-deployment worker=dave123456789/multi-worker-k8s-gh_take2:${{ env.SHA }}

kubectl set image deployments/server-deployment server=dave123456789/multi-server-k8s-pgfix-gh_take3:${{ env.SHA }}
kubectl set image deployments/client-deployment client=dave123456789/multi-client-k8s-gh_take3:${{ env.SHA }}
kubectl set image deployments/worker-deployment worker=dave123456789/multi-worker-k8s-gh_take3:${{ env.SHA }}

0 comments on commit 4791e48

Please sign in to comment.