> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 本番環境へのデプロイ

## 要件

> ユーザー数が多い場合は、必要に応じてリソースを拡張するか、[パフォーマンスチューニングドキュメント](/ja/3.11.x/deploy/advanced-configuration/performance)を参照してください。

* Kubernetes クラスター
  * 6 ワーカーノード：各 8 CPU、32 GB RAM
* コンテナレジストリ（プラグイン）
  * AWS ECR（with AK/SK or IRSA）/ Azure ACR / Aliyun ACR (with AK/SK) / Tencent TCR (with AK/SK) / Dockerhub / Google Artifact Registry
* 永続ストレージ
  * S3 / AWS S3 (with AK/SK or IRSA) / Azure Blob / Aliyun OSS (with AK/SK) / Tencent COS (with AK/SK) / Google GCS
  * 512 GB ストレージ
* Postgres データベース
  * バージョン 14+
  * 8 CPU，16 GB RAM
  * 少なくとも 512G SSD
* Redis データベース
  * バージョン 6+
  * 2 GB RAM
* [ベクトルデータベース VM - Qdrant クラスター](/ja/3.11.x/deploy/advanced-configuration/qdrant/qdrant-cluster)
  * 3 VM
  * 8 CPU，64 GB RAM
  * 100 GB ストレージ

## Dify サービスリソースの `limits`

<Warning>
  `workerBeat` は常に単一のレプリカとして実行する必要があります。
</Warning>

| Services            | Replicas | CPU | RAM - GB  | Total CPU | Total RAM - GB |
| ------------------- | -------- | --- | --------- | --------- | -------------- |
| api                 | 6        | 1   | 2         | 9         | 12             |
| worker              | 9        | 1   | 2         | 6         | 18             |
| workerBeat          | 1        | 1   | 1         | 1         | 1              |
| web                 | 3        | 1   | 1         | 3         | 3              |
| sandbox             | 3        | 1   | 2         | 3         | 6              |
| enterprise          | 3        | 1   | 2         | 3         | 6              |
| enterpriseAudit     | 3        | 1   | 2         | 3         | 6              |
| enterpriseFrontend  | 3        | 1   | 1         | 3         | 3              |
| enterpriseCollector | 1        | 1   | 1         | 1         | 1              |
| ssrfProxy           | 3        | 1   | 1         | 3         | 3              |
| unstructured        | 3        | 1   | 2         | 3         | 6              |
| plugin\_daemon      | 3        | 1   | 3         | 3         | 9              |
| plugin\_controller  | 3        | 1   | 2         | 3         | 6              |
| plugin\_connector   | 3        | 1   | 2         | 3         | 6              |
| plugin\_manager     | 3        | 1   | 2         | 3         | 6              |
| gateway             | 3        | 1   | 2         | 3         | 6              |
|                     |          |     | **Total** | 52        | 98             |

## デプロイ

### 1. Helm リポジトリ情報の取得

```bash theme={null}
helm repo add dify https://langgenius.github.io/dify-helm
helm repo update
```

詳細については、[Dify Helm Chart](/ja/3.11.x/deploy/advanced-configuration/dify-helm-chart)を参照してください。

### 2. Helm Chart 値の保存

* Helm chart の値を `values.yaml` という名前のファイルに保存します。
* 設定に合わせて `values.yaml` ファイルを更新します。

<Warning>
  - `#REPLACE_ME#` プレースホルダーを実際の値に置き換えてください。
  - "dify123456" を独自の値に置き換えてください。
  - `global.appSecretKey` と `enterprise.appSecretKey` は異なる必要があります。
</Warning>

```yaml theme={null}
###################################
# Please replace "dify123456" with your own value
###################################
global:
  appSecretKey: 'dify123456'
  innerApiKey: 'dify123456'
  consoleApiDomain: "console.dify.local"
  consoleWebDomain: "console.dify.local"
  serviceApiDomain: "api.dify.local"
  appApiDomain: "app.dify.local"
  appWebDomain: "app.dify.local"
  filesDomain: "upload.dify.local"
  enterpriseDomain: "enterprise.dify.local"

ingress:
  enabled: true
  className: "nginx"
  annotations: {
    # set file upload size limit
    nginx.ingress.kubernetes.io/proxy-body-size: "15m"
  }

api:
  replicas: 6
  serverWorkerAmount: 1
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
worker:
  replicas: 9
  celeryWorkerAmount: 1
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
workerBeat:
  resources:
    limits:
      cpu: 1000m
      memory: 1024Mi
    requests:
      cpu: 500m
      memory: 512Mi
web:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 1024Mi
    requests:
      cpu: 500m
      memory: 512Mi
sandbox:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
enterprise:
  replicas: 3
  appSecretKey: "dify123456"
  adminAPIsSecretKeySalt: "dify123456"
  passwordEncryptionKey: "dify123456"
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
enterpriseAudit:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
enterpriseFrontend:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 1024Mi
    requests:
      cpu: 500m
      memory: 512Mi
ssrfProxy:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 1024Mi
    requests:
      cpu: 500m
      memory: 512Mi
unstructured:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
plugin_daemon:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 3072Mi
    requests:
      cpu: 500m
      memory: 1536Mi
plugin_controller:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
plugin_connector:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
plugin_manager:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi
gateway:
  replicas: 3
  resources:
    limits:
      cpu: 1000m
      memory: 2048Mi
    requests:
      cpu: 500m
      memory: 1024Mi

###################################
# Persistence Configration
###################################
persistence:
  type: "s3"
  s3:
    endpoint: "https://xxx.r2.cloudflarestorage.com"
    accessKey: "#REPLACE_ME#"
    secretKey: "#REPLACE_ME#"
    region: "us-east-1"
    bucketName: "your-bucket-name"
    addressType: ""
    useAwsManagedIam: false
    useAwsS3: true

###################################
# External database (Postgres/MySQL/TiDB) v3.9.0 の設定
###################################
externalDatabase:
  enabled: false
  # postgres | mysql | tidb
  engine: "postgres"
  host: "localhost"
  # Default ports: postgres=5432, mysql=3306, tidb=4000
  # Note: when switching engine, remember to update port accordingly
  port: 5432
  user: "postgres"
  password: "#REPLACE_ME#"
  timezone: "UTC"
  databases:
    dify: "dify"
    plugin_daemon: "dify_plugin_daemon"
    enterprise: "enterprise"
    audit: "audit"
  dialectOptions:
    postgres:
      sslMode: "require"
      uriScheme: "postgresql"
      # extras: "options=-c search_path=your-schema -c your-other-option=xxx"
      extras: ""
    mysql:
      # MySQL/TiDB params, e.g. charset=utf8mb4&parseTime=true&loc=UTC
      params: "charset=utf8mb4&parseTime=true&loc=UTC"
      tls: false

###################################
# External database (Postgres/MySQL/TiDB) v3.9.1 の設定
###################################
externalDatabase:
  enabled: false
  # postgres | mysql | tidb
  engine: "postgres"
  host: "localhost"

  # Default ports: postgres=5432, mysql=3306, tidb=4000
  # Note: when switching engine, remember to update port accordingly
  port: 5432

  # グローバルなデータベース認証情報（デフォルトで使用）
  user: "postgres"
  password: "#REPLACE_ME#"

  timezone: "UTC"

  databases:
    dify: "dify"
    plugin_daemon: "dify_plugin_daemon"
    enterprise: "enterprise"
    audit: "audit"

  ###################################
  # データベースごとの認証情報（任意）
  ###################################
  # 各データベースごとにユーザー名とパスワードを個別に設定するために使用します
  # グローバルな user/password より優先されます
  # 空の場合はグローバルな認証情報にフォールバックします
  databaseCredentials:
    dify:
      user: ""
      password: ""
    enterprise:
      user: ""
      password: ""
    audit:
      user: ""
      password: ""
    plugin_daemon:
      user: ""
      password: ""

  dialectOptions:
    postgres:
      sslMode: "require"
      uriScheme: "postgresql"
      # extras: "options=-c search_path=your-schema -c your-other-option=xxx"
      extras: ""

    mysql:
      # MySQL/TiDB params, e.g. charset=utf8mb4&parseTime=true&loc=UTC
      params: "charset=utf8mb4&parseTime=true&loc=UTC"
      tls: false

###################################
# External Redis
###################################
externalRedis:
  enabled: true
  host: "#REPLACE_ME#"
  port: 6379
  username: ""
  password: "#REPLACE_ME#"
  useSSL: false

###################################
# External Qdrant
###################################
vectorDB:
  useExternal: true
  externalType: "qdrant"
  externalQdrant:
    endpoint: "http://your-qdrant-cluster-url.qdrant.tech/"
    apiKey: "#REPLACE_ME#"

imagePullSecrets: []
```

### 3. `コンテナレジストリ` の設定

* 3.1 `プラグイン` コンテナレジストリの設定
  * 詳細については、[プラグインのコンテナレジストリ設定](/ja/3.11.x/deploy/advanced-configuration/container-registry-for-plugins)を参照してください。
* 3.2 `サービス` コンテナレジストリの設定
  * 詳細については、[コンテナレジストリ設定](/ja/3.11.x/deploy/advanced-configuration/container-registry)を参照してください。

### 4. `Persistence Storage` の設定

* 詳細については、[Persistence Storage](/ja/3.11.x/deploy/advanced-configuration/persistent-storage)を参照してください。

### 5. `External Database` の設定

* 詳細については、[External Database](/ja/3.11.x/deploy/advanced-configuration/database)を参照してください。

### 6. `External Redis` の設定

* 詳細については、[External Redis](/ja/3.11.x/deploy/advanced-configuration/redis)を参照してください。

### 7. `External Qdrant` の設定

* 詳細については、[External Qdrant Cluster](/ja/3.11.x/deploy/advanced-configuration/qdrant/qdrant-cluster)を参照してください。

### 8. `Ingress Controller` の設定

* 詳細については、[Ingress Controller 設定](/ja/3.11.x/deploy/advanced-configuration/nginx-ingress-controller)を参照してください。

### 9. Dify Helm Chart のインストール

```bash theme={null}
helm upgrade -i dify -f values.yaml dify/dify
```

### 10. インストール結果の検証

* 詳細については、[サービスステータスの検証](/ja/3.11.x/deploy/verify-services-status)を参照してください。

## 高度な設定

### 1. ドメインと SSL 証明書

* 詳細については、[ドメインと SSL 証明書の設定](/ja/3.11.x/deploy/advanced-configuration/domain-and-ssl-certificate)を参照してください。

### 2. メールサービスプロバイダー

* 詳細については、[メールサービスの設定](/ja/3.11.x/deploy/advanced-configuration/email-provider)を参照してください。

### 3. パフォーマンスチューニング

* 詳細については、[パフォーマンスチューニング](/ja/3.11.x/deploy/advanced-configuration/performance)を参照してください。
