Skip to main content
Deploy Pongo to Fly.io for always-on persistent VMs with automatic scheduler and archiver startup.

Quick Start

1

Install flyctl

# macOS
brew install flyctl

# Linux
curl -L https://fly.io/install.sh | sh

# Windows
iwr https://fly.io/install.ps1 -useb | iex
2

Authenticate with Fly.io

fly auth login
3

Clone and navigate to repository

git clone https://github.com/TimMikeladze/pongo.git
cd pongo
4

Launch the app

fly launch
This command:
  • Detects the Dockerfile and fly.toml configuration
  • Creates a new Fly.io app
  • Provisions a 1GB volume for SQLite data
  • Deploys the application
5

Set environment variables

# Required: Enable scheduler auto-start
fly secrets set SCHEDULER_ENABLED=true

# Optional: Use PostgreSQL instead of SQLite
fly secrets set DATABASE_URL="postgres://user:pass@host:5432/pongo"

# Optional: Password-protect dashboard
fly secrets set ACCESS_CODE="your-secret-password"

# Optional: Enable archiver
fly secrets set ARCHIVAL_ENABLED=true
6

Deploy the application

fly deploy

Configuration

fly.toml

The included fly.toml configuration:
fly.toml
app = 'pongo-production'
primary_region = 'sjc'

[build]

[[mounts]]
  source = 'pongo_data'
  destination = '/data'
  initial_size = '1gb'

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = 'off'
  auto_start_machines = true
  min_machines_running = 1
  max_machines_running = 1

  [[http_service.checks]]
    interval = '30s'
    timeout = '5s'
    grace_period = '10s'
    method = 'GET'
    path = '/'

[scale]
  count = 1

[[vm]]
  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

Key Settings

  • Volume mount: Persistent storage at /data for SQLite database
  • Auto-stop disabled: Keeps machine always running for reliable monitoring
  • Health checks: Ensures app stays healthy
  • Single machine: Cost-effective for most monitoring needs

Environment Variables

Required

VariableDescriptionDefault
SCHEDULER_ENABLEDAuto-start scheduler in Dockerfalse

Optional

VariableDescriptionDefault
DATABASE_URLPostgreSQL connection string (omit for SQLite)file:/data/pongo.db
ACCESS_CODEDashboard password- (no auth)
PONGO_REGIONRegion identifier for multi-region setupsdefault
ARCHIVAL_ENABLEDAuto-start archiver in Dockerfalse
S3_BUCKETS3 bucket for archives-
S3_REGIONS3 region-
S3_ACCESS_KEY_IDS3 access key-
S3_SECRET_ACCESS_KEYS3 secret key-

Automatic Scheduler Startup

The included docker-entrypoint.js automatically starts the scheduler when SCHEDULER_ENABLED=true:
docker-entrypoint.js
const schedulerEnabled = process.env.SCHEDULER_ENABLED === "true";
const archiverEnabled = process.env.ARCHIVAL_ENABLED === "true";

if (command === "bun run start") {
  // Start scheduler in background if enabled
  if (schedulerEnabled) {
    spawn("bun", ["run", "src/scheduler/index.ts"], {
      shell: true,
      stdio: "inherit",
      env,
    });
  }

  // Start archiver in background if enabled
  if (archiverEnabled) {
    spawn("bun", ["run", "src/archiver/index.ts"], {
      shell: true,
      stdio: "inherit",
      env,
    });
  }
}
This means:
  • Dashboard, scheduler, and archiver run in a single machine
  • No separate processes or services needed
  • Simplified deployment and lower costs

Database Options

SQLite (Default)

By default, Pongo uses SQLite stored in the mounted volume:
# Database automatically stored at /data/pongo.db
DATABASE_URL=file:/data/pongo.db
Benefits:
  • Zero configuration
  • No external dependencies
  • Fast local access
  • WAL mode for concurrent reads

PostgreSQL

For production deployments or multi-region setups, use PostgreSQL:
fly secrets set DATABASE_URL="postgres://user:pass@host:5432/pongo"
PostgreSQL Options:
  • Fly.io Postgres: fly postgres create
  • External providers: Neon, Supabase, Railway

Scaling

Vertical Scaling

Increase machine resources:
# Increase memory
fly scale memory 2048

# Increase CPUs
fly scale count 2

Multi-Region Deployment

Deploy to multiple regions for geographic monitoring:
# Deploy to US East
fly regions add iad
fly scale count 2

# Set region identifier
fly secrets set PONGO_REGION=us-east
Each region’s scheduler should point to the same database.

Monitoring and Logs

View logs

fly logs

SSH into machine

fly ssh console

Check machine status

fly status

View metrics

fly dashboard

Troubleshooting

Scheduler not running

  1. Verify SCHEDULER_ENABLED=true:
    fly secrets list
    
  2. Check logs for scheduler startup:
    fly logs | grep scheduler
    
  3. SSH into machine and check processes:
    fly ssh console
    ps aux | grep scheduler
    

Database persistence issues

  1. Verify volume is mounted:
    fly volumes list
    
  2. Check volume size:
    fly ssh console
    df -h /data
    
  3. Expand volume if needed:
    fly volumes extend <volume-id> --size 5
    

Out of memory

Increase machine memory:
fly scale memory 2048

Cost Optimization

Auto-stop during low usage

For development environments:
[http_service]
  auto_stop_machines = 'suspend'
  auto_start_machines = true
  min_machines_running = 0
This will stop monitors from running when the machine suspends. Only use for development.

Use shared CPU

The default configuration uses shared CPUs, which are cost-effective for most monitoring workloads:
[[vm]]
  cpu_kind = 'shared'
  cpus = 1

Updating

Pull latest changes and redeploy:
git pull origin main
fly deploy

Build docs developers (and LLMs) love