Skip to content

Deploy on Fly

Deploying Directus to Fly.io.

From the monorepo root:

Terminal window
pnpm deploy:backend

Or from backend/:

Terminal window
pnpm fly:deploy
  • backend/fly.toml: app name, region, health checks, VM size
  • backend/Dockerfile: Directus base image + extensions
  • backend/start-with-migrate.sh: runs migrations on startup

Set via Fly CLI:

Terminal window
fly secrets set KEY=value -a real-ireland-app

Required secrets include database password, R2 S3 credentials (STORAGE_S3_KEY, STORAGE_S3_SECRET), and KEY/SECRET for Directus. Prefer Fly secrets over plain [env] in fly.toml for sensitive values.

Terminal window
fly secrets set STORAGE_S3_KEY="..." STORAGE_S3_SECRET="..." -a real-ireland-app

Fly probes GET /server/ping on port 8055 (no database query).

After switching STORAGE_LOCATIONS from gcs to s3, existing directus_files rows still reference storage = 'gcs' until updated. Without that step, /assets/* returns 500 (Location "gcs" doesn't exist) and the admin UI can hit rate limits (Under pressure).

Deploy runs backend/migrations/001-storage-gcs-to-s3.js automatically. To run manually:

Terminal window
node backend/scripts/migrate-storage-location-to-s3.mjs

Or SQL: UPDATE directus_files SET storage = 's3' WHERE storage = 'gcs';