All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 4s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 3s
- Remove cd /app since directory doesn't exist in initContainer - python manage.py is accessible from container root - Only main container mounts to /app/data, initContainer mounts to /data
73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: django
|
|
namespace: labhelper
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: django
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: django
|
|
spec:
|
|
securityContext:
|
|
fsGroup: 99
|
|
fsGroupChangePolicy: "OnRootMismatch"
|
|
initContainers:
|
|
- name: loader
|
|
image: git.baumann.gr/adebaumann/labhelper-data-loader:0.009
|
|
securityContext:
|
|
runAsUser: 0
|
|
command: [ "sh","-c","if [ ! -f /data/db.sqlite3 ] || [ ! -s /data/db.sqlite3 ]; then cp preload/preload.sqlite3 /data/db.sqlite3 && echo 'Database copied from preload'; else echo 'Existing database preserved'; fi && python manage.py migrate thumbnail --run-syncdb && mkdir -p /data/media/cache /data/media/things && chmod -R 775 /data/media && ls -la /data/db.sqlite3 && exit 0" ]
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data
|
|
containers:
|
|
- name: web
|
|
image: git.baumann.gr/adebaumann/labhelper:0.031
|
|
imagePullPolicy: Always
|
|
ports:
|
|
- containerPort: 8000
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /app/data
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 8000
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
timeoutSeconds: 2
|
|
failureThreshold: 6
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 8000
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 20
|
|
timeoutSeconds: 2
|
|
failureThreshold: 3
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: labhelper-data-pvc
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: django
|
|
namespace: labhelper
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: django
|
|
ports:
|
|
- name: http
|
|
protocol: TCP
|
|
port: 8000
|
|
targetPort: 8000
|
|
|