Skip to main content
Service specs define long-running background processes that run inside your workspaces. Each spec becomes a systemd unit file, giving you process management, automatic restarts, and log capture out of the box.

How Service Specs Work

When you attach a service spec to a workspace, Rigbox generates a systemd service unit file inside the VM:
  • Unit name: rigbox-svc-{name}.service
  • Runs as: the developer user
  • Working directory: /home/developer
  • Environment: variables you define in env_vars, plus any workspace-level environment
If auto_enable is set to true, the service starts automatically when the workspace boots - after setup scripts have finished.

Create a Service Spec

Define a service spec in a YAML file with the command to run, environment variables, and restart behavior, then create it with the CLI.
See the Service Specs API reference for the full request and response schema.

Service Spec Fields

Restart Policies

Use always for servers and daemons that should run continuously. Use on-failure for tasks that should recover from crashes but not restart after a clean exit. Use no for one-shot tasks.

Attach to a Workspace

Pass --service-spec-id (repeatable) when spawning a workspace.
All specified service specs are installed as systemd units inside the workspace. Those with auto_enable: true start automatically after boot and setup scripts complete.

Manage Services Inside the Workspace

Once inside the workspace VM, you can manage services using standard systemctl commands:
Services run under the developer user’s systemd instance, so use systemctl --user (not sudo systemctl).

List Your Service Specs

See the List Service Specs API reference for details.

Update a Service Spec

Changes to a service spec take effect on the next workspace start. Running workspaces will not pick up changes automatically - you need to restart the workspace.

Delete a Service Spec

Combining with Setup Scripts

A common pattern is to use a setup script to install dependencies and a service spec to run the application. The setup script runs first, so your service spec can assume everything is installed. Step 1 - Create a setup script that installs dependencies:
Step 2 - Create a service spec that runs the app:
Step 3 - Spawn a workspace with both:
Execution order on workspace boot:
  1. Setup scripts run (install dependencies, build the app)
  2. Service specs with auto_enable: true start (launch the server)

Combining with Apps

To expose a service spec’s port to the internet, create an app that maps to the service’s port.
The app gets a unique URL of the form <APP_NAME>.rigbox.dev that routes to port 3000 inside the workspace where your service spec is running.

Example: Full-Stack Application

Here is a complete example that sets up a React frontend and Node.js backend as two separate services. Setup script - install everything:
Backend service spec:
Frontend service spec:
Both services start on workspace boot, and you can expose either or both via apps.

Next Steps

  • Setup Scripts - automate dependency installation before services start
  • Snapshots - snapshot a workspace with running services for quick restore
  • Managed AI Proxy - add AI capabilities to your background services