Self-Hosting
Bare Metal Deployment
Run QUESTPIE Autopilot directly with Bun, without Docker.
Run Autopilot directly on a Linux server or macOS machine. Best for development, small teams, or when you need full control over the runtime.
Install Bun
terminal
curl -fsSL https://bun.sh/install | bash
source ~/.bashrc # or ~/.zshrc
bun --version # Should be 1.3+Install Autopilot CLI
terminal
bun add -g @questpie/autopilot
autopilot --versionInitialize a Company
terminal
autopilot init my-company
cd my-companyThis scaffolds the full company filesystem from the solo-dev template, initializes a git repository, and creates the first commit.
Configure
terminal
# Authenticate (choose one)
autopilot provider set openrouter --api-key sk-or-... # Use Claude subscription (recommended)
# OR
export OPENROUTER_API_KEY=sk-or-... # Use API key
# Recommended: master key for secrets encryption
export AUTOPILOT_MASTER_KEY=$(openssl rand -base64 32)
# Recommended: production mode (secure cookies, HTTPS)
export NODE_ENV=productionFor persistent env vars, add them to your shell profile or use a process manager (see below).
Start the Orchestrator
terminal
cd my-company
autopilot startThis starts:
- Filesystem watcher (tasks, comms, dashboard, team config)
- Cron scheduler
- Webhook server on port 7777
- REST API + SSE stream on port 7778
- SQLite database initialization and indexing
The process runs in the foreground until you press Ctrl+C.
Running as a systemd Service
For production Linux servers, run Autopilot as a systemd service.
1. Create a service user
terminal
sudo useradd -r -m -d /opt/autopilot -s /bin/bash autopilot2. Set up the company directory
terminal
sudo -u autopilot bash -c '
cd /opt/autopilot
autopilot init my-company
'3. Create an environment file
/opt/autopilot/.env
AUTOPILOT_MASTER_KEY=your-generated-key-here
NODE_ENV=production
# Uncomment if using API key instead of subscription login (autopilot provider set openrouter --api-key sk-or-...):
# OPENROUTER_API_KEY=sk-or-your-key-hereterminal
sudo chown autopilot:autopilot /opt/autopilot/.env
sudo chmod 600 /opt/autopilot/.env4. Create the systemd unit
/etc/systemd/system/autopilot.service
[Unit]
Description=QUESTPIE Autopilot Orchestrator
After=network.target
Documentation=https://autopilot.questpie.com/docs/self-hosting
[Service]
Type=simple
User=autopilot
Group=autopilot
WorkingDirectory=/opt/autopilot/my-company
EnvironmentFile=/opt/autopilot/.env
ExecStart=/home/autopilot/.bun/bin/autopilot start
Restart=on-failure
RestartSec=5
StartLimitIntervalSec=60
StartLimitBurst=3
# Security hardening
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/opt/autopilot
PrivateTmp=true
# Resource limits
LimitNOFILE=65536
MemoryMax=1G
# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=autopilot
[Install]
WantedBy=multi-user.target5. Enable and start
terminal
sudo systemctl daemon-reload
sudo systemctl enable autopilot
sudo systemctl start autopilot
# Check status
sudo systemctl status autopilot
# View logs
sudo journalctl -u autopilot -f6. Manage the service
terminal
# Stop
sudo systemctl stop autopilot
# Restart
sudo systemctl restart autopilot
# View recent logs
sudo journalctl -u autopilot --since "10 minutes ago"Running with a Process Manager
If you prefer a process manager over systemd (macOS, or preference):
Using pm2 (works with Bun)
terminal
bun add -g pm2
# Start
cd /path/to/my-company
pm2 start "autopilot start" --name autopilot
# Auto-start on reboot
pm2 startup
pm2 save
# Logs
pm2 logs autopilot
# Restart
pm2 restart autopilotEnvironment variables with pm2
ecosystem.config.cjs
module.exports = {
apps: [{
name: 'autopilot',
script: 'autopilot',
args: 'start',
cwd: '/path/to/my-company',
env: {
OPENROUTER_API_KEY: 'sk-or-...',
AUTOPILOT_MASTER_KEY: 'your-key',
NODE_ENV: 'production',
},
}],
}terminal
pm2 start ecosystem.config.cjsUpdating
terminal
# Update the CLI
bun add -g @questpie/autopilot@latest
# Restart the service
sudo systemctl restart autopilot
# or: pm2 restart autopilotThe SQLite database is rebuilt automatically on startup. No manual migrations needed.
Verifying the Installation
terminal
# Health check
curl http://localhost:7778/api/health
# API status
curl http://localhost:7778/api/status
# List agents
curl http://localhost:7778/api/agentsNext Steps
- Configuration Reference — full company.yaml schema and env vars
- Networking — TLS, reverse proxy, webhook tunneling
- Authentication — enable auth and create team members