Skip to main content

The deploy script

After making changes locally, deploy them to a running server with:
./infra/deploy.sh
This reads connection details from infra/.instance (written by setup.sh) and:
  1. Syncs the project to the server via rsync
  2. Bakes the agent runtime into the base rootfs
  3. Restarts the nightshift-serve systemd service
Any warm VMs from the pool are invalidated on restart, so the next agent run cold-starts with the new code.

Explicit host

If you’re not using setup.sh or want to target a different server:
./infra/deploy.sh ubuntu@<IP>
./infra/deploy.sh --key ~/.ssh/my-key.pem ubuntu@<IP>

What gets baked

The deploy script calls infra/bake-rootfs.sh, which mounts the base rootfs image and copies in the agent runtime — the code that runs inside every Firecracker VM:
Destination in rootfsSourcePurpose
/sbin/initInline shell scriptMinimal PID 1 — mounts filesystems, configures network, starts the agent
/opt/nightshift/agent/src/nightshift/agent/Agent entry point and runner
/opt/nightshift/sdk/src/nightshift/sdk/NightshiftApp, AgentConfig (imported by user agents)
/opt/nightshift/events.pysrc/nightshift/events.pyEvent types
/opt/nightshift/protocol/src/nightshift/protocol/Packaging and event serialization
/opt/nightshift/__init__.pysrc/nightshift/__init__.pyPackage re-exports
These are not baked (injected per-VM via overlay at runtime):
PathContents
/workspace/User project files
/opt/nightshift/agent_pkg/User’s deployed agent code + manifest
/etc/nightshift/envPer-run environment variables

Baking manually

If you’re already on the server, you can bake the rootfs directly:
sudo ./infra/bake-rootfs.sh
sudo systemctl restart nightshift-serve

Verify

After deploying, confirm the server is healthy:
curl https://<your-hostname>/health
# {"status":"ok"}
Run an agent to verify end-to-end:
nightshift run <agent-name> --prompt "test"