Set up a project
You can prepare dependencies once and reuse them in independent boxes. You need a configured host, a local project at ./my-project, and a setup script at ./my-project/setup.sh. Commands run on your controller.
Raft does not run setup hooks or manage repositories, environment variables or secrets for you. Private repository credentials and coding-agent authentication must be configured inside the box; your controller login and SSH agent are not forwarded.
Copy your project and run setup
Inspect your project for credentials before copying. Recursive upload includes hidden and ignored files and requires a destination that does not exist:
box=$(raft new --location lab --ttl 3600 --persistent --purpose "Project development" --owner "Local operator" --next "Back up before deletion")
raft upload "$box" ./my-project /workspace/my-project --recursive
raft exec "$box" -- bash -lc 'cd /workspace/my-project && bash ./setup.sh'Commands run as guest root in /workspace. Use an explicit shell for directory changes. Make setup safe to rerun; a failed command returns its exit code. If the box is still starting, use the readiness procedure before setup. For repeated source edits, use incremental sync.
For slow setup, use a detached job. Detaching does not extend the box's lifetime.
Supply private application settings
If your application reads .env, upload a controller file named ./app.env and restrict access. This example assumes it runs as the image's developer user:
raft upload "$box" ./app.env /workspace/my-project/.env
raft exec "$box" -- chown developer:developer /workspace/my-project/.env
raft exec "$box" -- chmod 600 /workspace/my-project/.envThe application must load the file; uploading it does not export variables. Adjust project ownership if you run the application as developer. Do not put secrets in command arguments, committed files or logs. Host journals can capture guest command lines; Raft does not scrub or rotate credentials.
Reuse installed dependencies
Wait for setup to succeed, remove secrets you do not want copied, then stop your persistent box and save its disk:
raft stop "$box"
raft snapshot "$box" prepared
copy=$(raft new --from "$box/prepared" --ttl 3600 --persistent --purpose "Project copy" --owner "Local operator" --next "Destroy after use")
raft exec "$copy" -- ls /workspace/my-projectThe copy stays on the source host and inherits the snapshot's CPU, RAM and disk unless you pass size overrides. It has its own handle, network identity and deadline. The source box may run while you copy the saved snapshot.
The snapshot includes packages, files, credentials and enabled services, but not process memory. Later edits do not update it. Keep the source box and snapshot: deletion or stopped-box retention removes the template too. For another host, use backup and recovery; for a copy of the stopped box's unsnapshotted files, use fork.