kind: PersistentVolume
apiVersion: v1
metadata:
  name: joget-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/wflow"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: joget-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
 name: joget
 labels:
   app: joget
spec:
 ports:
 - port: 8080
 selector:
   app: joget
 type: NodePort
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
 name: joget
spec:
 selector:
   matchLabels:
     app: joget
 strategy:
   type: Recreate
 template:
   metadata:
     labels:
       app: joget
   spec:
     initContainers:
     - name: config-data
       image: ubuntu:18.04
       command: ["/bin/sh","-c"]
       args: ["apt update; apt install -y wget tar; wget https://developer.joget.org/downloads/dependencies/joget-wflow.tar.gz; tar xvfz joget-wflow.tar.gz -C data/; chown -R 999 data"]
       volumeMounts:
       - name: joget-persistent-storage
         mountPath: /data
     containers:
     - image: jogetworkflow/joget-enterprise
       name: joget
       resources:
          requests:
            cpu: "0.5"
            memory: "800Mi"
       env:
       - name: MYSQL_HOST
         value: mysql
       - name: MYSQL_PASSWORD
         value: password
       - name: MYSQL_PORT
         value: "3306"
       ports:
       - containerPort: 8080
         name: joget
       volumeMounts:
       - name: joget-persistent-storage
         mountPath: /opt/joget/wflow
     volumes:
     - name: joget-persistent-storage
       persistentVolumeClaim:
         claimName: joget-pv-claim
