Move a key's instance to another version of its app, in place
reports/workers/keyed-upgrade.md, slices U1 and U2. A key's instance stays on the version it was made from until this is asked. version: the version it goes to, by its id or its number (the app's current version where it is not given), any of the app's versions that is ready, an older one too. when (slice U3): now (the default), or asleep, which waits (waiting) for the instance to sleep, by its node's last inventory, and begins then, its node making sure it sleeps still (one that woke meanwhile is waited for again): it holds none of the requests the instance serves while it waits; one that never sleeps waits until it is cancelled (DELETE …/upgrades/{id}). keep_days (0 to 365, 7 by default): how long what a revert needs is kept once it is done, billed as snapshots are (rollback): a snapshot of the instance as it was, and one of each Drive it had. The instance keeps its id, its node, its key, its project address, its tokens and its own Drives (key_drives) with what they hold; its disk, its machine, its processes, its start command and its labels become the new version's. Its own Drives are matched by their names (reports/workers/keyed-upgrade.md, 五): one the new version names is mounted at the new version's path; one it names that the key has none of is made for the key first, on the instance's node, of the version's size_bytes, given what the image has at its path unless the version says nocopy, as the key's first instance's are (drive.created); one it no longer names is left off, and kept: still the key's, listed, billed as a Drive, deleted with the key, mounted again by a later version that names it. A Drive that cannot be made ends the upgrade failed, upgrade_not_here, the make's code and words in its message, nothing of the instance touched; an upgrade that does not end done deletes the Drives it made again, and the key has its Drives as before (one that failed on the instance's node, its version not coming up, reads failed a moment before they are gone: their drive.deleted events say when). The steps: preparing, the instance's node is given the version's template as a deploy gives a node of the app one (had, fetched from the object store, or built), the instance serving meanwhile; switching, every edge holds the instance's requests as for a move, the requests its node has in hand are answered first, the calls of its sandbox are answered 503 upgrading (but a read of it (GET /v1/sandboxes/{id}) answers 200 with it as it was last seen, status upgrading), and its node stops its start command (the old version's stop), takes its Drives off with a version of each made as the old version left it, rolls it over to the new template in place, mounts its Drives again where the new version has them (and the ones made for it; not the ones it leaves off), and starts the new start command; then the key names the new version (instance.upgraded), and the held requests go to it, at the pace a move lets them go. A new version that does not come up has the instance put back as it was, its Drives with what they held before (failed, upgrade_failed, put_back; instance.upgrade_failed). Open connections end: their processes are replaced. Takes write; Idempotency-Key is honoured. Of an app of the Sandboxes product (managed_by.object sandboxes: the project's default sandbox app, or an image's), the instance is the project's sandbox the key names (its name, or its id), and any version of the app is one it may go to (an image the project named for its default sandbox app, or one its tag was moved to): its node is given its own template of the version's image, by its digest, in the sandbox's shape (or the base template), and the sandbox keeps its labels and its settings; its disk and its processes become the new version's, as a restore to a snapshot replaces them; and version_id, image_digest say what it is from then on.
https://api.glac.ai/v1/apps/{app}/instances/{key}/upgradeAuthorization
Path parameters
Header parameters
Request bodyJSON
Returns
200
The instance is on that version already: the instance, as GET …/instances/{key} shows it.
- start_commandoptional
How its start command runs, how often it was started again in its machine after it ended (a key's instance and a stateful service's are, with their disk and volumes as they are; each start is an
instance.restarted), how its last run ended, and when the next start is due while one waits:status(running,restarting,exited),restarts,last_exit(status,signal,at),restarting_at, asSandboxStartCommandinsandboxd/openapi/openapi.jsonsays. Null where its guest has said nothing of it yet.
202
The upgrade, preparing (waiting with when: asleep); Location is where it is shown (?wait_seconds= waits for its end).
- statusstringrequired
waiting: for the instance to sleep (when: asleep), or a batch's member for its turn, the instance serving as ever;preparing: the instance's node is given the new version's template, the instance serving meanwhile;switching: its node moves it over, its requests held at the edges and its calls answered 503upgrading(but a read of it (GET /v1/sandboxes/{id}) answers 200 with it as it was last seen,statusupgrading);done;failed(error,put_back);cancelled(while it waited:DELETE, or its batch stopped,errorsaying so). - errorobject | nullrequired
Where it failed:
upgrade_failed, the new version did not come up (what it said is inmessage);upgrade_not_here, the instance's node could not have the new version's template, or refused the upgrade before touching anything (the node's words are inmessage), or a Drive the new version gives the key could not be made (the make's code and words are inmessage:drive_limit_reachedwhere the plan does not let it be);rollback_gone, what a revert goes back to is gone. Where it was cancelled other than byDELETE:instance_gone(the key names another instance, or none),batch_stopped(its batch stopped, or was superseded),superseded(a stateful service's deploy came first).