Skip to content

Commit

Permalink
Merge pull request #48 from KNPhilip/deployment
Browse files Browse the repository at this point in the history
Deployment
  • Loading branch information
KNPhilip authored Mar 15, 2024
2 parents d008cd5 + 631dd04 commit 0781698
Show file tree
Hide file tree
Showing 18 changed files with 389 additions and 49 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/apply-k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Apply Kubernetes

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'infrastructure/**'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save bidwheels
- name: Apply Kubernetes manifests
run: kubectl apply -f infrastructure/K8S && kubectl apply -f infrastructure/prod-k8s
11 changes: 10 additions & 1 deletion .github/workflows/deploy-auction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
env:
REGISTRY_IMAGE: knphilip/bidwheels-auction-svc
DOCKERFILE: src/AuctionService/Dockerfile
DEPLOYMENT_NAME: auction-svc

jobs:
build:
Expand All @@ -23,4 +24,12 @@ jobs:
tags: ${{ env.REGISTRY_IMAGE }}:latest
file: ${{ env.DOCKERFILE }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save bidwheels
- name: Restart Kubernetes deployment
run: kubectl rollout restart deployment ${{ secrets.DEPLOYMENT_NAME }}
35 changes: 35 additions & 0 deletions .github/workflows/deploy-bid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy Bidding Service

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'src/BiddingService/**'

env:
REGISTRY_IMAGE: knphilip/bidwheels-bid-svc
DOCKERFILE: src/BiddingService/Dockerfile
DEPLOYMENT_NAME: bid-svc

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build and push the Docker image
uses: knphilip/actions/dockerfile-push@main
with:
context: "{{defaultContext}}"
tags: ${{ env.REGISTRY_IMAGE }}:latest
file: ${{ env.DOCKERFILE }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save bidwheels
- name: Restart Kubernetes deployment
run: kubectl rollout restart deployment ${{ secrets.DEPLOYMENT_NAME }}
35 changes: 35 additions & 0 deletions .github/workflows/deploy-gateway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy Gateway Service

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'src/GatewayService/**'

env:
REGISTRY_IMAGE: knphilip/bidwheels-gateway-svc
DOCKERFILE: src/GatewayService/Dockerfile
DEPLOYMENT_NAME: gateway-svc

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build and push the Docker image
uses: knphilip/actions/dockerfile-push@main
with:
context: "{{defaultContext}}"
tags: ${{ env.REGISTRY_IMAGE }}:latest
file: ${{ env.DOCKERFILE }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save bidwheels
- name: Restart Kubernetes deployment
run: kubectl rollout restart deployment ${{ secrets.DEPLOYMENT_NAME }}
35 changes: 35 additions & 0 deletions .github/workflows/deploy-notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy Notification Service

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'src/NotificationService/**'

env:
REGISTRY_IMAGE: knphilip/bidwheels-notify-svc
DOCKERFILE: src/NotificationService/Dockerfile
DEPLOYMENT_NAME: notify-svc

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build and push the Docker image
uses: knphilip/actions/dockerfile-push@main
with:
context: "{{defaultContext}}"
tags: ${{ env.REGISTRY_IMAGE }}:latest
file: ${{ env.DOCKERFILE }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save bidwheels
- name: Restart Kubernetes deployment
run: kubectl rollout restart deployment ${{ secrets.DEPLOYMENT_NAME }}
35 changes: 35 additions & 0 deletions .github/workflows/deploy-search.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy Search Service

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'src/SearchService/**'

env:
REGISTRY_IMAGE: knphilip/bidwheels-search-svc
DOCKERFILE: src/SearchService/Dockerfile
DEPLOYMENT_NAME: search-svc

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build and push the Docker image
uses: knphilip/actions/dockerfile-push@main
with:
context: "{{defaultContext}}"
tags: ${{ env.REGISTRY_IMAGE }}:latest
file: ${{ env.DOCKERFILE }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save bidwheels
- name: Restart Kubernetes deployment
run: kubectl rollout restart deployment ${{ secrets.DEPLOYMENT_NAME }}
35 changes: 35 additions & 0 deletions .github/workflows/deploy-webapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy Web Application

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'frontend/web-app/**'

env:
REGISTRY_IMAGE: knphilip/bidwheels-web-app
DOCKERFILE: frontend/web-app/Dockerfile
DEPLOYMENT_NAME: webapp

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build and push the Docker image
uses: knphilip/actions/dockerfile-push@main
with:
context: "{{defaultContext}}"
tags: ${{ env.REGISTRY_IMAGE }}:latest
file: ${{ env.DOCKERFILE }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save bidwheels
- name: Restart Kubernetes deployment
run: kubectl rollout restart deployment ${{ secrets.DEPLOYMENT_NAME }}
13 changes: 13 additions & 0 deletions .idea/.idea.BidWheels/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.BidWheels/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.BidWheels/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions infrastructure/K8S/mongo-depl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,3 @@ spec:
ports:
- port: 27017
targetPort: 27017
---
apiVersion: v1
kind: Service
metadata:
name: mongo-lb
spec:
type: LoadBalancer
selector:
app: mongo
ports:
- port: 27017
targetPort: 27017
12 changes: 0 additions & 12 deletions infrastructure/K8S/postgres-depl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,3 @@ spec:
ports:
- port: 5432
targetPort: 5432
---
apiVersion: v1
kind: Service
metadata:
name: postgres-lb
spec:
type: LoadBalancer
selector:
app: postgres
ports:
- port: 5432
targetPort: 5432
12 changes: 0 additions & 12 deletions infrastructure/K8S/rabbitmq-depl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,4 @@ spec:
ports:
- port: 5672
targetPort: 5672
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq-lb
spec:
type: LoadBalancer
selector:
app: rabbitmq
ports:
- port: 15672
targetPort: 15672

12 changes: 0 additions & 12 deletions infrastructure/K8S/webapp-depl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,3 @@ spec:
ports:
- port: 3000
targetPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: webapp-lb
spec:
type: LoadBalancer
selector:
app: webapp
ports:
- port: 3000
targetPort: 3000
File renamed without changes.
47 changes: 47 additions & 0 deletions infrastructure/dev-k8s/local-lbs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: v1
kind: Service
metadata:
name: postgres-lb
spec:
type: LoadBalancer
selector:
app: postgres
ports:
- port: 5432
targetPort: 5432
---
apiVersion: v1
kind: Service
metadata:
name: rabbitmq-lb
spec:
type: LoadBalancer
selector:
app: rabbitmq
ports:
- port: 15672
targetPort: 15672
---
apiVersion: v1
kind: Service
metadata:
name: webapp-lb
spec:
type: LoadBalancer
selector:
app: webapp
ports:
- port: 3000
targetPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: mongo-lb
spec:
type: LoadBalancer
selector:
app: mongo
ports:
- port: 27017
targetPort: 27017
Loading

0 comments on commit 0781698

Please sign in to comment.