Auto-indexing service and GraphQL API for AT Protocol Records quickslice.slices.network/
atproto gleam graphql
at main 229 lines 6.2 kB view raw view rendered
1# Deployment 2 3Deploy Quickslice to production. Railway with one-click deploy is fastest. 4 5## Railway (Recommended) 6 7### 1. Deploy 8 9Click the button to deploy Quickslice with SQLite: 10 11[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/quickslice?referralCode=Ofii6e&utm_medium=integration&utm_source=template&utm_campaign=generic) 12 13Railway prompts you to configure environment variables. Leave the form open while you generate a signing key. 14 15### 2. Generate OAuth Signing Key 16 17Quickslice needs a private key to sign OAuth tokens: 18 19```bash 20brew install goat 21goat key generate -t p256 22``` 23 24This outputs: 25 26``` 27Key Type: P-256 / secp256r1 / ES256 private key 28Secret Key (Multibase Syntax): z42tsQ4W... 29Public Key (DID Key Syntax): did:key:zDnaek... 30``` 31 32Copy only the **Secret Key** value (starts with `z`) and paste it into the `OAUTH_SIGNING_KEY` field in Railway, then click **Save Config**. 33 34### 3. Configure Your Domain 35 36After deployment completes: 37 381. Click on your quickslice service 392. Go to **Settings** 403. Click **Generate Domain** under Networking 41 42Railway creates a public URL like `quickslice-production-xxxx.up.railway.app`. 43 44**Redeploy to apply the domain:** 45 461. Go to **Deployments** 472. Click the three-dot menu on the latest deployment 483. Select **Redeploy** 49 50### 4. Create Admin Account 51 52Visit your domain. The welcome screen prompts you to create an admin account: 53 541. Enter your AT Protocol handle (e.g., `yourname.bsky.social`) 552. Click **Authenticate** 563. Authorize Quickslice on your PDS 574. You're now the instance admin 58 59### 5. Configure Your Instance 60 61From the homepage, go to **Settings**: 62 631. Enter your **Domain Authority** in reverse-domain format (e.g., `xyz.statusphere`) 642. Upload your Lexicons as a `.zip` file (JSON format, directory structure doesn't matter). See [statusphere lexicons](https://tangled.org/slices.network/lexicon-sets/tree/main/statusphere) for an example. 65 ``` 66 lexicons.zip 67 └── lexicons/ 68 └── xyz/ 69 └── statusphere/ 70 └── status.json 71 ``` 723. Click **Trigger Backfill** to import existing records from the network. The Quickslice logo enters a loading state during backfill and the page refreshes when complete. Check Railway logs to monitor progress: 73 ``` 74 INFO [backfill] PDS worker 67/87 done (1898 records) 75 INFO [backfill] PDS worker 68/87 done (1117 records) 76 INFO [backfill] PDS worker 69/87 done (746 records) 77 ... 78 ``` 79 Depending on the lexicon, this could take a few seconds (`xyz.statusphere.*`) to days (`app.bsky.*`) to complete. Be mindful of your available storage and associated cloud provider fees when backfilling large lexicons. 80 81## Environment Variables 82 83| Variable | Required | Default | Description | 84|----------|----------|---------|-------------| 85| `OAUTH_SIGNING_KEY` | Yes | - | P-256 private key for signing OAuth tokens | 86| `DATABASE_URL` | No | `quickslice.db` | Path to SQLite database | 87| `HOST` | No | `127.0.0.1` | Server bind address (use `0.0.0.0` for containers) | 88| `PORT` | No | `8080` | Server port | 89| `SECRET_KEY_BASE` | Recommended | Auto-generated | Session encryption key (64+ chars) | 90| `EXTERNAL_BASE_URL` | No | Auto-detected | Public URL for OAuth redirects | 91 92## Fly.io 93 94### 1. Create a Volume 95 96```bash 97fly volumes create app_data --size 10 98``` 99 100### 2. Configure fly.toml 101 102```toml 103app = 'your-app-name' 104primary_region = 'sjc' 105 106[build] 107 dockerfile = "Dockerfile" 108 109[env] 110 DATABASE_URL = 'sqlite:/data/quickslice.db' 111 EXTERNAL_BASE_URL=https://your-quickslice.fly.dev 112 HOST = '0.0.0.0' 113 PORT = '8080' 114 115[http_service] 116 internal_port = 8080 117 force_https = true 118 auto_stop_machines = 'stop' 119 auto_start_machines = true 120 min_machines_running = 1 121 122[[mounts]] 123 source = 'app_data' 124 destination = '/data' 125 126[[vm]] 127 memory = '1gb' 128 cpu_kind = 'shared' 129 cpus = 1 130``` 131 132### 3. Set Secrets 133 134```bash 135fly secrets set SECRET_KEY_BASE=$(openssl rand -base64 48) 136``` 137 138Generate a signing key and copy only the **Secret Key** value (starts with `z`): 139 140```bash 141goat key generate -t p256 142fly secrets set OAUTH_SIGNING_KEY="z42tsQ4W..." # paste your secret key here 143``` 144 145### 4. Deploy 146 147```bash 148fly deploy 149``` 150 151## Docker Compose 152 153For self-hosted deployments: 154 155```yaml 156version: "3.8" 157 158services: 159 quickslice: 160 image: ghcr.io/bigmoves/quickslice:latest 161 ports: 162 - "8080:8080" 163 volumes: 164 - quickslice-data:/data 165 environment: 166 - HOST=0.0.0.0 167 - PORT=8080 168 - DATABASE_URL=sqlite:/data/quickslice.db 169 - SECRET_KEY_BASE=${SECRET_KEY_BASE} 170 - OAUTH_SIGNING_KEY=${OAUTH_SIGNING_KEY} 171 - EXTERNAL_BASE_URL=https://your-quickslice.example.com 172 restart: unless-stopped 173 174volumes: 175 quickslice-data: 176``` 177 178Create a `.env` file: 179 180```bash 181SECRET_KEY_BASE=$(openssl rand -base64 48) 182OAUTH_SIGNING_KEY=z42tsQ4W... # paste your secret key here 183``` 184 185Start: 186 187```bash 188docker compose up -d 189``` 190 191## Backfill Configuration 192 193NOTE: These configurations are evolving. If your container runs low on memory or crashes, reduce concurrent workers and requests. 194 195Control memory usage during backfill with these variables: 196 197| Variable | Default | Description | 198|----------|---------|-------------| 199| `BACKFILL_MAX_PDS_WORKERS` | 10 | Max concurrent PDS endpoints | 200| `BACKFILL_PDS_CONCURRENCY` | 4 | Max concurrent repo fetches per PDS | 201| `BACKFILL_MAX_HTTP_CONCURRENT` | 50 | Global HTTP request limit | 202 203**1GB RAM:** 204``` 205BACKFILL_MAX_PDS_WORKERS=8 206BACKFILL_PDS_CONCURRENCY=2 207BACKFILL_MAX_HTTP_CONCURRENT=30 208``` 209 210**2GB+ RAM:** Use defaults or increase values. 211 212## Resource Requirements 213 214**Minimum:** 215- Memory: 1GB 216- CPU: 1 shared core 217- Disk: 10GB volume 218 219**Recommendations:** 220- Use SSD-backed volumes for SQLite performance 221- Monitor database size and scale volume as needed 222 223## PostgreSQL Deployment 224 225For deployments requiring a full database server, use the PostgreSQL template: 226 227[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/GRtFyd?referralCode=Ofii6e&utm_medium=integration&utm_source=template&utm_campaign=generic) 228 229This template provisions a PostgreSQL database alongside Quickslice. The `DATABASE_URL` is automatically configured.