boat resume to get it back.
- There is no pause. A stop removes the virtual machine and keeps a copy of the disk. A resume starts a new machine with that disk.
- A stop keeps the disk. A resume within 10 minutes usually gets the same machine back, with memory and running programs. Do not count on it. After 10 minutes, memory and running programs are gone. Read Resume within 10 minutes.
- Every stop saves the disk first:
boat stop, auto-stop and a stop for an empty wallet. Onlyboat stop --forceand snapshots off skip the save. - To erase the sandbox for good, delete it. Read Delete a sandbox.
State names
The CLI and the dashboard show one set of names. The API and webhooks show another.
The API reports a stopped sandbox as
archived. The webhook event for a stop is sandbox.archived. The field archiveAfter is the auto-stop time. These are names only. A stopped sandbox is not moved or deleted.
Keep a stopped sandbox longer than 14 days
- A resume starts the 14 days again from the next stop.
- A saved snapshot has no scheduled expiry. Save one from a stopped sandbox before day 14.
- Your plan includes 10 or more saved snapshots. Each one after that costs $0.056 a day from the wallet. Delete it to stop the charge.
boat stop, and run the save from a daily job.
Wait for the stop in a script
boat stop returns when the stop starts, with state stopping. It does not wait for stopped.
To wait, poll boat info until the state is stopped:
GET /sandboxes/{sandboxId} until sandbox.state is archived.
A second stop is safe to send:
You do not need to wait before a plain
boat resume. A resume during stopping takes back the same machine, with no restore. If boat cannot take the machine back, the resume fails with 409 sandbox_stopping. The answer carries a Retry-After header and the stop operation.
Resume within 10 minutes
boat keeps the machine for 10 minutes after the sandbox readsstopped. These 10 minutes are not billed.
- A plain
boat resumein those 10 minutes usually takes back the same machine, with no restore. - Memory, running programs, open terminals and the IP address are then still there.
- boat can release the machine early. The resume then starts a new machine from the snapshot, like a reboot.
- After 10 minutes, a resume always starts a new machine from the snapshot.
stopped before you resume with a new --type or --environment. Such a resume always starts a new machine.
What a stop does
boat does these steps in this order:- boat runs your pre-stop command, if you have one.
- boat stops your Docker containers. Each container gets 30 seconds to exit.
- boat takes the last snapshot of the disk.
- boat turns off the machine and removes it.
- Clean up when the sandbox starts again. An enabled systemd service with an
ExecStartPre=step runs at every resume. Read Always-on services. - Run your own cleanup first, then run
boat stop.
Save app state before a stop
Some apps keep recent changes in memory. They write them to disk later. Chrome is an example. Chrome writes new cookies to disk every 30 seconds, or when it closes. If you stop the sandbox a few seconds after a login, the snapshot has the old cookies. A kill signal does not help, because Chrome then exits without saving. To fix this, put a command in the file~/.boat/pre-stop. boat runs it at every stop, before the last snapshot.
The example below closes Chrome. It needs Chrome to have a debug port. Start Chrome with --remote-debugging-port=9222.
- It runs as
user, in your home folder. - It has 60 seconds. After that, boat stops it.
- It runs on
boat stopand on auto-stop. - It does not run on
boat stop --force. It does not run when you save a saved snapshot. - If it fails or takes too long, the stop continues.
- The file is on the disk. Resumes, forks and saved snapshots keep it.
When a stop is refused
A stop saves the disk first. If the save fails, boat refuses the stop. The sandbox keeps running, so the unsaved work stays on its disk. boat tries again by itself and sends you an email. You do not pay while the stop waits. The billing meter pauses at the first refused stop. Your balance and your invoice both show the pause. You do not need to ask for a refund.- The meter stays paused while the stop waits, even if you or your scripts use the sandbox.
- The meter starts again when the sandbox stops.
- The meter also starts again when you resume the sandbox, because a resume cancels the stop.
- If the refused stop was an auto-stop, the meter starts again when you use the sandbox again.
boat stop --force. In the API, send {"force": true} in the body. The reply has "forced": true when boat reads the force. The sandbox stops with its last good snapshot. You lose everything written after that snapshot.
After 3 days of failed saves, boat does a forced stop by itself. You then lose everything written after the last good snapshot. boat sends you an email one day before it does this.