> For the complete documentation index, see [llms.txt](https://gyrinx.gitbook.io/gyrinx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gyrinx.gitbook.io/gyrinx/technical-reference/deployment-environment-variables.md).

# Deployment Environment Variables

## Required Environment Variables for File Uploads

When deploying to production, set these environment variables in your Cloud Run service:

### Google Cloud Storage Configuration

```bash
# Required: Your GCS bucket name for uploaded files
GS_BUCKET_NAME=your-bucket-name

# Optional: Set if using a CDN domain instead of direct GCS
CDN_DOMAIN=cdn.gyrinx.app  # Only if using settings_prod_cdn.py

# Automatically set by Cloud Run, but can be overridden
GOOGLE_CLOUD_PROJECT=your-project-id
```

### Example Cloud Run Deployment

```bash
gcloud run deploy gyrinx \
  --image gcr.io/YOUR_PROJECT/gyrinx:latest \
  --region europe-west2 \
  --set-env-vars "GS_BUCKET_NAME=your-uploads-bucket" \
  --service-account your-service-account@your-project.iam.gserviceaccount.com
```

### Bucket Setup Checklist

1. Create bucket in europe-west2 with uniform access:

   ```bash
   gsutil mb -l europe-west2 -b on gs://your-uploads-bucket
   ```
2. Grant public read access:

   ```bash
   gsutil iam ch allUsers:objectViewer gs://your-uploads-bucket
   ```
3. Grant service account write access:

   ```bash
   gsutil iam ch serviceAccount:YOUR_SA@PROJECT.iam.gserviceaccount.com:objectAdmin gs://your-uploads-bucket
   ```


---

# 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://gyrinx.gitbook.io/gyrinx/technical-reference/deployment-environment-variables.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.
