apiVersion: apps/v1
kind: Deployment

metadata:
  name: danbooru-jobs
  namespace: danbooru
  labels:
    app: danbooru-jobs

spec:
  replicas: 1

  selector:
    matchLabels:
      app: danbooru-jobs

  template:
    metadata:
      labels:
        app: danbooru-jobs

    spec:
      containers:
      - name: danbooru
        image: ghcr.io/danbooru/danbooru:production
        imagePullPolicy: Always

        args: ["bin/good_job", "start", "--poll-interval=60", "--max-threads=4", "--probe-port=3000"]

        env:
        # https://docs.newrelic.com/docs/agents/ruby-agent/background-jobs/delayedjob-instrumentation/
        - name: NEW_RELIC_DISPATCHER
          value: delayed_job

        envFrom:
        - configMapRef:
            name: danbooru-config-env
        - secretRef:
            name: danbooru-secret-env

        volumeMounts:
        - name: danbooru-local-config
          mountPath: "/etc/danbooru"
          readOnly: true

      volumes:
      - name: danbooru-local-config
        secret:
          secretName: danbooru-local-config
