apiVersion: apps/v1
kind: Deployment
metadata:
  name: tooljet-deployment
spec:
  replicas: 2
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  selector:
    matchLabels:
      component: tooljet
  template:
    metadata:
      labels:
        component: tooljet
    spec:
      imagePullSecrets:
        - name: docker-secret
      containers:
        - name: container
          image: tooljet/tooljet-ce:latest
          imagePullPolicy: Always
          args: ["npm", "run", "start:prod"]
          resources:
            limits:
              memory: "1000Mi"
              cpu: "500m"
            requests:
              memory: "1000Mi"
              cpu: "500m"
          ports:
            - containerPort: 3000
          readinessProbe:
            httpGet:
              port: 3000
              path: /api/health
            successThreshold: 1
            initialDelaySeconds: 10
            periodSeconds: 5
            failureThreshold: 6
          env:
            - name: PG_HOST
              value: ""
            - name: PG_USER
              value: "postgres"
            - name: PG_PASS
              value: ""
            - name: PG_DB
              value: ""
            - name: LOCKBOX_MASTER_KEY
              value: ""
            - name: SECRET_KEY_BASE
              value: ""
            - name: TOOLJET_HOST
              value: "https://tooljet.your-domain.com"
            - name: ENABLE_MARKETPLACE_FEATURE
              value: true
            - name: DEPLOYMENT_PLATFORM
              value: "k8s:gke"
            # 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"
