> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/ja/she-ding/overleaf-toolkit/s3.md).

# S3

{% hint style="info" %}
この文書では Server CE と Overleaf Pro における S3 の設定を扱います。A [別のガイド](/on-premises/ja/mentenansu/s3-migration.md) は、既存データを S3 互換ストレージへ移行する方法について記載されています。
{% endhint %}

## データストレージに S3 を使用することを検討すべき場合

1000 席未満のインスタンスでは、定期的な [整合性のあるバックアップ](https://docs.overleaf.com/on-premises/maintenance/data-and-backups#performing-a-consistent-backup).

1000 席を超え、ローカルストレージの制限（サイズまたはスループット）に達する大規模インスタンスでは、NFS のような他のネットワークベースのストレージソリューションよりも、S3 互換オブジェクトストレージのバックエンドを使用することをお勧めします。

## S3 互換オブジェクトストレージの विकल्प

S3 互換オブジェクトストレージの代表的な विकल्पは次のとおりです。

* [AWS S3](https://aws.amazon.com/s3/)、マネージド環境では、Overleaf CE/Server Pro を AWS 上で運用する場合は AWS S3 を選ぶことをお勧めします
* [MINIO](https://min.io/)、セルフホスト
* [Ceph](https://ceph.io/en/)、セルフホスト
* 他のホスティングプロバイダーにも、ある種のマネージド S3 互換オブジェクトストレージがあります。すでにそのようなプロバイダー上で Overleaf CE/Server Pro を運用している場合は、自前で運用する代わりにこれらを使うとよいでしょう。

## S3 互換オブジェクトストレージを選ぶ際のレイテンシに関する考慮事項

Server CE/Server Pro インスタンスと S3 互換オブジェクトストレージ間のレイテンシは、移行完了にかかる時間に大きく影響します。レイテンシは Server CE/Server Pro のファイルアップロード性能にも影響し、ファイルダウンロードの遅さは PDF のコンパイル時間にも大きな影響を与えます。Server CE/Server Pro インスタンスと S3 互換オブジェクトストレージの地理的距離を最小限にすることをお勧めします。マネージド環境では、同じリージョンにバケットを用意することを意味し、オンプレミス環境では、両方を同じキャンパス内で運用することを意味します。

## S3 の設定

4 つの「バケット」と 2 つの制限付きユーザーアカウントが必要です。

{% hint style="warning" %}
バケットは **しないでください** 公開アクセス可能である必要があります
{% endhint %}

<table data-header-hidden><thead><tr><th width="279"></th><th width="152"></th><th width="97"></th><th></th></tr></thead><tbody><tr><td>バケット</td><td>使い方</td><td>サービス</td><td>以前は <code>/var/lib/overleaf/data</code></td></tr><tr><td><code>overleaf-user-files</code></td><td>プロジェクトのユーザーファイル</td><td>filestore</td><td><code>user_files</code></td></tr><tr><td><code>overleaf-template-files</code></td><td>テンプレートファイル</td><td>filestore</td><td><code>template_files</code></td></tr><tr><td><code>overleaf-project-blobs</code></td><td>プロジェクト履歴の blob</td><td>履歴と読み取り専用ファイルストア</td><td><code>history/overleaf-project-blobs</code></td></tr><tr><td><code>overleaf-chunks</code></td><td>履歴チャンク</td><td>history</td><td><code>history/overleaf-chunks</code></td></tr></tbody></table>

別の名前を選ぶ必要がある場合もあります。すべてのコマンドでカスタムバケット名を使用してください。

以下では実際の認証情報の代わりにプレースホルダーを使用します。

<table><thead><tr><th width="431">環境変数</th><th>説明</th></tr></thead><tbody><tr><td><code>OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID</code></td><td>ファイルストアサービスの制限付きユーザーのアクセスキー/ユーザー名。</td></tr><tr><td><code>OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY</code></td><td>ファイルストアサービスの制限付きユーザーのシークレットキー/パスワード。</td></tr><tr><td><code>OVERLEAF_HISTORY_S3_ACCESS_KEY_ID</code></td><td>履歴サービスの制限付きユーザーのアクセスキー/ユーザー名。</td></tr><tr><td><code>OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY</code></td><td>履歴サービスの制限付きユーザーのシークレットキー/パスワード。</td></tr></tbody></table>

Server CE と Server Pro で各バケットに必要な権限はごく一部です。

* オブジェクトを作成
* オブジェクトを取得
* オブジェクトを削除
* バケットを一覧表示

### アクセスポリシー

ファイルストアユーザー向けのポリシーの例は次のようになります。

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket"
      ],
      "Resource": "arn:aws:s3:::overleaf-user-files"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::overleaf-user-files/*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
      ],
      "Resource": "arn:aws:s3:::overleaf-project-blobs/*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket"
      ],
      "Resource": "arn:aws:s3:::overleaf-template-files"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::overleaf-template-files/*"
    }
  ]
}
```

履歴ユーザー向けのポリシーの例は次のようになります。

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket"
      ],
      "Resource": "arn:aws:s3:::overleaf-project-blobs"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::overleaf-project-blobs/*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket"
      ],
      "Resource": "arn:aws:s3:::overleaf-chunks"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::overleaf-chunks/*"
    }
  ]
}
```

### 変数の概要

#### AWS S3 を使用する場合

```bash
# ファイルストアの S3 バックエンドを有効化
OVERLEAF_FILESTORE_BACKEND=s3

# プロジェクトファイル用バケット名
OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files

# テンプレートファイル用バケット名
OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files

# ファイルストアユーザー用キー
OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=...

# ファイルストアユーザー用シークレット
OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=...

# バケット作成時に選んだバケットリージョン。
OVERLEAF_FILESTORE_S3_REGION=""

# 履歴用の S3 バックエンドを有効化
OVERLEAF_HISTORY_BACKEND=s3

# プロジェクト履歴 blob 用バケット名
OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs

# 履歴チャンク用バケット名
OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks

# 履歴ユーザー用キー
OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=...

# 履歴ユーザー用シークレット
OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=...

# バケット作成時に選んだバケットリージョン。
OVERLEAF_HISTORY_S3_REGION=""
```

#### セルフホスト型オプションを使用する場合

```bash
# ファイルストアの S3 バックエンドを有効化
OVERLEAF_FILESTORE_BACKEND=s3

# プロジェクトファイル用バケット名
OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files

# テンプレートファイル用バケット名
OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files

# ファイルストアユーザー用キー
OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=...

# ファイルストアユーザー用シークレット
OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=...

# S3 プロバイダーのエンドポイント
OVERLEAF_FILESTORE_S3_ENDPOINT=http://10.10.10.10:9000

# バケットのパススタイルアドレッシング。ほとんどの場合、これを "true" に設定する必要があります。
OVERLEAF_FILESTORE_S3_PATH_STYLE="true"

# バケットリージョン。ほとんどの場合、これを設定する必要はありません。
OVERLEAF_FILESTORE_S3_REGION=""

# 履歴用の S3 バックエンドを有効化
OVERLEAF_HISTORY_BACKEND=s3

# プロジェクト履歴 blob 用バケット名
OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs

# 履歴チャンク用バケット名
OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks

# 履歴ユーザー用キー
OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=...

# 履歴ユーザー用シークレット
OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=...

# S3 プロバイダーのエンドポイント
OVERLEAF_HISTORY_S3_ENDPOINT=http://10.10.10.10:9000

# バケットのパススタイルアドレッシング。ほとんどの場合、これを "true" に設定する必要があります。
OVERLEAF_HISTORY_S3_PATH_STYLE="true"

# バケットリージョン。ほとんどの場合、これを設定する必要はありません。
OVERLEAF_HISTORY_S3_REGION=""
```

### MINIO の設定

{% hint style="info" %}
`MINIO_ROOT_USER` および `MINIO_ROOT_PASSWORD` は MINIO インスタンスのルート認証情報です。
{% endhint %}

次の [公式ドキュメント](https://min.io/docs/minio/linux/reference/minio-mc.html#quickstart) に従って、 `mc`.

```bash
mc alias set s3 http://10.10.10.10:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD

# 前のセクションのポリシーの内容を
# それぞれ policy-filestore.json と policy-history.json に入れてください。

# 注意: バケット名と認証情報はそれぞれ置き換えてください。

# ファイルストアのバケット、ユーザー、ポリシー
mc mb --ignore-existing s3/overleaf-user-files
mc mb --ignore-existing s3/overleaf-template-files
mc admin user add s3 \\
  OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID \\
  OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY
mc admin policy create s3 overleaf-filestore policy-filestore.json
mc admin policy attach s3 overleaf-filestore \\
  --user=OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID

# 履歴のバケット、ユーザー、ポリシー
mc mb --ignore-existing s3/overleaf-project-blobs
mc mb --ignore-existing s3/overleaf-chunks
mc admin user add s3 \\
  OVERLEAF_HISTORY_S3_ACCESS_KEY_ID \\
  OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY
mc admin policy create s3 overleaf-history policy-history.json
mc admin policy attach s3 overleaf-history \\
  --user=OVERLEAF_HISTORY_S3_ACCESS_KEY_ID
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/ja/she-ding/overleaf-toolkit/s3.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
