Fly.io
Deploy Inboxorcist globally on Fly.io's edge network.
Fly.io runs your app on servers close to your users worldwide. Great for low-latency access from anywhere.
Prerequisites
Install the Fly CLI:
# macOS
brew install flyctl
# Linux
curl -L https://fly.io/install.sh | sh
# Windows
powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"Log in to Fly:
fly auth loginDeployment Steps
Step 1: Launch the App
From the repository root:
fly launch --config deploy/fly.tomlWhen prompted:
- App name:
inboxorcist(or your preferred name) - Region: Choose the closest to you
- PostgreSQL: No (unless you want it)
- Redis: No (unless you want it)
Step 2: Create a Volume
Create persistent storage for SQLite:
fly volumes create inboxorcist_data --size 1 --region iadReplace iad with your chosen region.
Step 3: Set Secrets
# Set Google OAuth credentials
fly secrets set GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
fly secrets set GOOGLE_CLIENT_SECRET=GOCSPX-your-secret
# Generate and set security secrets
fly secrets set JWT_SECRET=$(openssl rand -base64 32)
fly secrets set ENCRYPTION_KEY=$(openssl rand -hex 32)
# Set app URL (replace with your app name)
fly secrets set APP_URL=https://inboxorcist.fly.devStep 4: Deploy
fly deployStep 5: Update Google OAuth
Add your Fly.io URL to Google Cloud Console:
- Go to Google Cloud Console
- Edit your OAuth client
- Add redirect URI:
https://inboxorcist.fly.dev/auth/google/callback
Configuration Reference
The deploy/fly.toml file:
app = 'inboxorcist'
primary_region = 'iad'
[build]
dockerfile = "Dockerfile"
[http_service]
internal_port = 6616
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
[[vm]]
memory = "512mb"
cpu_kind = "shared"
cpus = 1
[mounts]
source = "inboxorcist_data"
destination = "/app/data"
[[http_service.checks]]
path = "/health"
grace_period = "10s"Adding PostgreSQL (Optional)
Create a Fly Postgres cluster:
fly postgres create --name inboxorcist-db
fly postgres attach inboxorcist-dbFly automatically sets DATABASE_URL in your app.
Adding Redis (Optional)
For persistent job queues:
fly redis create --name inboxorcist-redisThen set the connection URL:
fly secrets set REDIS_URL=redis://...Custom Domain
# Add certificate
fly certs add yourdomain.com
# View DNS instructions
fly certs show yourdomain.comUpdate your DNS records as instructed, then update environment variables:
fly secrets set APP_URL=https://yourdomain.comScaling
Scale Memory/CPU
fly scale memory 1024
fly scale vm shared-cpu-2xScale Instances
fly scale count 2Scale Regions
Deploy to multiple regions:
fly regions add lhr fra
fly scale count 3Monitoring
View Logs
fly logsCheck Status
fly statusOpen Dashboard
fly dashboardSSH into Machine
fly ssh consoleUpdating
Deploy the latest changes:
fly deployPricing
Fly.io's free tier includes:
- 3 shared-cpu-1x VMs
- 160GB outbound bandwidth
- 3GB persistent volumes
Troubleshooting
Deployment Fails
Check build logs:
fly logs --instance <instance-id>Health Check Fails
Verify the health endpoint:
fly ssh console -C "curl http://localhost:6616/health"Volume Not Mounted
Ensure volume exists in the correct region:
fly volumes listSecrets Not Applied
Redeploy after setting secrets:
fly secrets list
fly deploy