Operations and states
Every change (build, deploy, rollback, restore, import…) is an operation with an operation_id and a state. See it with embra status <op_id> or under “Lần deploy” (deploys) in the console.
States
Section titled “States”state |
Console | Meaning | Exit code |
|---|---|---|---|
requested |
Đã tiếp nhận (received) | Embra has it, not started yet | — |
planned |
Đã chuẩn bị (prepared) | The deploy has a plan | — |
rehearsing |
Đang chạy thử migration (rehearsing migration) | Rehearsal on a data copy | — |
awaiting_approval |
Chờ duyệt (awaiting approval) | Waiting for an Owner or Admin | 20 |
ready |
Sẵn sàng deploy (ready to deploy) | Approved (or no approval needed), waiting to run | — |
migrating |
Đang chạy migration (running migration) | Applying migrations to production | — |
starting |
Đang khởi động (starting) | Starting the new container, waiting for the health check | — |
switching |
Đang chuyển traffic (switching traffic) | Moving traffic to the new release (or to the new database on restore) | — |
observing |
Đã nhận traffic, đang theo dõi (live, observing) | New release takes traffic, Embra keeps watching | — |
running |
Đang thực hiện (in progress) | A non-deploy operation is running | — |
healthy |
Deploy thành công (deployed; rollback: Rollback xong) | Deploy or rollback done, new release serving | 0 |
succeeded |
Hoàn tất (done) | A non-deploy operation finished | 0 |
failed |
Thất bại (failed) | Could not be done; see reason_code |
10 |
rejected |
Đã từ chối (rejected) | The approver rejected it, or Embra refused it before running | 10 |
cancelled |
Đã huỷ (cancelled) | Cancelled before touching production | 10 |
recovery_required |
Cần đội Embra hỗ trợ (needs the Embra team) | Outcome unknown, environment blocked | 30 |
migration_unknown |
Cần xác minh dữ liệu (data needs verification) | Lost contact while running a migration, environment blocked | 30 |
- Exit code is what
embra wait/embra statusreturn when the operation is in that state. “—” means not final yet; the exit code then followsreason_code(Exit codes and JSON). - Final states (never change again):
healthy,succeeded,failed,rejected,cancelled,recovery_required,migration_unknown.readyis not final. embra waitstops at a final state or atawaiting_approval.
Deploy
Section titled “Deploy”planned → rehearsing → awaiting_approval → ready → migrating → starting → switching → observing → healthy| From | Can move to |
|---|---|
planned |
rehearsing, awaiting_approval, ready, cancelled |
rehearsing |
awaiting_approval, ready, failed, cancelled |
awaiting_approval |
ready, rejected, cancelled |
ready |
migrating, starting, failed, cancelled |
migrating |
starting, failed, migration_unknown |
starting |
switching, failed |
switching |
observing, failed |
observing |
healthy, failed |
- No migrations:
rehearsingandmigratingare skipped. No approval needed (staging without data-loss migrations):awaiting_approvalis skipped. ready→failed: an error known before touching production (for example the pre-migration snapshot fails).- From
migratingonlystarting,failedormigration_unknown. Once inmigratingit can no longer be cancelled. - Failing after
migrating(for example the health check): the migration is applied, old code runs on the new schema.
Other operations
Section titled “Other operations”| Operation | Path |
|---|---|
| Rollback | requested → switching → observing → healthy; refused early → rejected |
| Build | requested → running → succeeded; a newer push → cancelled |
| Restore (PITR) | requested → running → awaiting_approval → switching → succeeded; not switched → rejected / cancelled |
| Data import | requested → (awaiting_approval on production) → running → succeeded |
| Fork | requested → awaiting_approval → succeeded |
| Everything else (Postgres setup, backup, export, secret, domain…) | requested → running → succeeded |
On top of these tables, any non-final state can move to recovery_required (except migrating, which uses migration_unknown). Export and the comparison runs of embra db undo only read, so they never become recovery_required.
recovery_required and migration_unknown
Section titled “recovery_required and migration_unknown”Both mean Embra does not know whether the last step finished. Embra deliberately does not retry: running a migration or a database switch twice when the first outcome is unknown can corrupt data.
- The environment is blocked: every change returns
ENVIRONMENT_BLOCKEDuntil the Embra team has verified it. - Do not delete the environment or run SQL by hand. See
RECOVERY_REQUIRED,MIGRATION_UNKNOWN.