apiVersion: apps/v1
kind: Deployment
metadata:
    name: postiz
    namespace: postiz
spec:
    replicas: 1
    selector:
        matchLabels:
            app: postiz
    template:
        metadata:
            labels:
                app: postiz
        spec:
            containers:
              - name: postiz-web
                image: ghcr.io/gitroomhq/postiz-app:v1.36.1-arm64
                ports:
                  - containerPort: 5000
                envFrom:
                  - secretRef:
                      name: postiz-providers
                env:
                  - name: MAIN_URL
                    value: "https://postiz.halis.io"
                  - name: FRONTEND_URL
                    value: "https://postiz.halis.io"
                  - name: NEXT_PUBLIC_BACKEND_URL
                    value: "https://postiz.halis.io/api"
                  - name: JWT_SECRET
                    valueFrom:
                      secretKeyRef:
                        name: postiz-secrets
                        key: JWT_SECRET
                  - name: DB_USER
                    valueFrom:
                      secretKeyRef:
                        name: postiz-db
                        key: username
                  - name: DB_PASS
                    valueFrom:
                      secretKeyRef:
                        name: postiz-db
                        key: password
                  - name: DATABASE_URL
                    value: "postgresql://$(DB_USER):$(DB_PASS)@postiz-db-rw.postiz.svc.cluster.local:5432/postiz"
                  - name: REDIS_URL
                    value: "redis://redis-svc.postiz.svc.cluster.local:6379"
                  - name: BACKEND_INTERNAL_URL
                    value: "http://localhost:3000"
                  - name: IS_GENERAL
                    value: "true"
                  - name: STORAGE_PROVIDER
                    value: "local"
                  - name: UPLOAD_DIRECTORY
                    value: "/uploads"
                  - name: NEXT_PUBLIC_UPLOAD_DIRECTORY
                    value: "/uploads"
                volumeMounts:
                  - mountPath: "/uploads"
                    name: postiz-data
              - name: redis
                image: redis:7.4.2
                ports:
                  - containerPort: 6379
            volumes:
              - name: postiz-data
                persistentVolumeClaim:
                  claimName: postiz-pvc