- TypeScript 93.1%
- JavaScript 4%
- Shell 2.9%
| config | ||
| docs | ||
| scripts | ||
| src | ||
| .gitignore | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
sitectl
A simple CLI for bootstrapping Linux servers, nginx site configs, and TLS certificates.
It is opinionated, but customizable:
- today it is biased toward Debian-like servers because the bootstrap/install
flow is written for
apt,nginx,certbot,ufw, and related packages - after install, you can edit the data files in
~/.config/sitectl/however you want and adapt the tool to your own setup - templates, remote scripts, and nginx configs are meant to be user-editable
This is a CLI-only utility for interactive local use. It is not intended for CI or hermetic automation environments.
The workflow is interactive only:
- start
sitectl - choose an action from the menu
- follow the prompts
Demo
Setup
npm install -g sitectl
sitectl is intended to run on Unix-like systems.
Supported local environments:
- Linux
- macOS
- Windows via WSL
Native Windows is not supported at the moment.
Required local dependencies:
- Node.js
- npm
sshrsyncssh-copy-id
Platform notes:
- On macOS,
Manage sites -> Copy conf files to serverexpects a newerrsyncthan the system one. Install it with Homebrew:
brew install rsync
- On Linux,
Open data dirand local config opening usexdg-open, which is typically provided by your desktop environment orxdg-utils. - On Windows, use WSL and install the Linux dependencies inside WSL.
Menu
Main menu:
Manage serversManage sitesOpen data dirExit
Manage servers:
Add serverEdit serverDelete serverInstall base packagesConfigure zshSetup ufwBack
Manage sites:
Add siteOpen nginx.confCopy conf files to serverIssue certificateEnable httpsDisable httpsBack
The non-interactive commands are:
sitectl sshsitectl ssh <server-name>sitectl ssh-copy-id
Remote automation assets live in:
~/.config/sitectl/nginx/bootstrap.conf~/.config/sitectl/remote/install-base-packages.sh~/.config/sitectl/remote/configure-zsh.sh~/.config/sitectl/remote/myzshrc.zsh~/.config/sitectl/remote/setup-ufw.sh
Nginx site registry lives in:
~/.config/sitectl/nginx/sites/<domain>/nginx.conf
Manage Servers Workflow
Typical flow for a new VPS:
Add serversitectl ssh-copy-idInstall base packagesConfigure zshSetup ufw
What those actions do:
Add serverCreates a server record in~/.config/sitectl/config.json.sitectl ssh-copy-idInstalls your SSH public key on the target server so the rest of the workflow can work over key-based SSH.Install base packagesRuns the opinionated bootstrap script for Debian-like servers.Configure zshInstalls the custom shell config from~/.config/sitectl/remote/.Setup ufwApplies the default firewall rules for SSH, HTTP, and HTTPS.
Manage Sites Workflow
Typical flow for a new site:
Add site- edit
nginx.conf Copy conf files to serverIssue certificateEnable https
What those actions do:
Add siteCreates~/.config/sitectl/nginx/sites/<domain>/and seedsnginx.conffrom the local template.Open nginx.confOpens the local site config for editing.Copy conf files to serverUploads:<domain>.bootstrap.conf<domain>.confif localnginx.confexists
Issue certificateUsescertbot certonly --nginx -d <domain>. This command is intended for the bootstrap flow when HTTPS is still disabled. After issuing a certificate, the site remains on the bootstrap HTTP config until you explicitly runEnable https.Enable httpsSwitchessites-enabled/<domain>.confto the main HTTPS config.Disable httpsSwitchessites-enabled/<domain>.confback to the bootstrap HTTP config.
Config
Server records are stored locally in:
~/.config/sitectl/config.json
Current server shape:
{
"servers": {
"prod": {
"address": "203.0.113.10",
"flag": "🌍",
"port": 22,
"user": "root"
}
}
}
Run
npm run dev
SSH command:
npm run ssh
npm run ssh -- prod
npm run ssh-copy-id
After global install:
sitectl ssh
sitectl ssh prod
sitectl ssh-copy-id
Interactive actions are available through the menu opened by sitectl.
Build
npm run build
Built CLI also starts without arguments:
node dist/index.js
Defaults are seeded from the packaged config/ files during prepare, and the
runtime still recreates a missing file on demand if needed.
