75 lines
1.9 KiB
YAML
75 lines
1.9 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: communitarian-api
|
|
namespace: "{{ .namespace }}"
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
component: api
|
|
template:
|
|
metadata:
|
|
labels:
|
|
component: api
|
|
spec:
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 1000
|
|
runAsGroup: 1000
|
|
fsGroup: 1000
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
initContainers:
|
|
- name: fix-permissions
|
|
image: busybox:1.36
|
|
command: ['sh', '-c']
|
|
args:
|
|
- |
|
|
mkdir -p /app/api/data/citizens /app/api/data/communities /app/api/data/content /app/api/data/memberships /app/api/data/reactions
|
|
chmod -R 777 /app/api/data
|
|
echo "Permissions fixed"
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /app/api/data
|
|
securityContext:
|
|
runAsUser: 0
|
|
runAsNonRoot: false
|
|
containers:
|
|
- name: communitarian-api
|
|
image: "{{ .apiImage }}"
|
|
ports:
|
|
- containerPort: {{ .apiPort }}
|
|
name: http
|
|
env:
|
|
- name: TZ
|
|
value: "{{ .timezone }}"
|
|
- name: API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: communitarian-secrets
|
|
key: apiKey
|
|
- name: JWT_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: communitarian-secrets
|
|
key: jwtSecret
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /app/api/data
|
|
resources:
|
|
requests:
|
|
memory: "256Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop: [ALL]
|
|
readOnlyRootFilesystem: false
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: communitarian-data |