split db and app into two deployments
This commit is contained in:
@@ -6,7 +6,7 @@ metadata:
|
||||
namespace: git-ops
|
||||
data:
|
||||
SEMAPHORE_DB_USER: "semaphore"
|
||||
SEMAPHORE_DB_HOST: "localhost"
|
||||
SEMAPHORE_DB_HOST: "semaphore-db-service"
|
||||
SEMAPHORE_DB_PORT: "3306"
|
||||
SEMAPHORE_DB_DIALECT: "mysql"
|
||||
SEMAPHORE_DB: "semaphore"
|
||||
|
||||
43
clusters/default/git-ops/semaphore/semaphore-db.yml
Normal file
43
clusters/default/git-ops/semaphore/semaphore-db.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: semaphore-db
|
||||
namespace: git-ops
|
||||
spec:
|
||||
strategy:
|
||||
type: Recreate
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: semaphore-db
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: semaphore-db
|
||||
spec:
|
||||
containers:
|
||||
- name: mysql
|
||||
image: mysql:9.5.0
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
env:
|
||||
- name: MYSQL_RANDOM_ROOT_PASSWORD
|
||||
value: "'yes'"
|
||||
- name: MYSQL_DATABASE
|
||||
value: "semaphore"
|
||||
- name: MYSQL_USER
|
||||
value: "semaphore"
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: semaphore-secrets
|
||||
key: mysql_password
|
||||
volumeMounts:
|
||||
- name: db
|
||||
mountPath: /var/lib/mysql
|
||||
subPath: db
|
||||
volumes:
|
||||
- name: db
|
||||
persistentVolumeClaim:
|
||||
claimName: semaphore-longhorn
|
||||
@@ -14,3 +14,16 @@ spec:
|
||||
ports:
|
||||
- port: 3002
|
||||
targetPort: 3000
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: semaphore-db-service
|
||||
namespace: git-ops
|
||||
spec:
|
||||
selector:
|
||||
app: semaphore-db
|
||||
ports:
|
||||
- port: 3306
|
||||
targetPort: 3306
|
||||
|
||||
@@ -17,27 +17,9 @@ spec:
|
||||
app: semaphore
|
||||
spec:
|
||||
initContainers:
|
||||
- name: mysql
|
||||
image: mysql:9.5.0
|
||||
restartPolicy: Always
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
env:
|
||||
- name: MYSQL_RANDOM_ROOT_PASSWORD
|
||||
value: "'yes'"
|
||||
- name: MYSQL_DATABASE
|
||||
value: "semaphore"
|
||||
- name: MYSQL_USER
|
||||
value: "semaphore"
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: semaphore-secrets
|
||||
key: mysql_password
|
||||
volumeMounts:
|
||||
- name: db
|
||||
mountPath: /var/lib/mysql
|
||||
subPath: db
|
||||
- name: wait-for-db
|
||||
image: busybox
|
||||
command: ['sh', '-c', 'until nc -z -v -w30 semaphore-db-service 3306; do echo "Waiting for database connection..."; sleep 5; done;']
|
||||
containers:
|
||||
- name: semaphore
|
||||
image: public.ecr.aws/semaphore/pro/server:v2.16.45
|
||||
@@ -62,7 +44,3 @@ spec:
|
||||
secretKeyRef:
|
||||
name: semaphore-secrets
|
||||
key: key
|
||||
volumes:
|
||||
- name: db
|
||||
persistentVolumeClaim:
|
||||
claimName: semaphore-longhorn
|
||||
|
||||
Reference in New Issue
Block a user