Deployment
Local Deployment Mode
Deploy without SSH for self-hosted runners and local servers.
Local deployment mode skips SSH and rsync entirely, copying files directly on the same machine. This is useful for self-hosted CI/CD runners that run on the deployment target.
Usage
hostfn deploy production --localWhen to Use Local Mode
- Self-hosted GitHub Actions runners running directly on your VPS
- Local development servers where the app runs on the same machine
- Testing deployment workflows without needing a remote server
How It Differs from Remote Mode
| Aspect | Remote Mode | Local Mode |
|---|---|---|
| Connection | SSH over network | Direct local execution |
| File Transfer | rsync over SSH | Node.js cpSync |
| Commands | Executed via SSH | Executed via child_process.exec |
| rsync Required | Yes | No |
| SSH Key Required | Yes | No |
How It Works
- Instead of establishing an SSH connection, HostFn creates a
LocalExecutorthat runs commands using Node.jschild_process - Files are copied using
fs.cpSyncinstead of rsync, respecting the same exclude patterns - All other phases (build, PM2 deployment, health check) work identically
Example: Self-Hosted Runner
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g hostfn
- run: hostfn deploy production --local --ciCombining with CI Mode
You can combine --local with --ci for non-interactive local deployments:
hostfn deploy production --local --ci