Local

Do this on your own computer, where your site folders live. The local tool is small and stateless: it pushes your site folders up to the server, which serves each over HTTPS. It runs the on-page automation first, then compares file metadata and uploads only what changed.

1

Download

Grab the local package: one versioned directory with everything it needs.

Download sitehoster-local-0.2.1.zip →

unzip sitehoster-local-0.2.1.zip
cd sitehoster-local-0.2.1
# what's inside:
#   sitehoster-local.js     the one command you run (sync + the browser tools, by switch)
#   config.example.json     config template (copy to config.json)
#   localhoster-common/     the shared toolkit
#   localhoster-tools/      web-logs, server-logs
#   sitehoster-tools/       automation-logs
#   sitehoster-sync/        the sync command + on-page automation
2

Configure it

Copy the template and fill it in: your server address, the token the installer printed, and the path to your folder of site folders. See the config file below.

cp config.example.json config.json
3

Sync

The first run uploads everything; each later run pushes only what changed. Pass the full path to your config. A folder named example.com goes live at example.com.

node sitehoster-local.js --config /path/to/config.json --sync
4

Keep it in sync

Schedule a periodic run (a cron entry, say). The same command also builds the browser tools: add --web-logs, --server-logs, --automation-logs, or --all.

node sitehoster-local.js --config /path/to/config.json --sync --automation-logs

Config file

The config file is a small JSON file on your own machine. It is the one file the local tool needs: it names your server, the token that reaches it, the folder of site folders you author, and where the tools pages are built.

{
  "sitehoster-config-serverAddress": "203.0.113.5",
  "sitehoster-config-apiToken": "the token the installer printed",
  "sitehoster-config-contentRoot": "/home/you/sitehoster/sites",
  "sitehoster-config-tools": "/home/you/sitehoster/sites/_tools"
}
A config file. Point the local tool at it with the --config option.

Four keys: your server, its token, the folder of sites you author, and where the tools pages are built.

NameTypeDescription
sitehoster-config-serverAddressaddressThe IP address of your server. The local tool reaches the API there over HTTPS.
sitehoster-config-apiTokenstringThe token the server installer printed. It authorises the local tool to push files and pull logs.
sitehoster-config-contentRootpathThe absolute path of your folder of site folders. Each top-level folder named for a domain is one site.
sitehoster-config-toolspathThe absolute path where the local tool builds the tools pages: the web, server and automation browsers.

sitehoster-config-serverAddress

The IP address of your server, e.g. 203.0.113.5, a raw address with no scheme. The local tool reaches the API there over HTTPS, which Caddy terminates before proxying to the localhost API. Reaching a bare IP over HTTPS can only be a self-signed certificate, so the local tool skips certificate checks for an IP host; point a hostname you own at the box to get full verification.

sitehoster-config-apiToken

The token the server installer printed. The local tool sends it as a bearer header on every call; it is the box's one secret, so keep the config file private.

sitehoster-config-contentRoot

An absolute path to your folder of site folders. A folder named example.com becomes the site at example.com; the sync uploads it and the automation keeps its shared blocks in step. The local tool also mirrors the server's logs into _logs here. An absolute path means a run does the same thing from any working directory; a relative path is rejected. See Domains.

sitehoster-config-tools

An absolute path to where the local tool builds the tools pages: the web logs, server stats and automation browsers. It is usually _tools inside your content root. It is only needed when you run a browser tool.

Next steps

With a site synced, use the browser extension to make edits to your local sites by describing what you want while you browse them.