apiVersion: apps/v1
kind: Deployment
metadata:
  name: tranql-frontend-deployment
  namespace: translator
  labels:
    service: tranql-frontend-service
    app: tranql-frontend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: tranql-frontend
  template:
    metadata:
      labels:
        app: tranql-frontend
    spec:
      volumes:
        - name: nfs-volume
          nfs:
            server: arrival.edc.renci.org
            path: /srv/k8s-pvs/translator/logs
      terminationGracePeriodSeconds: 10
      containers:
      - name: tranql-app
        image: renciorg/tranql-app
        command: [ "/usr/local/bin/gunicorn", "--workers=2", "--bind=0.0.0.0:8001", "--timeout=600", "--access-logfile=$(ACCESS_LOG)", "--error-logfile=$(ERROR_LOG)", "--log-level=debug", "tranql.api:app" ]
        ports:
          - containerPort: 8001
            name: http
        env:
          - name: APP_PORT
            value: "8001"
          - name: BACKPLANE
            value: http://tranql-backend-service.translator.svc.stars-cluster.local:8099
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: ACCESS_LOG
            value: "/var/nfs/tranql-frontend_access_log"
          - name: ERROR_LOG
            value: "/var/nfs/tranql-frontend_error_log"
        volumeMounts:
          - name: nfs-volume
            mountPath: /var/nfs
            subPathExpr: $(POD_NAME)
        resources:
          requests:
            memory: 200Mi
          limits:
            memory: 1Gi
        stdin: true
      restartPolicy: Always