apiVersion: apps/v1
kind: Deployment
metadata:
  name: lty-backend
  labels:
    app: lty-backend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lty-backend
  template:
    metadata:
      labels:
        app: lty-backend
    spec:
      containers:
      - name: lty-backend
        image: ${CI_REGISTRY_IMAGE}/lty-backend:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8000
        env:
        # Django
        - name: SECRET_KEY
          value: "django-insecure-j63ZGygyiLWGqhZ-e3ZGH_HGfNVQgBkq*jjpYMz-QYqE46cuuA"
        - name: DEBUG
          value: "False"

        # Database (PostgreSQL)
        - name: POSTGRESQL_DATABASE_NAME
          value: "qy_lty"
        - name: POSTGRESQL_DATABASE_USER
          value: "qy_lty"
        - name: POSTGRESQL_DATABASE_PASSWORD
          value: "NfAfCvkad8L2"
        - name: POSTGRESQL_DATABASE_HOST
          value: "pgm-7xv4811oj11j86htzo.pg.rds.aliyuncs.com"
        - name: POSTGRESQL_DATABASE_PORT
          value: "5432"

        # Redis
        - name: REDIS_LOCATION
          value: "redis://r-7xvat0vez5clwbzk5vpd.redis.rds.aliyuncs.com:6379/0"
        - name: REDIS_PASSWORD
          value: "vAhRnAA6VMco"

        # Aliyun SMS
        - name: ALIYUN_SMS_ACCESS_KEY_ID
          value: "LTAI5t6ZXMo3SbKUg7YrK89m"
        - name: ALIYUN_SMS_ACCESS_KEY_SECRET
          value: "ygDVmjIIAcFgXcaJP7hbiSwOr8hYur"
        - name: ALIYUN_SMS_SIGN_NAME
          value: "广州气元科技"
        - name: ALIYUN_SMS_TEMPLATE_CODE
          value: "SMS_317100048"

        # AI (Volcengine/Kimi)
        - name: KIMI_API_KEY
          value: "846b6981-9954-4c58-bb39-63079393bdb8"
        - name: KIMI_BASE_URL
          value: "https://ark.cn-beijing.volces.com/api/v3/"

        # Aliyun Log
        - name: ALIYUN_LOG_PROJECT
          value: "lty"
        - name: ALIYUN_LOG_STORE
          value: "lty-backend"
        - name: ALIYUN_LOG_ENDPOINT
          value: "cn-guangzhou.log.aliyuncs.com"
        - name: ALIYUN_LOG_ACCESS_KEY_ID
          value: "LTAI5tFYGrgcAhscCdEUB9Te"
        - name: ALIYUN_LOG_ACCESS_KEY_SECRET
          value: "YO7Bf3QDH4ErYCNvSssFkHseNsh8PP"

        # Aliyun NLS (Voice)
        - name: ALIYUN_NLS_ACCESS_KEY_ID
          value: "LTAI5t6tnLjBK9edseDVH849"
        - name: ALIYUN_NLS_ACCESS_KEY_SECRET
          value: "DmiZyjnfQo03KalxYmELOfcDQUIrTX"
        - name: ALIYUN_NLS_APP_ID
          value: "Gxf9gwGYOvUTjzYC"

        # Aliyun OSS
        - name: ALIYUN_OSS_ACCESS_KEY_ID
          value: "LTAI5tL2aUarUR99h2kdKTss"
        - name: ALIYUN_OSS_ACCESS_KEY_SECRET
          value: "62OUrzdty2oQPiPLLt0XTAbKvMT1sO"
        - name: ALIYUN_OSS_BUCKET
          value: "lty-storage"
        - name: ALIYUN_OSS_ENDPOINT
          value: "https://oss-cn-guangzhou.aliyuncs.com"
        - name: ALIYUN_OSS_HOST
          value: "https://lty-storage.airlabs.art"
        - name: ALIYUN_OSS_AUDIO_BASE_DIR
          value: "audio"

        # Volcengine Audio (Luotianyi Voice Clone)
        - name: AUDIO_SERVICE_HUOSHAN_APPID
          value: "5801394478"
        - name: AUDIO_SERVICE_HUOSHAN_ACCESS_TOKEN
          value: "8pNMhvG4H6VWecnYOBmzyLnribeHVhoj"
        - name: AUDIO_SERVICE_HUOSHAN_CLUSTER
          value: "volcano_icl"
        - name: AUDIO_SERVICE_HUOSHAN_VOICE_TYPE
          value: "S_PHQ1AVPl1"
        - name: AUDIO_SERVICE_HUOSHAN_STORAGE_DIR
          value: "audio"
        - name: AUDIO_SERVICE_HUOSHAN_BASE_URL
          value: "https://lty-storage.airlabs.art"

        # Aliyun VI
        - name: ALIYUN_VI_ACCESS_KEY_ID
          value: "LTAI5tHXQGNyAws4eXB7ytYu"
        - name: ALIYUN_VI_ACCESS_KEY_SECRET
          value: "EouZq22js1pmMwMmGep4PWXqJEy9DA"
        - name: ALIYUN_VI_ENDPOINT
          value: "facebody.cn-shanghai.aliyuncs.com"
        - name: ALIYUN_VI_REGION
          value: "cn-shanghai"

        # Volcengine RTC
        - name: VOLCENGINE_ACCESS_KEY
          value: "AKLTNmVmNTU4NmEzNzFjNDYyYTk2OTZjMjMwYTljZGEwMjE"
        - name: VOLCENGINE_SECRET_KEY
          value: "TnpReFlqQTBaalUwT1RZNU5HSXhaamt3WlRBME5EQmtNVGc1WXpOallqYw=="
        - name: VOLCENGINE_APP_ID
          value: "68eb092fb8f0ac0173afe8c7"
        - name: VOLCENGINE_APP_KEY
          value: "8b43a113b59c47f3abd65bcd5ce8692d"
        - name: VOLCENGINE_TOKEN_EXPIRE_TIME
          value: "2592000"

        livenessProbe:
          httpGet:
            path: /admin/
            port: 8000
          initialDelaySeconds: 30
          periodSeconds: 10
          timeoutSeconds: 5
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /admin/
            port: 8000
          initialDelaySeconds: 15
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 3
        resources:
          requests:
            memory: "256Mi"
            cpu: "250m"
          limits:
            memory: "1024Mi"
            cpu: "1000m"
---
apiVersion: v1
kind: Service
metadata:
  name: lty-backend
spec:
  selector:
    app: lty-backend
  ports:
    - protocol: TCP
      port: 8000
      targetPort: 8000
