apiVersion: apps/v1
kind: Deployment
metadata:
  name: nue
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nue
  template:
    metadata:
      labels:
        app: nue
    spec:
      serviceAccountName: nue
      securityContext:
        fsGroup: 65534 # To be able to read Kubernetes and AWS token files
      imagePullSecrets:
        - name: regcred
      initContainers:
        - name: migration-runner
          image: docker.pkg.github.com/verybigthings/nue/nue:replaceme
          command:
            [
              "/bin/bash",
              "-c",
              "/opt/app/bin/check_config.sh && /opt/app/bin/migrate_all.sh",
            ]
          envFrom:
            - secretRef:
                name: nue
            - configMapRef:
                name: nue
      containers:
        - name: web-server
          image: docker.pkg.github.com/verybigthings/nue/nue:replaceme
          ports:
            - containerPort: 4000
            - containerPort: 3000
          envFrom:
            - secretRef:
                name: nue
            - configMapRef:
                name: nue
          livenessProbe:
            httpGet:
              path: /healthz
              port: 3000
            initialDelaySeconds: 15
            periodSeconds: 15
          readinessProbe:
            httpGet:
              path: /healthz
              port: 3000
            initialDelaySeconds: 15
            periodSeconds: 15
