Files
openhuman/.fly/fly.toml
T
21f4f9d8d2 deploy openhuman-core to fly.io
## Summary

- Add `fly.toml` template for deploying `openhuman-core` headlessly to Fly.io, complementing the existing DigitalOcean and Docker Compose paths
- Document Fly.io as a fourth cloud deployment option in `gitbooks/features/cloud-deploy.md` with step-by-step setup (launch, volume, secrets, deploy, desktop connect)
- Include production-safe secret recommendations (`OPENHUMAN_AUTO_UPDATE_RPC_MUTATIONS_ENABLED=false`, `OPENHUMAN_AUTO_UPDATE_RESTART_STRATEGY=supervisor`) and token rotation guidance
- Document a known UID mismatch gotcha that surfaces when switching between the local `Dockerfile` build (UID 10001) and the pre-built GHCR image (UID 1000)

## Problem

There was no documented path for deploying `openhuman-core` to Fly.io, leaving users to figure out the configuration themselves. The UID mismatch between the local Dockerfile and the pre-built GHCR image also produced a silent `Permission denied (os error 13)` on the workspace volume with no documented fix.

## Solution

- `fly.toml` ships as a ready-to-use template with persistent volume mount, health check against `/health`, and non-sensitive env defaults. Sensitive values (`OPENHUMAN_CORE_TOKEN`, `BACKEND_URL`, etc.) are set via `fly secrets` as documented.
- The Fly.io section mirrors the structure of the existing DO and Docker Compose sections for consistency.
- The UID mismatch gotcha is documented with a concrete `chown -R` + `fly machine restart` fix.
- CI workflow is documented inline so users can opt in without a file being auto-triggered on the upstream repo.

## Submission Checklist

- [x] Tests added or updated — `N/A: documentation-only change, no executable code modified`
- [x] **Diff coverage ≥ 80%** — `N/A: documentation-only change`
- [x] Coverage matrix updated — `N/A: documentation-only change`
- [x] All affected feature IDs listed — `N/A: documentation-only change`
- [x] No new external network dependencies introduced — `N/A: no code changes`
- [x] Manual smoke checklist updated — `N/A: does not touch release-cut surfaces`
- [x] Linked issue closed — `N/A: no associated issue`

## Impact

- No runtime impact — documentation and template file only
- `fly.toml` is a template; upstream CI will not trigger Fly.io deploys (no `FLY_API_TOKEN` secret is set on the upstream repo)

## Related

- Closes: —
- Follow-up PR(s)/TODOs: Investigate unifying UID between local `Dockerfile` and GHCR image builds to eliminate the UID mismatch gotcha permanently

---

## AI Authored PR Metadata

### Linear Issue
- Key: N/A
- URL: N/A

### Commit & Branch
- Branch: `main` (fork: `umarhadi/openhuman`)
- Commit SHA: `9314fd6be519662fb931414b256de3c57f54e7b8`

### Validation Run
- [x] `pnpm --filter openhuman-app format:check` — N/A (no app code changed)
- [x] `pnpm typecheck` — N/A (no app code changed)
- [x] Focused tests: N/A
- [x] Rust fmt/check — N/A (no Rust code changed)
- [x] Tauri fmt/check — N/A (no Tauri code changed)

### Validation Blocked
- N/A

### Behavior Changes
- Intended behavior change: None — documentation and template only
- User-visible effect: Contributors can now follow a documented path to deploy `openhuman-core` to Fly.io

### Parity Contract
- Legacy behavior preserved: Existing DO and Docker Compose deploy paths unchanged
- Guard/fallback/dispatch parity checks: N/A

### Duplicate / Superseded PR Handling
- Duplicate PR(s): None known
- Canonical PR: This PR
- Resolution: N/A

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Added Fly.io as a supported cloud deployment platform alongside existing options.

* **Documentation**
  * Expanded cloud deployment guide with full Fly.io setup: prerequisites, app launch/configuration, persistent volumes, secrets management, pointing desktop to hosted core, sample CI/CD workflow, image/tag guidance, log viewing, redeploy steps, and troubleshooting for volume UID mismatches.

<!-- review_stack_entry_start -->

[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/tinyhumansai/openhuman/pull/2295?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: umarhadi <hi@umarhadi.dev>
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
2026-05-20 16:44:35 -07:00

50 lines
1.4 KiB
TOML

# .fly/fly.toml — openhuman-core on Fly.io
#
# See gitbooks/features/cloud-deploy.md for the full deployment guide.
# See https://fly.io/docs/reference/configuration/ for fly.toml reference.
#
# Quickstart:
# fly launch --no-deploy --config .fly/fly.toml
# fly volumes create openhuman_workspace --size 5 --region <region> --config .fly/fly.toml
# fly secrets set OPENHUMAN_CORE_TOKEN="$(openssl rand -hex 32)"
# fly secrets set BACKEND_URL="https://api.tinyhumans.ai"
# fly deploy --config .fly/fly.toml
app = '<your-app-name>'
primary_region = '<your-region>'
[build]
dockerfile = "Dockerfile"
[env]
OPENHUMAN_CORE_HOST = "0.0.0.0"
OPENHUMAN_CORE_PORT = "7788"
OPENHUMAN_WORKSPACE = "/home/openhuman/.openhuman"
RUST_LOG = "info"
[[mounts]]
source = "openhuman_workspace"
destination = "/home/openhuman/.openhuman"
[http_service]
internal_port = 7788
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
# min_machines_running = 0 fully stops the machine when idle (cheapest), but
# the first request after idle pays a cold-start penalty (container boot +
# Rust binary init — several seconds). Set to 1 to keep one machine warm.
min_machines_running = 0
processes = ['app']
[[http_service.checks]]
interval = "30s"
timeout = "5s"
grace_period = "10s"
method = "GET"
path = "/health"
[[vm]]
memory = '1gb'
cpus = 1