hostfn server
Server management commands for setup and information.
The hostfn server command group manages remote server provisioning and information.
Subcommands
hostfn server setup <host>
Sets up a new server for deployments. Installs all necessary software and configures the server.
hostfn server setup ubuntu@my-server.comOptions
| Option | Description | Default |
|---|---|---|
--env <environment> | Environment name | production |
--node-version <version> | Node.js version to install | 20 |
--port <port> | Service port for Nginx config | 3000 |
--redis | Also install Redis | false |
--password <password> | SSH password (if not using key auth) | — |
What Gets Installed
| Software | Purpose |
|---|---|
| nvm + Node.js | JavaScript runtime |
| PM2 | Process manager |
| Nginx | Reverse proxy |
| Certbot | SSL certificates |
| rsync | File synchronization |
| build-essential | Native npm module compilation |
| UFW | Firewall (ports 22, 80, 443) |
| Redis | (optional) In-memory data store |
How It Works
- Generates a setup shell script based on your runtime and options
- Asks for confirmation to execute on the server
- Uploads and executes the script over SSH with streaming output
- If you decline, saves the script locally for manual execution
The setup takes 2-5 minutes depending on your server's connection speed.
hostfn server info <host>
Displays comprehensive information about a remote server.
hostfn server info ubuntu@my-server.comInformation Displayed
| Section | Details |
|---|---|
| System | OS name/version, disk usage, memory usage |
| Runtime | Node.js version, PM2 version, Nginx status |
| Services | All running PM2 services with status, memory, CPU, and uptime |
Example Output
Server Information
Host ubuntu@my-server.com
✔ Connected
── System ──
OS Ubuntu 22.04.3 LTS
Disk 12G used / 50G total (24% used)
Memory 1.2G used / 4.0G total
── Runtime ──
Node.js v20.11.0
PM2 5.3.0
Nginx active
── Services ──
my-api-production
Status: online
Memory: 85MB CPU: 2% Uptime: 3d 12h