> ## Documentation Index
> Fetch the complete documentation index at: https://docs.artbucket.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Fly

> The image on Fly Machines, with Fly Postgres and Tigris storage.

```bash theme={null}
fly launch --image ghcr.io/pwnera/artbucket:1 --no-deploy --name acme-assets
```

## Database

Any Postgres 16 or later works: Fly's Managed Postgres, Neon, Supabase. Make
one, then hand the app its connection string:

```bash theme={null}
fly secrets set DATABASE_URL=postgres://...
```

## Storage

Tigris is S3-compatible and built into Fly:

```bash theme={null}
fly storage create              # sets AWS_* and BUCKET_NAME
```

Artbucket reads `S3_*`, so copy them over:

```bash theme={null}
fly secrets set \
  S3_ENDPOINT=https://fly.storage.tigris.dev \
  S3_REGION=auto \
  S3_BUCKET=<BUCKET_NAME> \
  S3_ACCESS_KEY_ID=<AWS_ACCESS_KEY_ID> \
  S3_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \
  S3_FORCE_PATH_STYLE=false
```

## The rest

```bash theme={null}
fly secrets set \
  APP_URL=https://acme-assets.fly.dev \
  BETTER_AUTH_SECRET="$(openssl rand -base64 32)"
fly deploy
```

In `fly.toml`, the app listens on 3000:

```toml fly.toml theme={null}
[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = "stop"
  auto_start_machines = true
  min_machines_running = 1
```

Keep one machine running: the sweeper runs inside the app, every six hours.

<Note>
  The rate limit counts per machine. With several, each allows `RATE_LIMIT`
  requests a minute on its own.
</Note>
