Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feature/add-swagger-ro…
Browse files Browse the repository at this point in the history
…utes
  • Loading branch information
Anatole-Godard committed Jul 8, 2024
2 parents 084f8ba + 878f374 commit 49faf73
Show file tree
Hide file tree
Showing 44 changed files with 288 additions and 117 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/basket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,16 @@ jobs:
context: ./services/
file: ./services/basket/Dockerfile
push: true
tags: floriaaan/goodfood-basket:latest
tags: floriaaan/basket-service:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying basket
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment basket-service
14 changes: 13 additions & 1 deletion .github/workflows/delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [delivery]
pull_request:
branches: [main]
branches: [dev, main]

jobs:
build:
Expand Down Expand Up @@ -80,3 +80,15 @@ jobs:
file: ./services/delivery/Dockerfile
push: true
tags: floriaaan/goodfood-delivery:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat "${{ secrets.KUBECONFIG }}" > /tmp/kubeconfig
- name: Deploying delivery
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment delivery-service
14 changes: 13 additions & 1 deletion .github/workflows/gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [gateway]
pull_request:
branches: [main]
branches: [dev, main]

jobs:
build:
Expand Down Expand Up @@ -85,3 +85,15 @@ jobs:
file: ./services/gateway/Dockerfile
push: true
tags: floriaaan/goodfood-gateway:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying gateway
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment gateway
12 changes: 12 additions & 0 deletions .github/workflows/log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ jobs:
file: ./services/log/Dockerfile
push: true
tags: floriaaan/goodfood-log:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying log
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment log-service
14 changes: 13 additions & 1 deletion .github/workflows/notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,16 @@ jobs:
context: ./services/
file: ./services/notification/Dockerfile
push: true
tags: floriaaan/goodfood-notification:latest
tags: floriaaan/goodfood-notification:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying notifications
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment notifications-service
12 changes: 12 additions & 0 deletions .github/workflows/order.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,15 @@ jobs:
file: ./services/order/Dockerfile
push: true
tags: floriaaan/goodfood-order:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying order
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment order-service
14 changes: 13 additions & 1 deletion .github/workflows/payment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,16 @@ jobs:
context: ./services/
file: ./services/payment/Dockerfile
push: true
tags: floriaaan/goodfood-payment:latest
tags: floriaaan/goodfood-payment:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying payment
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment payment-service
27 changes: 25 additions & 2 deletions .github/workflows/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [product-service]
pull_request:
branches: [main]
branches: [main, dev]

jobs:
build:
Expand Down Expand Up @@ -80,4 +80,27 @@ jobs:
context: ./services/
file: ./services/product/Dockerfile
push: true
tags: floriaaan/goodfood-product:latest
tags: floriaaan/goodfood-product:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.20.3
- name: Install Podman
run: sudo apt-get -y install podman
- name: Install Kind
run: go install sigs.k8s.io/[email protected]
- name: Setup Cluster Authentication
env:
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG }}
run: |
echo "$KUBECONFIG_DATA" | base64 --decode > /tmp/kubeconfig
- name: Deploying product
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment product-service
14 changes: 13 additions & 1 deletion .github/workflows/promotions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,16 @@ jobs:
context: ./services/
file: ./services/promotions/Dockerfile
push: true
tags: floriaaan/goodfood-promotions:latest
tags: floriaaan/goodfood-promotions:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying promotions
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment promotions-service
12 changes: 12 additions & 0 deletions .github/workflows/reporting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,15 @@ jobs:
file: ./services/reporting/Dockerfile
push: true
tags: floriaaan/goodfood-reporting:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying reporting
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment reporting-service
14 changes: 13 additions & 1 deletion .github/workflows/restaurant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,16 @@ jobs:
context: ./services/
file: ./services/restaurant/Dockerfile
push: true
tags: floriaaan/goodfood-restaurant:latest
tags: floriaaan/goodfood-restaurant:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying restaurant
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment restaurant-service
16 changes: 14 additions & 2 deletions .github/workflows/stock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ stock ]
pull_request:
branches: [ main ]
branches: [ dev, main ]

jobs:
build:
Expand Down Expand Up @@ -79,4 +79,16 @@ jobs:
context: ./services/
file: ./services/stock/Dockerfile
push: true
tags: floriaaan/goodfood-stock:latest
tags: floriaaan/goodfood-stock:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying stock
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment stock-service
12 changes: 12 additions & 0 deletions .github/workflows/user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ jobs:
file: ./services/user/Dockerfile
push: true
tags: floriaaan/goodfood-user:latest

deploy:
runs-on: ubuntu-latest
needs: [build, test, publish]

steps:
- name: Install Kubectl
uses: azure/setup-kubectl@v3
- name: Setup Cluster Authentication
run: cat ${{ secrets.KUBECONFIG }} > /tmp/kubeconfig
- name: Deploying user
run: kubectl --kubeconfig=/tmp/kubeconfig rollout restart deployment user-service
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,7 @@ terraform.rc

# next.js
/apps/web/.next
/apps/web/next-env.d.ts
/apps/web/next-env.d.ts

#Kubernetes
**/*.env.yaml
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ kind create cluster --config kind-config.yaml
You can use Kubernetes to run the microservices and the gateway.
For that create the secret for the docker registry (take care of replacing the placeholders):
```shell
kubectl create secret docker-registry registry-credential --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-password> --docker-email=<your-email>
kubectl create secret docker-registry registry-credential --docker-server=https://hub.docker.com --docker-username=PierreLbg --docker-password=3o6gzWTiA#Vc%3 --docker-email=[email protected]
```

Then make the secret usable by the service account:
Expand All @@ -136,11 +136,6 @@ cd kubernetes
kubectl apply -f ./basket,./delivery,./gateway,./generic,./log,./notification,./order,./payment,./product,./promotion,./restaurant,./stock,./user
```

To request the gateway you need to port-forward it:
```shell
kubectl port-forward <gateway-pode-name> 50000:50000
```

Then you can run your web application. Make sure to change the URL in the web application environment file to http://localhost:50000.
If you need to redeploy your services after merge a new version of a services use
```shell
Expand Down
10 changes: 10 additions & 0 deletions kubernetes/basket/basket--env-docker-configmap.env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
data:
AMQP_URL: "amqp://guest:guest@event-broker"
PORT: "50002"
REDIS_URL: "redis://basket-redis:6379"
kind: ConfigMap
metadata:
labels:
service: basket-service-basket--env-docker
name: basket--env-docker
4 changes: 2 additions & 2 deletions kubernetes/basket/basket--env-docker-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
data:
AMQP_URL: "amqp://guest:guest@event-broker"
AMQP_URL: ""
PORT: "50002"
REDIS_URL: "redis://basket-redis:6379"
REDIS_URL: ""
kind: ConfigMap
metadata:
labels:
Expand Down
6 changes: 3 additions & 3 deletions kubernetes/basket/basket-redis-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ spec:
ephemeral-storage: "2Gi"
volumeMounts:
- mountPath: /data
name: goodfood-basket-volume
name: basket-service-volume
restartPolicy: Always
volumes:
- name: goodfood-basket-volume
- name: basket-service-volume
persistentVolumeClaim:
claimName: goodfood-basket-volume
claimName: basket-service-volume

12 changes: 6 additions & 6 deletions kubernetes/basket/basket-service-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: goodfood-basket
name: goodfood-basket
service: basket-service
name: basket-service
spec:
replicas: 1
selector:
matchLabels:
service: goodfood-basket
service: basket-service
strategy: {}
template:
metadata:
labels:
network/goodfood-network: "true"
service: goodfood-basket
service: basket-service
spec:
automountServiceAccountToken: false
imagePullSecrets:
Expand All @@ -36,9 +36,9 @@ spec:
configMapKeyRef:
key: REDIS_URL
name: basket--env-docker
image: floriaaan/goodfood-basket:latest
image: floriaaan/basket-service:latest
imagePullPolicy: Always
name: goodfood-basket
name: basket-service
ports:
- containerPort: 50002
resources:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/basket/basket-service-service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: goodfood-basket
name: basket-service
spec:
ports:
- name: "50002"
Expand Down
Loading

0 comments on commit 49faf73

Please sign in to comment.