The Surqo backend runs on Fly.io instead of Render or Railway for one critical reason:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ricardomb-tech/surqo/llms.txt
Use this file to discover all available pages before exploring further.
auto_stop_machines = false. Render’s free tier hibernates containers after 15 minutes of inactivity, causing 60-second cold starts that break the persistent MQTT consumer and WebSocket broadcast manager. Fly.io’s min_machines_running = 1 guarantees at least one machine is always live — no delays, no dropped MQTT messages, no stale WebSocket connections.
Prerequisites
Before deploying, installflyctl and authenticate:
Deployment Steps
Launch the app on Fly.io
From the When prompted, answer No to overwriting the existing
backend/ directory, initialise the Fly.io application. The --region dfw flag places the VM in Dallas — the closest Fly.io region to Colombia, minimising latency for MQTT messages coming from HiveMQ Cloud.fly.toml — the configuration is already committed in the repository.Set all required secrets
Surqo reads every sensitive credential from environment variables. Push them as Fly secrets (encrypted at rest, injected at runtime):
Deploy the container
The
--remote-only flag builds the Docker image on Fly.io’s remote builders — no local Docker daemon required.fly.toml Configuration
Thebackend/fly.toml file controls every aspect of the deployment. The most important settings are auto_stop_machines = false and min_machines_running = 1, which together guarantee the MQTT consumer and WebSocket manager are never interrupted.
backend/fly.toml
/health every 30 seconds. If the check fails, Fly.io automatically restarts the machine and routes traffic away until it recovers.
Dockerfile
The container image usespython:3.11-slim with uv as the package manager (10–100× faster than pip) and serves the application with Uvicorn on port 8080 to match Fly.io’s expected internal port.
backend/Dockerfile
The
--no-dev flag in uv sync excludes development tools (ruff, pytest, etc.) from the production image, keeping it lean.Ongoing Operations
After the initial deploy, use these commands for day-to-day management:Production URLs
| Resource | URL |
|---|---|
| API base | https://surqo-api.fly.dev |
| Health check | https://surqo-api.fly.dev/health |
uv run fastapi dev app/main.py and open http://localhost:8000/docs.