> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/on-premises/it/configurazione/overleaf-toolkit/s3.md).

# S3

{% hint style="info" %}
Questo documento copre la configurazione di S3 in Server CE e Overleaf Pro. Una [guida separata](/on-premises/it/manutenzione/s3-migration.md) può essere trovata per la migrazione dei dati esistenti a un archivio compatibile con S3.
{% endhint %}

## Quando considerare l'uso di S3 per l'archiviazione dei dati

Per istanze con meno di 1000 postazioni, consigliamo di usare l'archiviazione su disco locale con backup regolari [coerenti](https://docs.overleaf.com/on-premises/maintenance/data-and-backups#performing-a-consistent-backup).

Per istanze più grandi con oltre 1000 postazioni che raggiungono i limiti del loro archivio locale (dimensione o throughput), consigliamo di usare un backend di object storage compatibile con S3 invece di altre soluzioni di archiviazione basate sulla rete come NFS.

## Opzioni di object storage compatibili con S3

Ecco le opzioni più popolari per l'object storage compatibile con S3:

* [AWS S3](https://aws.amazon.com/s3/), gestito, suggeriamo di scegliere AWS S3 quando si esegue Overleaf CE/Server Pro su AWS
* [MINIO](https://min.io/), self-hosted
* [Ceph](https://ceph.io/en/), self-hosted
* Anche altri provider di hosting dispongono di una qualche forma di object storage gestito compatibile con S3; potresti voler usare questi invece di gestirne uno tuo quando esegui già Overleaf CE/Server Pro presso un provider di questo tipo.

## Considerazioni sulla latenza quando si sceglie un object storage compatibile con S3

La latenza tra l'istanza Server CE/Server Pro e il tuo object storage compatibile con S3 contribuisce in modo significativo al tempo necessario per completare la migrazione. La latenza influisce anche sulle prestazioni di caricamento dei file in Server CE/Server Pro e i download lenti possono avere un forte impatto anche sui tempi di compilazione dei PDF. Suggeriamo di ridurre al minimo la distanza geografica tra la tua istanza Server CE/Server Pro e l'object storage compatibile con S3. In un ambiente gestito, ciò significherebbe creare un bucket nella stessa regione e, per una soluzione on-premise, eseguire i due nella stessa sede.

## Configurazione di S3

Abbiamo bisogno di quattro "bucket" e di due account utente con restrizioni.

{% hint style="warning" %}
I bucket dovrebbero **non** essere accessibili pubblicamente
{% 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>Bucket</td><td>Utilizzo</td><td>Servizio</td><td>In precedenza in <code>/var/lib/overleaf/data</code></td></tr><tr><td><code>overleaf-user-files</code></td><td>file utente del progetto</td><td>filestore</td><td><code>user_files</code></td></tr><tr><td><code>overleaf-template-files</code></td><td>file del template</td><td>filestore</td><td><code>template_files</code></td></tr><tr><td><code>overleaf-project-blobs</code></td><td>blob della cronologia del progetto</td><td>archivio della cronologia e di sola lettura</td><td><code>history/overleaf-project-blobs</code></td></tr><tr><td><code>overleaf-chunks</code></td><td>chunk della cronologia</td><td>history</td><td><code>history/overleaf-chunks</code></td></tr></tbody></table>

Potresti voler/avere bisogno di scegliere un nome diverso; assicurati di usare i bucket personalizzati in tutti i comandi.

Quanto segue utilizzerà segnaposto per le credenziali reali:

<table><thead><tr><th width="431">Variabile d'ambiente</th><th>Descrizione</th></tr></thead><tbody><tr><td><code>OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID</code></td><td>La chiave di accesso/nome utente dell'utente con restrizioni del servizio filestore.</td></tr><tr><td><code>OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY</code></td><td>La chiave segreta/password dell'utente con restrizioni del servizio filestore.</td></tr><tr><td><code>OVERLEAF_HISTORY_S3_ACCESS_KEY_ID</code></td><td>La chiave di accesso/nome utente dell'utente con restrizioni del servizio history.</td></tr><tr><td><code>OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY</code></td><td>La chiave segreta/password dell'utente con restrizioni del servizio history.</td></tr></tbody></table>

Server CE e Server Pro necessitano solo di un piccolo insieme di autorizzazioni su ciascun bucket:

* crea oggetto
* ottieni oggetto
* elimina oggetto
* elenca bucket

### Policy di accesso

Ecco come potrebbe apparire una policy per l'utente del filestore:

```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/*"
    }
  ]
}
```

Ecco come potrebbe apparire una policy per l'utente history:

```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/*"
    }
  ]
}
```

### Panoramica delle variabili

#### Quando si usa AWS S3

```bash
# Abilita il backend S3 per il filestore
OVERLEAF_FILESTORE_BACKEND=s3

# Nome del bucket per i file del progetto
OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files

# Nome del bucket per i file del template
OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files

# Chiave per l'utente del filestore
OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=...

# Segreto per l'utente del filestore
OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=...

# Regione del bucket che hai scelto quando hai creato i bucket.
OVERLEAF_FILESTORE_S3_REGION=""

# Abilita il backend S3 per la cronologia
OVERLEAF_HISTORY_BACKEND=s3

# Nome del bucket per i blob della cronologia del progetto
OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs

# Nome del bucket per i chunk della cronologia
OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks

# Chiave per l'utente della cronologia
OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=...

# Segreto per l'utente della cronologia
OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=...

# Regione del bucket che hai scelto quando hai creato i bucket.
OVERLEAF_HISTORY_S3_REGION=""
```

#### Quando si usa un'opzione self-hosted

```bash
# Abilita il backend S3 per il filestore
OVERLEAF_FILESTORE_BACKEND=s3

# Nome del bucket per i file del progetto
OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files

# Nome del bucket per i file del template
OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files

# Chiave per l'utente del filestore
OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=...

# Segreto per l'utente del filestore
OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=...

# Endpoint del provider S3
OVERLEAF_FILESTORE_S3_ENDPOINT=http://10.10.10.10:9000

# Assegnazione in stile path dei bucket. Molto probabilmente devi impostarlo su "true".
OVERLEAF_FILESTORE_S3_PATH_STYLE="true"

# Regione del bucket. Molto probabilmente non devi configurarla.
OVERLEAF_FILESTORE_S3_REGION=""

# Abilita il backend S3 per la cronologia
OVERLEAF_HISTORY_BACKEND=s3

# Nome del bucket per i blob della cronologia del progetto
OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs

# Nome del bucket per i chunk della cronologia
OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks

# Chiave per l'utente della cronologia
OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=...

# Segreto per l'utente della cronologia
OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=...

# Endpoint del provider S3
OVERLEAF_HISTORY_S3_ENDPOINT=http://10.10.10.10:9000

# Assegnazione in stile path dei bucket. Molto probabilmente devi impostarlo su "true".
OVERLEAF_HISTORY_S3_PATH_STYLE="true"

# Regione del bucket. Molto probabilmente non devi configurarla.
OVERLEAF_HISTORY_S3_REGION=""
```

### Configurazione di MINIO

{% hint style="info" %}
`MINIO_ROOT_USER` e `MINIO_ROOT_PASSWORD` sono le credenziali root dell'istanza MINIO.
{% endhint %}

Segui la [documentazione ufficiale](https://min.io/docs/minio/linux/reference/minio-mc.html#quickstart) per ottenere una copia di `mc`.

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

# Inserisci il contenuto delle policy della sezione precedente nel
# rispettivo file json policy-filestore.json e policy-history.json.

# Promemoria: sostituisci di conseguenza i nomi dei bucket e le credenziali.

# bucket, utente e policy del filestore
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

# bucket, utente e policy della cronologia
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://overleaf-pro.ayaka.space/on-premises/it/configurazione/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.
