Enable Previews
Enable pull request previews infloo.app.toml:
ttl_hours controls how long an idle preview stays around. Closing or merging the PR tears it down earlier.
Create A Sandbox From The CLI
Usefloo previews up when an agent needs an isolated sandbox for a feature branch before opening or relying on a pull request preview:
#123 when that PR number resolves to one preview.
Agents should use --json for stable output:
source_branch, deploy_id, status, URL, expiry, database_branches, and dev_prod_untouched: true. --wait exits non-zero when the deploy fails. Managed-resource isolation failures surface as PREVIEW_MANAGED_SERVICE_ISOLATION_UNAVAILABLE; fix the attached managed service state and retry after pushing a new commit or rerunning the command.
Deleting a preview sandbox tears down only preview-owned Cloud Run services, managed resources, gateway routes, and env vars. Dev and prod resources are untouched.
Preview Database Branches
A preview database branch is preview-owned managed Postgres state. It is isolated from dev, prod, and other previews. Migrations, reviewer changes, and agent experiments land in that preview branch only. V1 preview database branches are branch-like isolation on floo’s managed-resource substrate. They are not raw production clones, arbitrary point-in-time clones, or provider-native copy-on-write branches. True provider-backed branching is tracked separately in getfloo/floo#733. Use the CLI to inspect the branch behind a preview:#123 when that PR number resolves to one preview.
Use --json when an agent needs stable fields:
database_branches, source_environment, hydration_mode, resource_status, schema_name, reset eligibility, and expiry. It never includes plaintext database credentials.
Reset A Preview Branch
Reset drops and recreates only the selected preview database branch. Dev and prod are untouched.Choose Preview Data
Use[preview.data] to choose how a new preview branch starts.
Empty
empty is the default. floo creates a fresh preview database branch and copies no data.
Seed
seed runs your seed command once after migrations and before the preview is marked live.
Clone Dev
clone-dev copies managed Postgres dev data into the preview branch before migrations run.
Unsupported Modes
These are deliberately not V1 behavior:- Raw prod clone.
- Sanitized prod clone until the admin-gated runner exists.
- Redis copy or reset.
- Storage copy or reset.
- Merging preview database changes back into dev or prod.
- Instant copy-on-write branches from arbitrary points in time.
Multi-Service Apps
Preview branches follow the same managed credential attachment rules as dev and prod. Attach managed Postgres only to the services that need it:managed, legacy apps receive managed credentials in every service. Once any service declares managed, omitted services receive none.
Troubleshooting
| Symptom | Meaning | What to do |
|---|---|---|
floo db branches list shows no branches | The preview has no floo-managed Postgres attachment | Add managed Postgres with floo services add postgres --app my-app, then attach it with managed = ["postgres"] |
| Reset is blocked | The branch is not ready or is not preview-owned managed Postgres | Re-run floo db branches show ... --json and inspect reset_blocked_reason |
| Preview creation fails before deploy | floo could not provision isolated managed resources | Fix the managed-service state and push another commit |
clone-dev works for Postgres but not Redis or Storage | Redis and Storage copy modes are not implemented | Use app-level seed logic or keep those resources empty in previews |