HostFn
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 --local

When 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

AspectRemote ModeLocal Mode
ConnectionSSH over networkDirect local execution
File Transferrsync over SSHNode.js cpSync
CommandsExecuted via SSHExecuted via child_process.exec
rsync RequiredYesNo
SSH Key RequiredYesNo

How It Works

  1. Instead of establishing an SSH connection, HostFn creates a LocalExecutor that runs commands using Node.js child_process
  2. Files are copied using fs.cpSync instead of rsync, respecting the same exclude patterns
  3. All other phases (build, PM2 deployment, health check) work identically

Example: Self-Hosted Runner

.github/workflows/deploy.yml
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 --ci

Combining with CI Mode

You can combine --local with --ci for non-interactive local deployments:

hostfn deploy production --local --ci