Skip to content

Commit de91948

Browse files
committed
Use prebuilt relay image. Add interactive session test page.
1 parent c6644be commit de91948

7 files changed

Lines changed: 488 additions & 64 deletions

File tree

.env.example

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ PORT=3010
1313

1414
# Environment mode ("development" or "production")
1515
# Production enables SSL for PostgreSQL connections
16-
# Default: development
17-
APP_ENV=development
16+
# Default: development (Docker compose files set this to "production" automatically)
17+
# APP_ENV=production
1818

1919
# Database backend: "sqlite" (default, self-hosted) or "postgres" (production)
2020
# Default: sqlite
@@ -174,9 +174,11 @@ DISABLE_REGISTRATION=false
174174
# Shared Stripe Customer Portal URL (from Stripe Dashboard > Settings > Customer portal)
175175
# STRIPE_PORTAL_URL=https://billing.stripe.com/p/login/...
176176

177-
# Base URL for checkout success/cancel redirects
178-
# Default: (empty)
179-
FRONTEND_URL=http://localhost:3010
177+
# Base URL for your relay's public address. Used for email links (password reset,
178+
# email verification, key approval), pairing URLs, and Stripe checkout redirects.
179+
# Default: https://foundryrestapi.com (correct for the hosted relay; set this for self-hosted)
180+
# Example: http://192.168.1.42:3010 for LAN-only, or https://relay.yourdomain.com for internet-facing
181+
# FRONTEND_URL=https://relay.yourdomain.com
180182

181183
# ========================================
182184
# Redis (Multi-Instance Routing)

docker-compose.local.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,18 @@
1212
#
1313
services:
1414
relay:
15-
build:
16-
context: .
17-
dockerfile: go-relay/Dockerfile
15+
image: threehats/foundryvtt-rest-api-relay:latest
1816
container_name: foundryvtt-rest-api-relay
1917
env_file:
2018
- path: .env
2119
required: false
2220
environment:
2321
- DB_TYPE=sqlite
2422
- APP_ENV=production
25-
- PROJECT_ROOT=/workspace
2623
volumes:
27-
- .:/workspace
2824
- ./data:/app/data
29-
network_mode: host
25+
ports:
26+
- "3010:3010"
3027
shm_size: "1g"
3128
restart: unless-stopped
3229
# ── GPU acceleration ─────────────────────────────────────────────────────

docker-compose.postgres.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# No billing, no request limits by default.
44
#
55
# Quick start:
6-
# 1. Copy .env.example to .env and fill in your secrets
7-
# 2. docker compose -f docker-compose.postgres.yml up -d
6+
# 1. docker compose -f docker-compose.postgres.yml up -d
7+
#
8+
# Secrets (CREDENTIALS_ENCRYPTION_KEY, ADMIN_JWT_SECRET) are auto-generated on
9+
# first startup and saved to ./data/.secrets.env.
10+
#
11+
# Optional: copy .env.example to .env to configure SMTP, rate limits, etc.
812
#
913
# For multi-instance (horizontal scaling) with Redis pub/sub:
1014
# - Uncomment the redis service below
@@ -31,9 +35,7 @@ services:
3135
restart: unless-stopped
3236

3337
relay:
34-
build:
35-
context: .
36-
dockerfile: go-relay/Dockerfile
38+
image: threehats/foundryvtt-rest-api-relay:latest
3739
container_name: foundryvtt-rest-api-relay
3840
env_file:
3941
- path: .env

docs/md/installation.md

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,65 +10,62 @@ There are two primary ways to install the FoundryVTT REST API Relay server: usin
1010

1111
## Recommended: Docker Installation
1212

13-
Using Docker and Docker Compose is the simplest way to get the relay server running.
13+
Using Docker and Docker Compose is the simplest way to get the relay server running. Docker pulls the pre-built image automatically.
1414

15-
1. **Clone the repository:**
15+
1. **Download the compose file:**
1616
```bash
17-
git clone https://github.com/JustAnotherIdea/foundryvtt-rest-api-relay.git
18-
cd foundryvtt-rest-api-relay
17+
mkdir -p foundry-relay && cd foundry-relay
18+
curl -O https://raw.githubusercontent.com/ThreeHats/foundryvtt-rest-api-relay/main/docker-compose.local.yml
1919
```
2020

21-
Instead of cloning the repository, you can also download the `docker-compose.local.yml` file from the repo and use that directly.
22-
23-
Or create your own compose file using the image:
24-
```yaml
25-
services:
26-
relay:
27-
# For production stability, pin to a specific version tag instead of 'latest'
28-
# See available tags at: https://github.com/ThreeHats/foundryvtt-rest-api-relay/tags
29-
image: threehats/foundryvtt-rest-api-relay:latest
30-
container_name: foundryvtt-rest-api-relay
31-
ports:
32-
- "3010:3010"
33-
environment:
34-
- APP_ENV=production
35-
- PORT=3010
36-
- DB_TYPE=sqlite
37-
volumes:
38-
- ./data:/app/data
39-
restart: unless-stopped
40-
```
21+
Or create your own minimal compose file:
22+
```yaml
23+
services:
24+
relay:
25+
# For production stability, pin to a specific version tag instead of 'latest'
26+
# See available tags at: https://github.com/ThreeHats/foundryvtt-rest-api-relay/tags
27+
image: threehats/foundryvtt-rest-api-relay:latest
28+
container_name: foundryvtt-rest-api-relay
29+
ports:
30+
- "3010:3010"
31+
environment:
32+
- APP_ENV=production
33+
- DB_TYPE=sqlite
34+
volumes:
35+
- ./data:/app/data
36+
restart: unless-stopped
37+
```
4138

42-
:::tip Version Pinning for Production
43-
For production deployments, replace `latest` with a specific version tag (e.g., `threehats/foundryvtt-rest-api-relay:3.0.0`) to avoid unexpected breaking changes from updates.
44-
:::
39+
:::tip Version Pinning for Production
40+
For production deployments, replace `latest` with a specific version tag (e.g., `threehats/foundryvtt-rest-api-relay:3.0.0`) to avoid unexpected breaking changes from updates.
41+
:::
4542

46-
:::info Request limits
47-
The Docker image has **no request limits by default** (`MONTHLY_REQUEST_LIMIT=0` — unlimited). If you want to enforce a monthly quota on your self-hosted users, add it to your compose file's `environment` section:
48-
```yaml
49-
- MONTHLY_REQUEST_LIMIT=5000
50-
```
51-
Paid subscribers (Stripe `active` status) are always unlimited regardless of this value.
52-
:::
43+
:::info Request limits
44+
The Docker image has **no request limits by default** (`MONTHLY_REQUEST_LIMIT=0` — unlimited). If you want to enforce a monthly quota on your self-hosted users, add it to your compose file's `environment` section:
45+
```yaml
46+
- MONTHLY_REQUEST_LIMIT=5000
47+
```
48+
Paid subscribers (Stripe `active` status) are always unlimited regardless of this value.
49+
:::
5350
54-
:::info Billing / subscription UI
55-
Subscription-related UI (plan badges, upgrade buttons) is automatically **hidden** when `STRIPE_SECRET_KEY` is not set. Self-hosted deployments show a clean dashboard with no billing elements.
56-
:::
51+
:::info Billing / subscription UI
52+
Subscription-related UI (plan badges, upgrade buttons) is automatically **hidden** when `STRIPE_SECRET_KEY` is not set. Self-hosted deployments show a clean dashboard with no billing elements.
53+
:::
5754
58-
:::info Headless sessions
59-
Headless browser sessions (automated GM login via Chromium) are **enabled by default** on self-hosted instances (`ALLOW_HEADLESS=true`). Key tuning variables:
60-
- `HEADLESS_SESSION_TIMEOUT` — inactivity timeout in seconds before a session is stopped (default: `600`). Set to `0` to never time out.
61-
- `MAX_HEADLESS_SESSIONS` — max concurrent headless sessions (default: `0` = no limit).
62-
- `PUPPETEER_EXECUTABLE_PATH` — path to Chrome/Chromium if not auto-detected.
55+
:::info Headless sessions
56+
Headless browser sessions (automated GM login via Chromium) are **enabled by default** on self-hosted instances. Key tuning variables:
57+
- `HEADLESS_SESSION_TIMEOUT` — inactivity timeout in seconds before a session is stopped (default: `600`). Set to `0` to never time out.
58+
- `MAX_HEADLESS_SESSIONS` — max concurrent headless sessions (default: `0` = no limit).
59+
- `PUPPETEER_EXECUTABLE_PATH` — path to Chrome/Chromium if not auto-detected.
6360
64-
See [Server Configuration](./configuration) for the full list of variables.
65-
:::
61+
See [Server Configuration](./configuration) for the full list of variables.
62+
:::
6663
6764
2. **Start the server:**
6865
```bash
6966
docker compose -f docker-compose.local.yml up -d
7067
```
71-
This will pull the latest Docker image and start the relay server in the background. The server will be available at `http://localhost:3010`.
68+
This pulls the latest Docker image and starts the relay server in the background. The server will be available at `http://localhost:3010`.
7269
7370
3. **Create Your Account:**
7471
The default Docker setup uses an SQLite database for persistence, stored in the `data` directory.
@@ -139,7 +136,7 @@ To use it from another device, just hit `http://<that-ip>:3010` instead of `loca
139136
A few things to check if it doesn't work:
140137

141138
- **Host firewall** — make sure inbound TCP on port `3010` is allowed (ufw, firewalld, Windows Defender Firewall, etc.).
142-
- **Docker** — the example `docker-compose.local.yml` already publishes `3010:3010`, which is all you need. If you're running with `docker run`, include `-p 3010:3010`.
139+
- **Docker** — the example `docker-compose.local.yml` publishes `3010:3010`, which is all you need. If you're running with `docker run`, include `-p 3010:3010`.
143140
- **Foundry module** — when configuring the FoundryVTT REST API module, point its relay URL at the LAN IP (`http://192.168.1.42:3010`), not `localhost`, unless Foundry is running on the exact same machine as the relay.
144141
- **CORS** — already permissive (`*`), so browser-based clients on other LAN devices work without extra config.
145142

fly.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ primary_region = 'ord'
4343
enable_6pn = true # Enable private networking for VM-to-VM communication
4444

4545
[[vm]]
46-
memory = '4gb'
46+
memory = '1gb'
4747
cpu_kind = 'shared'
48-
cpus = 4
48+
cpus = 2
4949

5050
[[vm.mounts]]
5151
source = "myapp_data"

go-relay/internal/server/server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,11 @@ func (s *Server) setupRouter() *chi.Mux {
844844
r.Handle("/_astro/*", cacheControl("public, max-age=31536000, immutable", http.StripPrefix("/_astro/", http.FileServer(http.Dir(d)))))
845845
}
846846

847+
// Dev test page for sheet screenshot + interactive sessions
848+
if p := findStaticFile(baseDir, "public/sheet-test.html"); p != "" {
849+
r.Get("/sheet-test", handler.ServeStaticPage(p))
850+
}
851+
847852
// Astro frontend pages
848853
r.Get("/privacy", handler.ServeStaticPage(
849854
filepath.Join(baseDir, "public-dist/privacy/index.html"),

0 commit comments

Comments
 (0)