Skip to content

Commit

Permalink
Add K8s deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkopp committed Dec 18, 2023
1 parent 8600084 commit e1bbfab
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
- main
paths-ignore:
- '**.md'
- 'docker-compose*'
- 'k8s/*'

jobs:
dockerhub:
Expand Down
76 changes: 76 additions & 0 deletions k8s/backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: backend-cs
name: backend-cs
spec:
ports:
- port: 80
targetPort: 8080
selector:
app: backend
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: backend
name: backend
spec:
replicas: 1
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
spec:
containers:
- name: backend
imagePullPolicy: Always
env:
- name: SPRING_PROFILES_ACTIVE
value: prod
- name: MONGO_HOST
value: mongo-mongodb
- name: SPRING_DATASOURCE_USERNAME
value: postgres
- name: SPRING_DATASOURCE_PASSWORD
value: postgres
- name: SPRING_DATASOURCE_URL
value: jdbc:postgresql://postgres:5432/postgres
- name: SPRING_DATASOURCE_DRIVER_CLASS_NAME
value: org.postgresql.Driver
- name: T2_CART_TTL
value: "0"
- name: T2_CART_TASKRATE
value: "0"
- name: T2_INVENTORY_SIZE
value: "25"
- name: T2_INVENTORY_TASKRATE
value: "0"
- name: T2_INVENTORY_TTL
value: "0"
- name: T2_PAYMENT_PROVIDER_ENABLED
value: "FALSE"
- name: T2_PAYMENT_PROVIDER_DUMMY_URL
value: http://creditinstitute-cs/pay
- name: T2_PAYMENT_PROVIDER_TIMEOUT
value: "5"
- name: T2_SIMULATE_COMPUTE_INTENSIVE_TASK_ENABLED
value: "FALSE"
- name: T2_SIMULATE_COMPUTE_INTENSIVE_TASK_ITERATIONS
value: "1000000000"
image: t2project/modulith:main
ports:
- containerPort: 8080
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 250m
memory: 250Mi
restartPolicy: Always
72 changes: 72 additions & 0 deletions k8s/postgres_stateful.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: v1
kind: Service # headless
metadata:
labels:
app: postgres
name: postgres
spec:
ports:
- port: 5432
targetPort: 5432
clusterIP: None
selector:
app: postgres
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: postgres
name: postgres
spec:
serviceName: postgres
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:12.17
env:
- name: POSTGRES_PASSWORD
value: postgres
- name: POSTGRES_USER
value: postgres
ports:
- containerPort: 5432
volumeMounts:
- name: datadir
mountPath: /var/lib/postgresql/data
subPath: postgres
- name: postgres-config
mountPath: /etc/postgresql/postgresql.conf
subPath: postgresql.conf
readOnly: true
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 100m
memory: 100Mi
restartPolicy: Always
volumes:
- name: postgres-config
configMap:
name: postgres-config
items:
- key: postgresql.conf
path: postgresql.conf
volumeClaimTemplates:
- metadata:
name: datadir
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
2 changes: 2 additions & 0 deletions k8s/postgresql.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
max_connections = 5000
shared_buffers = 512MB

0 comments on commit e1bbfab

Please sign in to comment.