Skip to content

Part 4: Update the Sandbox

Clone a second repository onto Golden:

src/Golden.ts
export const Golden = Archil.Sandbox("Golden", {
run: [
"git clone --depth 1 https://github.com/sindresorhus/is /work/is",
"git clone --depth 1 https://github.com/sindresorhus/slugify /work/slugify",
],
});
Terminal window
pnpm alchemy deploy

The commands changed, so Alchemy replaces Golden: it creates a new sandbox, runs every command in it, and deletes the old one. The program forks whatever Golden is now, and isn’t redeployed.

Terminal window
curl -X POST "$URL/run" -d 'ls ..'

A fork is a copy taken when it was created. Users who already have one keep it, with their changes and without slugify. Users who arrive after the deploy fork the new Golden. To move a user onto it, delete their fork; their next request forks it again.

Part 5 tests it.