apiVersion: apps/v1
kind: Deployment
metadata:
  name: tooljet-ce
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tooljet-ce
  template:
    metadata:
      labels:
        app: tooljet-ce
    spec:
      nodeSelector:
        "kubernetes.io/os": linux
      containers:
        - name: tooljet-ce
          image: tooljet/tooljet-ce:latest
          imagePullPolicy: Always
          args: ["npm", "run", "start:prod"]
          resources:
            limits:
              memory: "2000Mi"
              cpu: "2000m"
            requests:
              memory: "1000Mi"
              cpu: "1000m"
          ports:
            - containerPort: 3000
          readinessProbe:
            httpGet:
              port: 3000
              path: /api/health
            successThreshold: 1
            initialDelaySeconds: 10
            periodSeconds: 5
            failureThreshold: 6
          env:
            - name: PG_HOST
              valueFrom:
                secretKeyRef:
                  name: tooljet-secret
                  key: pg_host
            - name: PG_USER
              valueFrom:
                secretKeyRef:
                  name: tooljet-secret
                  key: pg_user
            - name: PG_PASS
              valueFrom:
                secretKeyRef:
                  name: tooljet-secret
                  key: pg_pass
            - name: PG_DB
              valueFrom:
                secretKeyRef:
                  name: tooljet-secret
                  key: pg_db
            - name: LOCKBOX_MASTER_KEY
              valueFrom:
                secretKeyRef:
                  name: tooljet-secret
                  key: lockbox_master_key
            - name: SECRET_KEY_BASE
              valueFrom:
                secretKeyRef:
                  name: tooljet-secret
                  key: secret_key_base
            - name: TOOLJET_HOST
              value: "https://tooljet.your-domain.com"
            - name: ENABLE_MARKETPLACE_FEATURE
              value: true
            - name: DEPLOYMENT_PLATFORM
              value: "k8s:aks"
            # Set the env values below for Tooljet Database
            # - name: ENABLE_TOOLJET_DB
            #   value: "true"
            # - name: TOOLJET_DB
            #   value: "tooljet_db"
            # - name: TOOLJET_DB_USER
            #   value: "replace_with_tooljet_db_user"
            # - name: TOOLJET_DB_HOST
            #   value: "replace_with_tooljet_db_host"
            # - name: TOOLJET_DB_PASS
            #   value: "replace_with_tooljet_db_pass"
            # - name: PGRST_HOST
            #   value: "replace_with_postgrest_host"
            # - name: PGRST_JWT_SECRET
            #   value: "replace_pgrst_jwt_secret_here"
