Deze pagina is nog niet in het Nederlands vertaald: hier staat de Engelse versie.
Snapshots
POST /v1/sandboxes/{id}/snapshots (glac sandboxes snapshots create web --name before-upgrade) saves the memory, the processes and the disk of the sandbox at one moment, while it keeps running. A snapshot has a name (replace takes the name from the snapshot that has it now) and may have an expires_at.
| Call | What it does |
|---|---|
POST /v1/sandboxes with snapshot |
A new sandbox that goes on from the moment the snapshot was taken, its processes still running (glac sandboxes create --snapshot before-upgrade). |
POST /v1/sandboxes/{id}/restore |
Back to a snapshot, in place: the same id, name and links. What the sandbox was just before is kept as another snapshot, named in the answer, so going back can be undone (glac sandboxes restore web before-upgrade). |
GET /v1/snapshots, GET, DELETE /v1/snapshots/{id} |
The project’s snapshots; one; delete one. Sandboxes made from it run on. |
PATCH /v1/snapshots/{id} {name?, expires_at?} |
Another name (null: none), or another time it deletes itself (null: never): glac sandboxes snapshots rename before-upgrade old-state. |
A snapshot is copied to its region’s object store after it is taken. replicated says when that is done: from then on any machine of the region can make a sandbox from it. Until then only the machine it was taken on can, and a call that needs another is refused (409 snapshot_not_replicated, with how far the copy has come).
The Drives a sandbox has read-write are in its snapshot as versions of them, of which nothing is copied. A sandbox made from the snapshot gets a fork of each, at the same path, holding what the Drive held then; the Drive stays the first sandbox’s. See a sandbox’s snapshot and its Drives.
snap = sbx.snapshot(name="before-upgrade")
sbx.run("rm -rf /srv/*") # something that goes wrong
sbx.restore(snap) # as it was before
other = glac.sandboxes.create(snapshot=snap) # another sandbox from the same momentForks
POST /v1/sandboxes/{id}/fork with count (1 to 64) makes that many copies, each its own machine, each going on from this moment with the original’s memory, processes and disk. All are made, or none. A fork wakes the sandbox it copies.
glac sandboxes fork web --count 3 # prints three idscopies = sbx.fork(3)
print([c.run("python3 -c 'import random; print(random.random())'").stdout for c in copies])
for c in copies:
c.delete()Forks are counted as sandboxes made (a minute, and an hour for the project) and as sandboxes awake: see the limits.
Templates
A template is an image booted once and saved: its memory, its devices and its disk. Sandboxes are copies of it, so a program the template started is already running in each, and the memory it uses is shared until a sandbox changes it. Each image has a template per size, per start command and ready check, and per environment of the start command. Templates are made for you and cost nothing.
What they cost
A snapshot is billed by its own bytes (the memory pages, device state and disk layer that are its own, not what it shares with its template), by the GB-month at $0.02, for as long as it is kept. Free’s 15 GB of storage, and Paid’s 20 GB-maanden, include snapshots, with sleeping sandboxes and Drives. See pricing and plans.