Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/develop-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Deploy to Local Kubernetes
name: develop pipeline clean, package and push to ghcr

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/feature-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Deploy to Local Kubernetes
name: feature pipeline and package

on:
push:
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/terraform-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy Infrastructure To Azure

on:
push:
branches:
- 'apply/**'

jobs:
terraform:
runs-on: ubuntu-latest

env:
TF_VAR_db_admin_password: ${{ secrets.DB_ADMIN_PASSWORD }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Parse environment from branch
id: env
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
ENV_NAME="${BRANCH_NAME#apply/}"
echo "env_name=$ENV_NAME" >> $GITHUB_OUTPUT

- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2

- name: Terraform Init
run: terraform init
working-directory: terraform/environments/${{ steps.env.outputs.env_name }}

- name: Terraform Plan
run: terraform plan -var-file="terraform.tfvars"
working-directory: terraform/environments/${{ steps.env.outputs.env_name }}

- name: Terraform Apply
run: terraform apply -auto-approve -var-file="terraform.tfvars"
working-directory: terraform/environments/${{ steps.env.outputs.env_name }}
6 changes: 6 additions & 0 deletions helm/order-service/chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: order-service
description: A Helm chart for Kubernetes
type: application # application or library
version: 0.1.0 # chart version
appVersion: "1.0" # version of the application
25 changes: 25 additions & 0 deletions helm/order-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.targetPort }}
env:
- name: SPRING_PROFILES_ACTIVE
value: {{ .Values.env.SPRING_PROFILES_ACTIVE }}
21 changes: 21 additions & 0 deletions helm/order-service/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
annotations:
kubernetes.io/ingress.class: {{ .Values.ingress.className }}
spec:
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
path: {{ .Values.ingress.path }}
pathType: {{ .Values.ingress.pathType }}
backend:
service:
name: {{ .Chart.Name }}
port:
number: {{ .Values.service.port }}
14 changes: 14 additions & 0 deletions helm/order-service/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
spec:
type: {{ .Values.service.type }}
selector:
app: {{ .Chart.Name }}
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
17 changes: 17 additions & 0 deletions helm/order-service/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
replicaCount: 2
image:
repository: ghcr.io/devsocket/order-service # change to azure acr
pullPolicy: IfNotPresent
tag: "latest" # Overrides the image tag whose default is the chart appVersion
service:
type: ClusterIP
port: 80
targetPort: 8085
ingress:
enabled: true # Enable ingress for the service
className: azure/application-gateway # Specify the ingress class name
host: order-service.prod.ecommerce.com
path: /api/v1/orders
pathType: Prefix
env:
SPRING_PROFILES_ACTIVE: prod
17 changes: 17 additions & 0 deletions helm/order-service/values-qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
replicaCount: 1
image:
repository: ghcr.io/devsocket/order-service
pullPolicy: IfNotPresent
tag: "latest" # Overrides the image tag whose default is the chart appVersion
service:
type: ClusterIP
port: 80
targetPort: 8081
ingress:
enabled: true # Enable ingress for the service
className: azure/application-gateway # Specify the ingress class name
host: order-service.qa.ecommerce.com
path: /api/v1/orders
pathType: Prefix
env:
SPRING_PROFILES_ACTIVE: qa
6 changes: 6 additions & 0 deletions helm/product-service/chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: product-service
description: A Helm chart for Kubernetes
type: application # application or library
version: 0.1.0 # chart version
appVersion: "1.0" # version of the application
25 changes: 25 additions & 0 deletions helm/product-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.targetPort }}
env:
- name: SPRING_PROFILES_ACTIVE
value: {{ .Values.env.SPRING_PROFILES_ACTIVE }}
21 changes: 21 additions & 0 deletions helm/product-service/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
annotations:
kubernetes.io/ingress.class: {{ .Values.ingress.className }}
spec:
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
path: {{ .Values.ingress.path }}
pathType: {{ .Values.ingress.pathType }}
backend:
service:
name: {{ .Chart.Name }}
port:
number: {{ .Values.service.port }}
14 changes: 14 additions & 0 deletions helm/product-service/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
spec:
type: {{ .Values.service.type }}
selector:
app: {{ .Chart.Name }}
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
17 changes: 17 additions & 0 deletions helm/product-service/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
replicaCount: 2
image:
repository: ghcr.io/devsocket/product-service
pullPolicy: IfNotPresent
tag: "latest" # Overrides the image tag whose default is the chart appVersion
service:
type: ClusterIP
port: 80
targetPort: 8081
ingress:
enabled: true # Enable ingress for the service
className: azure/application-gateway # Specify the ingress class name
host: product-service.prod.ecommerce.com
path: /api/v1/products
pathType: Prefix
env:
SPRING_PROFILES_ACTIVE: prod
17 changes: 17 additions & 0 deletions helm/product-service/values-qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
replicaCount: 1
image:
repository: ghcr.io/devsocket/product-service
pullPolicy: IfNotPresent
tag: "latest" # Overrides the image tag whose default is the chart appVersion
service:
type: ClusterIP
port: 80
targetPort: 8081
ingress:
enabled: true # Enable ingress for the service
className: azure/application-gateway # Specify the ingress class name
host: product-service.qa.ecommerce.com
path: /api/v1/products
pathType: Prefix
env:
SPRING_PROFILES_ACTIVE: qa
6 changes: 6 additions & 0 deletions helm/user-service/chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: user-service
description: A Helm chart for Kubernetes
type: application # application or library
version: 0.1.0 # chart version
appVersion: "1.0" # version of the application
25 changes: 25 additions & 0 deletions helm/user-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.targetPort }}
env:
- name: SPRING_PROFILES_ACTIVE
value: {{ .Values.env.SPRING_PROFILES_ACTIVE }}
21 changes: 21 additions & 0 deletions helm/user-service/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
annotations:
kubernetes.io/ingress.class: {{ .Values.ingress.className }}
spec:
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
path: {{ .Values.ingress.path }}
pathType: {{ .Values.ingress.pathType }}
backend:
service:
name: {{ .Chart.Name }}
port:
number: {{ .Values.service.port }}
14 changes: 14 additions & 0 deletions helm/user-service/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
spec:
type: {{ .Values.service.type }}
selector:
app: {{ .Chart.Name }}
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
17 changes: 17 additions & 0 deletions helm/user-service/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
replicaCount: 2
image:
repository: ghcr.io/devsocket/user-service # change to azure acr
pullPolicy: IfNotPresent
tag: "latest" # Overrides the image tag whose default is the chart appVersion
service:
type: ClusterIP
port: 80
targetPort: 8085
ingress:
enabled: true # Enable ingress for the service
className: azure/application-gateway # Specify the ingress class name
host: user-service.prod.ecommerce.com
path: /api/v1/users
pathType: Prefix
env:
SPRING_PROFILES_ACTIVE: prod
17 changes: 17 additions & 0 deletions helm/user-service/values-qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
replicaCount: 1
image:
repository: ghcr.io/devsocket/user-service
pullPolicy: IfNotPresent
tag: "latest" # Overrides the image tag whose default is the chart appVersion
service:
type: ClusterIP
port: 80
targetPort: 8081
ingress:
enabled: true # Enable ingress for the service
className: azure/application-gateway # Specify the ingress class name
host: user-service.qa.ecommerce.com
path: /api/v1/users
pathType: Prefix
env:
SPRING_PROFILES_ACTIVE: qa
Loading