DigitalOcean App Platform
Install Fieldbook with App Platform, Managed PostgreSQL, self-hosted Supabase, private Spaces and Google sign-in.
This recipe runs Fieldbook and Supabase Auth, REST/PostgREST and Storage on App Platform. Managed PostgreSQL stores the database; private Spaces stores uploaded files. It uses Google sign-in and an optional DigitalOcean Inference Router. No hosted Supabase account or separate gateway is required.
Pinned components and compatibility
The tested configuration uses PostgreSQL 17, one Fieldbook instance, and the component images pinned by tag and digest in the repository's Dockerfiles. Further PostgreSQL majors, independently mixed backend versions and multiple Fieldbook instances need a compatibility review.
| Component | Tested version |
|---|---|
| Fieldbook runtime | Node 22.23.3, pnpm 10.17.1, locked Next.js 16.3.8 |
| Supabase Auth | supabase/gotrue:v2.197.0 |
| PostgREST | postgrest/postgrest:v16.4 |
| Supabase Storage | supabase/storage-api:v1.81.1 |
| Managed PostgreSQL | 17.11; DO maintains minor versions |
| Optional inference models | openai-gpt-oss-20b, openai-gpt-oss-120b through a custom router |
The configuration starts from the Supabase self-hosting snapshot at cb4307f (opens in a new tab). Compared with the DigitalOcean template (opens in a new tab), it uses the pins above, separate service database roles, verified database TLS, durable signing keys, Fieldbook's token hook and cleanup job, and the ingress aliases described below. Studio, Realtime, Edge Functions and a gateway are omitted. A startup wrapper writes the database CA to a private temporary file; the PostgREST image also includes a pinned static BusyBox shell for that wrapper.
1. Prepare the source, database and private files
Copy or fork the repository (opens in a new tab) and select the source version you want to run. With Node.js 22 and pnpm 10.17.1, install its dependencies:
pnpm install --frozen-lockfileCreate a dedicated, empty Managed PostgreSQL 17 database and a private Spaces bucket. Put the app and database in the same intended VPC and region. The example uses App Platform region sfo and database defaultdb; update the region, database attachment and service URLs if yours differ.
Download the database CA certificate. Use its private/VPC DNS hostname in the three backend service connection URLs. The local setup connection can use the public DNS endpoint, with your operator connection added to trusted sources. Use direct database connections, not a transaction pooler.
Create Spaces credentials scoped to the bucket with read, write and delete access. Keep its ACL private and its public CDN off. The Storage service supplies authorized file access.
Generate durable keys in an existing private directory outside the repository:
node scripts/generate-self-hosted-keys.mjs --output /private/path/fieldbook-keys.envThe command creates an ES256 signing key, a Storage signing secret, JWT API keys and three separate service database passwords. It refuses to overwrite an existing file. Keep these values across restarts and redeployments and include them in your configuration backup. The generated API keys expire after five years.
Create a separate private setup file containing:
FIELDBOOK_SETUP_DATABASE_URL=postgresql://doadmin:YOUR_PASSWORD@YOUR_DATABASE_DNS:25060/defaultdb
FIELDBOOK_SETUP_DATABASE_CA=/private/path/cluster-ca.crt
FIELDBOOK_URL=https://learn.example.orgThen prepare the empty backend:
node --env-file=/private/path/database.env --env-file=/private/path/fieldbook-keys.env scripts/prepare-digitalocean.mjsCheck the displayed target and type PREPARE. The command creates the required roles, schemas and helpers with independent service passwords. Auth and Storage create their own tables when they start. This command is for a fresh backend, not an upgrade or restore. Keep the administrator connection out of running services.
2. Configure the app spec and hostname
Copy .do/app.yaml (opens in a new tab) into a private operator workspace and replace every YOUR_ placeholder: source repository and branch, VPC, database attachment and DNS, service passwords, Spaces, Google credentials, owner email and hostname. Keep populated specs and secret files outside Git.
Choose service sizes for your workload. The example uses one instance per service and a connection pool of five for each backend component. Database capacity also needs room for background connections and old/new instances overlapping during deployment.
Map the generated keys as follows:
| Generated value | Component variables |
|---|---|
ANON_KEY | Fieldbook NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY; Storage ANON_KEY |
SERVICE_ROLE_KEY | Fieldbook SUPABASE_SECRET_KEY; Storage SERVICE_KEY |
JWT_SECRET | Auth GOTRUE_JWT_SECRET; Storage AUTH_JWT_SECRET |
JWT_KEYS | Auth GOTRUE_JWT_KEYS |
JWT_JWKS | REST PGRST_JWT_SECRET; Storage JWT_JWKS |
| Three service passwords | Their matching Auth, REST and Storage connection URLs |
JWT_JWKS includes a symmetric verification secret and is server-only. This recipe uses the generated JWT ANON_KEY and SERVICE_ROLE_KEY, rather than hosted Supabase's opaque API keys.
Give server secrets runtime-only secret scope. The two NEXT_PUBLIC_SUPABASE_ values need RUN_AND_BUILD_TIME scope. Set NEXT_PUBLIC_SUPABASE_URL to the literal canonical HTTPS origin followed by /backend, such as https://learn.example.org/backend. (opens in a new tab) Dockerfile build arguments cannot resolve runtime ${APP_URL} bindings. Rebuild Fieldbook if that public backend address changes. See DO's environment-variable guidance (opens in a new tab).
Use a primary custom HTTPS hostname and keep disable_edge_cache: true. Add its CNAME at your DNS provider using DO's assigned target; changing nameservers is not required. Runtime ${APP_URL} and FIELDBOOK_URL must resolve to that canonical origin.
3. Bootstrap the app's private database connection
For the first deployment, retain only Fieldbook and its / ingress rule from the populated spec. Keep the VPC, database attachment, hostname and final public Supabase variables; omit Auth, REST, Storage, cleanup and their ingress rules for now.
Deploy that same app. Its /fieldbook-build.json health check works before the backend is available; the ordinary interface does not yet work.
Read the app's vpc.egress_ips from its Networking information or the app API. Add those exact private addresses to the database's trusted sources. Selecting the app itself as a trusted source does not authorize this private path. Recheck the addresses after network or component changes. See DO's VPC guidance (opens in a new tab).
4. Add the backend and Google sign-in
Add Auth, REST, Storage and their ingress rules from the populated spec, retaining the same app. Leave cleanup out until the next step. Initially keep signup, the custom token hook and the OAuth server disabled as specified in the example.
All three backend database connections use sslmode=verify-full and the downloaded CA. Storage also receives the CA PEM through DATABASE_SSL_ROOT_CERT for its tenant pool. Use a certificate-matching DNS hostname, not an IP address, and retain certificate verification.
Keep these public routes from the spec:
| Public path | Component routing |
|---|---|
/backend/auth/v1 | Auth, stripping the prefix |
/backend/rest/v1 | PostgREST, stripping the prefix |
/backend/storage/v1 | Storage, stripping the prefix |
/.well-known/oauth-authorization-server/backend/auth/v1 | Auth's OAuth discovery route |
/upload/resumable | Storage, preserving the prefix returned in TUS upload URLs |
/ | Fieldbook |
These routes cover OAuth discovery and subsequent resumable-upload requests as well as the initial API request. STORAGE_PUBLIC_URL uses the canonical origin; forwarded-prefix interpretation remains off.
Retain UPLOAD_SIGNED_URL_EXPIRATION_TIME=7200 and TUS_URL_EXPIRY_MS=7200000. They give uploads a two-hour authorization window. After authorization expires, choose the file again; saved partial bytes do not extend permission. Storage's FILE_SIZE_LIMIT is an operator setting; the example uses 5 GiB. Fieldbook's optional FIELDBOOK_UPLOAD_MAX_BYTES can impose a smaller application limit.
In Google Cloud, configure an OAuth Web application client with the Fieldbook origin and this redirect URI:
https://YOUR-FIELDBOOK-HOST/backend/auth/v1/callbackUse the basic openid, email and profile scopes. Google's audience guidance (opens in a new tab) describes its account and publishing settings.
Auth's external URL and JWT issuer are FIELDBOOK_URL/backend/auth/v1; its Site URL is FIELDBOOK_URL and its application redirect allowlist is FIELDBOOK_URL/auth/callback. The spec disables email/password, phone and anonymous signups. Keep GOTRUE_DISABLE_SIGNUP=true until Fieldbook setup completes.
Wait for Auth /health, Storage /status and internal PostgREST :3001/ready. Confirm the Auth and Storage tables and their migration ledgers exist before installing Fieldbook.
5. Install Fieldbook and connect cleanup
With the private setup file from step 1, run:
node --env-file=/private/path/database.env scripts/setup-self-hosted.mjsCheck the target and type SETUP. The command applies the released baseline and any later Fieldbook migrations, recording them in supabase_migrations.schema_migrations. It retains the shared application SQL and substitutes external cleanup scheduling for the hosted pg_cron/pg_net schedule. It refuses an installation with existing accounts, content or files.
After setup, set Auth's GOTRUE_DISABLE_SIGNUP=false and GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_ENABLED=true. Retain the configured hook URI pg-functions://postgres/public/fb_access_token_hook.
Read the generated worker credential through your private administrator database connection:
select secret from public.fb_cleanup_config where id = true;Set it as the cleanup job's runtime-only secret FIELDBOOK_CLEANUP_SECRET. Add the hourly job from the app spec and deploy the updated configuration. Preserve its URL, secret and schedule through subsequent updates. Check that the job succeeds and that its next scheduled run is accepted; Recently deleted also reports cleanup health.
6. Start using Fieldbook
Sign in with FIELDBOOK_OWNER_EMAIL to create the first administrator. Changing that variable later does not transfer ownership. In Manage organization → Access, choose browsing and registration settings. Closed registration uses preregistered Google emails in People.
Create and publish content, read it, save course progress and upload a representative file. Ordinary uploads and resumable uploads above 6 MiB use the same private Storage service. A public installation admits guests to published content through Fieldbook; it does not make the Spaces bucket public.
For an optional isolated preview, set FIELDBOOK_ENVIRONMENT=preview and FIELDBOOK_PREVIEW_SUPABASE_URL to its exact backend URL. Keep preview credentials separate from production. See upgrading and operations (opens in a new tab) for application updates, migrations, backend updates and recovery.
Optional MCP
Enable Auth's GOTRUE_OAUTH_SERVER_ENABLED and retain /oauth/consent as its authorization path, the custom access-token hook, and the original asymmetric signing keys. Enable GOTRUE_OAUTH_SERVER_ALLOW_DYNAMIC_REGISTRATION if your client requires dynamic registration; otherwise register its exact callback and authentication method manually through the Auth API.
Connect the client to https://YOUR-FIELDBOOK-HOST/api/mcp. Each person separately approves the connection capabilities their current role permits. Human Google sign-in alone does not authorize MCP. Confirm discovery, consent and a relevant authenticated operation in the client you intend to use. See Set up MCP and the tool contract (opens in a new tab).
Optional DigitalOcean Inference Router
Configure a custom Inference Router (opens in a new tab) in DigitalOcean with explicit model pools and fallback order. Model choices, routing, provider terms and service charges belong to your DigitalOcean configuration. Fieldbook uses that router and does not administer it.
Set these variables on Fieldbook:
FIELDBOOK_AI_ROUTER=digitalocean
DIGITALOCEAN_INFERENCE_ROUTER=router:fieldbook
DIGITALOCEAN_VERIFIED_MODELS=openai-gpt-oss-20b,openai-gpt-oss-120b
DIGITALOCEAN_MODEL_ACCESS_KEY=YOUR_ROUTER_SCOPED_MODEL_ACCESS_KEY
DIGITALOCEAN_ROUTER_READ_TOKEN=YOUR_SEPARATE_GENAI_READ_TOKENUse your router's exact router:<name> target. Every policy must name its models, with at least one explicit fallback model. Automatic inference-router targets, implicit preset pools and dedicated endpoints are outside this configuration.
The tested models are listed above. DIGITALOCEAN_VERIFIED_MODELS must cover every pool and fallback model you have checked for forced tool calling and streamed Chat Completions. Additional models need those checks before being included. Fieldbook also checks their current serverless text and tool_calling metadata; a catalog entry alone does not verify an inference request.
Create a model access key (opens in a new tab) restricted to the router and its explicit pool/fallback models. Leaving the foundation-model selection empty can grant All models, even with a router selected; check the resulting scope. For discovery, use a separate API token with genai:read and the required read-only dependencies regions:read, sizes:read and actions:read. Keep both credentials server-side and deployment/router-write credentials outside Fieldbook.
Redeploy, then open Manage organization → Ask AI. The Routing section shows the configured router, model pools and fallback order. If its saved target differs, choose Use configured router and save. Select published sources and answer guidance, enable the feature, and check a real answer and its citation. Pool and fallback changes stay in DigitalOcean; opening the settings page does not run inference.