From d74d9d54b8f0fc6dda0de5a7ed8ddc9a107d9f8f Mon Sep 17 00:00:00 2001 From: Jesus Mendoza Date: Wed, 20 Jan 2021 16:42:39 -0600 Subject: [PATCH 1/5] Auth deployment example --- .github/workflows/auth-deployment.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/auth-deployment.yaml diff --git a/.github/workflows/auth-deployment.yaml b/.github/workflows/auth-deployment.yaml new file mode 100644 index 0000000..d6e8e53 --- /dev/null +++ b/.github/workflows/auth-deployment.yaml @@ -0,0 +1,20 @@ +# name: auth-deployment + +# on: +# push: +# branches: +# - master +# paths: +# - "auth/**" + +# jobs: +# build: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - run: cd auth && docker build . -t jesusz0r/auth +# - run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD +# env: +# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} +# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} +# - run: docker push jesusz0r/auth From 102562959567859a3caddb219c8a7af98d46609b Mon Sep 17 00:00:00 2001 From: Jesus Mendoza Date: Wed, 20 Jan 2021 17:00:17 -0600 Subject: [PATCH 2/5] Set up deployment to digital ocean example --- .github/workflows/auth-deployment.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/auth-deployment.yaml b/.github/workflows/auth-deployment.yaml index d6e8e53..aaa8e29 100644 --- a/.github/workflows/auth-deployment.yaml +++ b/.github/workflows/auth-deployment.yaml @@ -18,3 +18,10 @@ # DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} # DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} # - run: docker push jesusz0r/auth +# - uses: digitalocean/action-doctl@v2 +# with: +# token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} +# - run: doctl kubernetes cluster kubeconfig save $DIGITAL_OCEAN_KUBERNETES_CLUSTER +# env: +# DIGITAL_OCEAN_KUBERNETES_CLUSTER: ${{ secrets.DIGITAL_OCEAN_KUBERNETES_CLUSTER }} +# - run: kubectl rollout restart deployment auth-deployment From 04879c87ef55051b52f3ed32f686973dd5b8d1af Mon Sep 17 00:00:00 2001 From: Jesus Mendoza Date: Wed, 20 Jan 2021 17:21:46 -0600 Subject: [PATCH 3/5] Deploy manifest example --- .github/workflows/deploy-manifest.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/deploy-manifest.yaml diff --git a/.github/workflows/deploy-manifest.yaml b/.github/workflows/deploy-manifest.yaml new file mode 100644 index 0000000..7089be2 --- /dev/null +++ b/.github/workflows/deploy-manifest.yaml @@ -0,0 +1,21 @@ +# name: deploy-manifest + +# on: +# push: +# branches: +# - master +# paths: +# - "infra/**" + +# jobs: +# build: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - uses: digitalocean/action-doctl@v2 +# with: +# token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} +# - run: doctl kubernetes cluster kubeconfig save $DIGITAL_OCEAN_KUBERNETES_CLUSTER +# env: +# DIGITAL_OCEAN_KUBERNETES_CLUSTER: ${{ secrets.DIGITAL_OCEAN_KUBERNETES_CLUSTER }} +# - run: kubectl apply -f infra/k8s -f infra/k8s-prod From ae00b6e559f436f2cfdeb08a6988730800d7124b Mon Sep 17 00:00:00 2001 From: Jesus Mendoza Date: Wed, 20 Jan 2021 17:22:12 -0600 Subject: [PATCH 4/5] Move ingress configuration to dev and prod environments --- infra/{k8s => k8s-dev}/ingress-srv.yaml | 0 infra/k8s-prod/ingress-srv.yaml | 32 +++++++++++++++++++++++++ skaffold.yaml | 1 + 3 files changed, 33 insertions(+) rename infra/{k8s => k8s-dev}/ingress-srv.yaml (100%) create mode 100644 infra/k8s-prod/ingress-srv.yaml diff --git a/infra/k8s/ingress-srv.yaml b/infra/k8s-dev/ingress-srv.yaml similarity index 100% rename from infra/k8s/ingress-srv.yaml rename to infra/k8s-dev/ingress-srv.yaml diff --git a/infra/k8s-prod/ingress-srv.yaml b/infra/k8s-prod/ingress-srv.yaml new file mode 100644 index 0000000..d88b6f7 --- /dev/null +++ b/infra/k8s-prod/ingress-srv.yaml @@ -0,0 +1,32 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ingress-service + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/use-regex: "true" +spec: + rules: + - host: local.ticketing.com + http: + paths: + - path: /api/users/?(.*) + backend: + serviceName: auth-service + servicePort: 8000 + - path: /api/tickets/?(.*) + backend: + serviceName: tickets-service + servicePort: 8000 + - path: /api/orders/?(.*) + backend: + serviceName: orders-service + servicePort: 8000 + - path: /api/payments/?(.*) + backend: + serviceName: payments-service + servicePort: 8000 + - path: /?(.*) + backend: + serviceName: client-service + servicePort: 3000 diff --git a/skaffold.yaml b/skaffold.yaml index 813c592..ec9d590 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -4,6 +4,7 @@ deploy: kubectl: manifests: - ./infra/k8s/* + - ./infra/k8s-dev/* build: local: push: false From b0af88a618cec10f841b216685112573549e3fcf Mon Sep 17 00:00:00 2001 From: Jesus Mendoza Date: Wed, 20 Jan 2021 18:33:30 -0600 Subject: [PATCH 5/5] Add a readme to setup digital ocean deployment --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7de1a5d --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +## How to setup DigitalOcean Kubernetes Cluster + + - Go to DigitalOcean and create the cluster. + - Install doctl https://github.com/digitalocean/doctl into our local machine. + - Authenticate using doctl auth init + - doctl kubernetes + - Change context to our DigitalOcean cluster context + - Setup ingress-nginx, create secrets, etc. \ No newline at end of file