You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(storage): native Google Cloud Storage support for self-hosting
Adds GCS as a third object-storage backend with full parity with S3 and
Azure Blob: uploads, streaming downloads, deletes, head, V4 signed URLs
(single + batch), and browser/server multipart uploads via the GCS XML
API. Selection precedence is Azure Blob > S3 > GCS > local disk.
- new provider client at lib/uploads/providers/gcs (cached singleton,
ADC/Workload Identity or inline GCS_CREDENTIALS_JSON auth)
- per-context GCS_*_BUCKET_NAME config wired through getStorageConfig
- shared getServeStoragePrefix() replaces hardcoded blob/s3 serve paths
- docs (object-storage, environment-variables), .env.example, helm
values.yaml + values-gcp.yaml storage section
Copy file name to clipboardExpand all lines: apps/docs/content/docs/en/platform/self-hosting/environment-variables.mdx
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ import { Callout } from 'fumadocs-ui/components/callout'
72
72
73
73
## File Storage
74
74
75
-
By default Sim writes uploads to local disk. For production, point it at AWS S3 or Azure Blob. See [Object Storage](/platform/self-hosting/object-storage) for the full setup, bucket layout, and IAM policy.
75
+
By default Sim writes uploads to local disk. For production, point it at AWS S3, Azure Blob, or Google Cloud Storage. See [Object Storage](/platform/self-hosting/object-storage) for the full setup, bucket layout, and IAM policy.
76
76
77
77
| Variable | Description |
78
78
|----------|-------------|
@@ -82,6 +82,9 @@ By default Sim writes uploads to local disk. For production, point it at AWS S3
82
82
|`S3_BUCKET_NAME`| General workspace files bucket — set with `AWS_REGION` to enable S3 |
83
83
|`AZURE_STORAGE_CONTAINER_NAME`| General files container — set with Azure credentials to enable Blob (takes precedence over S3) |
84
84
|`AZURE_CONNECTION_STRING`| Azure connection string, or use `AZURE_ACCOUNT_NAME` + `AZURE_ACCOUNT_KEY`|
85
+
|`GCS_BUCKET_NAME`| General workspace files bucket — enables GCS when neither Azure Blob nor S3 is configured |
86
+
|`GCS_PROJECT_ID`| GCP project ID. Omit to infer from credentials/ADC |
87
+
|`GCS_CREDENTIALS_JSON`| Inline service-account JSON. Omit to use Application Default Credentials (Workload Identity, `GOOGLE_APPLICATION_CREDENTIALS`) |
Sim stores every uploaded file — knowledge base documents, chat attachments, execution outputs, profile pictures, and more — in object storage. Three backends are supported:
11
+
Sim stores every uploaded file — knowledge base documents, chat attachments, execution outputs, profile pictures, and more — in object storage. Four backends are supported:
12
12
13
13
| Backend | When to use |
14
14
|---------|-------------|
15
15
|**Local disk**| Single-node Docker, local development, evaluation |
16
16
|**[AWS S3](https://aws.amazon.com/s3/)**| Production, especially when running more than one app replica |
17
17
|**[Azure Blob](https://learn.microsoft.com/azure/storage/blobs/)**| Production on Azure |
18
+
|**[Google Cloud Storage](https://cloud.google.com/storage)**| Production on GCP |
18
19
19
20
<Callouttype="warning">
20
-
Local disk writes to the container's `/uploads` directory. Files are lost when the container is recreated unless that path is on a persistent volume, and they are **not** shared across replicas. For any multi-replica or production deployment, use S3 or Azure Blob.
21
+
Local disk writes to the container's `/uploads` directory. Files are lost when the container is recreated unless that path is on a persistent volume, and they are **not** shared across replicas. For any multi-replica or production deployment, use S3, Azure Blob, or Google Cloud Storage.
21
22
</Callout>
22
23
23
24
## How the backend is selected
@@ -26,9 +27,10 @@ Sim picks the backend automatically from environment variables — there is no e
26
27
27
28
1.**Azure Blob** — used if `AZURE_STORAGE_CONTAINER_NAME` is set **and** either (`AZURE_ACCOUNT_NAME` + `AZURE_ACCOUNT_KEY`) or `AZURE_CONNECTION_STRING` is set.
28
29
2.**AWS S3** — used if `S3_BUCKET_NAME`**and**`AWS_REGION` are set (and Azure is not configured).
29
-
3.**Local disk** — the fallback when neither is configured.
30
+
3.**Google Cloud Storage** — used if `GCS_BUCKET_NAME` is set (and neither Azure nor S3 is configured).
31
+
4.**Local disk** — the fallback when none is configured.
30
32
31
-
If both Azure and S3 are configured, **Azure wins**. Set only the variables for the backend you intend to use.
33
+
If more than one backend is configured, the first match in that order wins. Set only the variables for the backend you intend to use.
Keep all buckets **private** (no `allUsers` bindings). Sim serves files through short-lived V4 signed URLs, so the buckets never need public read access.
231
+
232
+
Because uploads are sent **directly from the browser** via signed `PUT` requests, each bucket needs a CORS policy that allows your Sim origin:
-**Application Default Credentials (recommended on GCP)** — run Sim with the service account via GKE Workload Identity (or attach it to the GCE instance) and leave `GCS_CREDENTIALS_JSON` unset. Because there is no private key in this mode, generating signed URLs uses the IAM `signBlob` API — grant the service account `roles/iam.serviceAccountTokenCreator`**on itself**:
278
+
279
+
```bash
280
+
gcloud iam service-accounts add-iam-policy-binding \
-**Inline key (for Docker Compose or non-GCP hosts)** — create a JSON key for the service account and set `GCS_CREDENTIALS_JSON` to its contents. With a private key present, signed URLs are generated locally and no extra IAM role is needed.
287
+
288
+
</Step>
289
+
290
+
<Step>
291
+
292
+
### Configure environment variables
293
+
294
+
```bash
295
+
# Credentials — omit both when using Workload Identity / ADC
296
+
GCS_PROJECT_ID=your-project-id # optional; inferred from credentials when unset
|`GCS_PROFILE_PICTURES_BUCKET_NAME`| User avatars | Recommended |
328
+
|`GCS_OG_IMAGES_BUCKET_NAME`| OpenGraph preview images (falls back to `GCS_BUCKET_NAME`) | Optional |
329
+
|`GCS_WORKSPACE_LOGOS_BUCKET_NAME`| Workspace logos (falls back to `GCS_BUCKET_NAME`) | Optional |
330
+
331
+
A full Helm example (Workload Identity, GKE) lives at `helm/sim/examples/values-gcp.yaml`.
332
+
204
333
## Set up an S3-compatible provider (R2, MinIO, B2)
205
334
206
335
Sim works with any S3-compatible store by pointing the S3 client at a custom endpoint. Configure it exactly like AWS S3 (buckets, access key, secret), then add `S3_ENDPOINT` — and `S3_FORCE_PATH_STYLE` where the provider requires path-style addressing. Verified with [Cloudflare R2](https://developers.cloudflare.com/r2/), [MinIO](https://min.io/), [Backblaze B2](https://www.backblaze.com/cloud-storage), and [RustFS](https://rustfs.com/).
@@ -280,10 +409,11 @@ After restarting with the new configuration:
280
409
If uploads fail, check the app logs for credential or permission errors (see [Troubleshooting](/platform/self-hosting/troubleshooting)).
281
410
282
411
<FAQitems={[
283
-
{ question: "What happens if I do not configure any storage variables?", answer: "Sim falls back to local disk, writing files to the /uploads directory inside the app container. This is fine for evaluation but not durable across container recreation and not shared across replicas — use S3 or Azure Blob for production." },
412
+
{ question: "What happens if I do not configure any storage variables?", answer: "Sim falls back to local disk, writing files to the /uploads directory inside the app container. This is fine for evaluation but not durable across container recreation and not shared across replicas — use S3, Azure Blob, or Google Cloud Storage for production." },
284
413
{ question: "Do I have to create all eight S3 buckets?", answer: "No. Only AWS_REGION and S3_BUCKET_NAME are required to enable S3 mode. The purpose-specific buckets are recommended so each file type is isolated; og-images and workspace-logos fall back to the general bucket if their variables are unset." },
285
414
{ question: "How do I avoid storing AWS keys in plaintext?", answer: "On EC2/ECS/EKS, attach the IAM policy to the instance role, task role, or IRSA service-account role and leave AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY unset. Sim resolves credentials through the default AWS SDK provider chain automatically." },
286
-
{ question: "Can I use both S3 and Azure Blob at the same time?", answer: "No. Sim selects a single backend. If both are configured, Azure Blob takes precedence. Set only the variables for the backend you want." },
415
+
{ question: "Can I configure more than one cloud backend at the same time?", answer: "No. Sim selects a single backend, in the order Azure Blob, then S3, then Google Cloud Storage. Set only the variables for the backend you want." },
416
+
{ question: "How do I use GCS without storing a service-account key?", answer: "Run Sim with GKE Workload Identity (or an attached GCE service account) and leave GCS_CREDENTIALS_JSON unset — credentials resolve through Application Default Credentials. Grant the service account roles/iam.serviceAccountTokenCreator on itself so signed URLs can be generated via the IAM signBlob API." },
287
417
{ question: "Are the buckets exposed publicly?", answer: "No, and they should not be. Keep them private with public access blocked. Sim serves files to users through short-lived presigned URLs, so the buckets never need public read permissions." },
288
418
{ question: "Can I use MinIO or Cloudflare R2?", answer: "Yes. Configure it like AWS S3, then set S3_ENDPOINT to your provider's endpoint. For R2, set AWS_REGION=auto and leave S3_FORCE_PATH_STYLE unset. For MinIO/Ceph, set S3_FORCE_PATH_STYLE=true. See the S3-compatible provider section above." },
0 commit comments