|
| 1 | +# Hetzner Object Storage Setup |
| 2 | + |
| 3 | +This app uses Hetzner Object Storage (S3-compatible) for image uploads. |
| 4 | + |
| 5 | +## Setup Instructions |
| 6 | + |
| 7 | +### 1. Create Object Storage in Hetzner Cloud Console |
| 8 | + |
| 9 | +1. Go to [Hetzner Cloud Console](https://console.hetzner.cloud/) |
| 10 | +2. Navigate to "Object Storage" |
| 11 | +3. Create a new Object Storage instance |
| 12 | +4. Choose region (recommend `eu-central`) |
| 13 | +5. Create a bucket (e.g., `pyramid-scheme-uploads`) |
| 14 | + |
| 15 | +### 2. Get Access Credentials |
| 16 | + |
| 17 | +1. In Object Storage settings, go to "Access Keys" |
| 18 | +2. Create a new access key |
| 19 | +3. Save the Access Key ID and Secret Access Key |
| 20 | + |
| 21 | +### 3. Configure Environment Variables |
| 22 | + |
| 23 | +Copy `.env.example` to `.env` and fill in your values: |
| 24 | + |
| 25 | +```bash |
| 26 | +# Your Hetzner Object Storage credentials |
| 27 | +AWS_ACCESS_KEY_ID=your_hetzner_access_key |
| 28 | +AWS_SECRET_ACCESS_KEY=your_hetzner_secret_key |
| 29 | +AWS_REGION=eu-central |
| 30 | +AWS_BUCKET=your-bucket-name |
| 31 | +AWS_ENDPOINT=https://your-project.hetzner.eu-central.objects.s3.cloud |
| 32 | +``` |
| 33 | + |
| 34 | +### 4. Find Your Endpoint URL |
| 35 | + |
| 36 | +Your endpoint URL format: `https://{your-project-id}.{region}.objects.s3.cloud` |
| 37 | + |
| 38 | +Example: `https://12345678.eu-central.objects.s3.cloud` |
| 39 | + |
| 40 | +You can find this in the Hetzner Cloud Console under Object Storage details. |
| 41 | + |
| 42 | +## Testing |
| 43 | + |
| 44 | +Once configured, poster uploads will automatically use Hetzner Object Storage in both development and production environments. |
| 45 | + |
| 46 | +## Bucket Permissions |
| 47 | + |
| 48 | +The bucket should allow: |
| 49 | +- `GetObject` - To display uploaded images |
| 50 | +- `PutObject` - To upload new images |
| 51 | +- `DeleteObject` - To delete images (if needed) |
| 52 | + |
| 53 | +Hetzner buckets are private by default, which is perfect for this use case. |
| 54 | + |
| 55 | +## CORS Configuration (if needed) |
| 56 | + |
| 57 | +If you need direct browser uploads in the future, configure CORS: |
| 58 | + |
| 59 | +```xml |
| 60 | +<CORSConfiguration> |
| 61 | + <CORSRule> |
| 62 | + <AllowedOrigin>https://your-domain.com</AllowedOrigin> |
| 63 | + <AllowedMethod>GET</AllowedMethod> |
| 64 | + <AllowedMethod>POST</AllowedMethod> |
| 65 | + <AllowedMethod>PUT</AllowedMethod> |
| 66 | + <AllowedHeader>*</AllowedHeader> |
| 67 | + </CORSRule> |
| 68 | +</CORSConfiguration> |
| 69 | +``` |
0 commit comments