Local

The local package is a single command you run from your own machine. It reads one config.json, pushes your schema up to the server, mirrors the collected data and logs down, and builds the tools pages from them.

Download

Grab the local package: one versioned directory with the entry command, the shared toolkit, and everything it needs.

Download datahoster-local-0.2.0.zip →

unzip datahoster-local-0.2.0.zip
cd datahoster-local-0.2.0
The directory you unzip is the package. Inside it:
datahoster-local-0.2.0/
  datahoster-local.js
  config.example.json
  localhoster-common/
  localhoster-tools/
  datahoster-tools/
  datahoster-sync/
The one command, the config template, the shared toolkit, the universal browsers, this hoster's Data Logs tool, and the sync command.

Config

Copy config.example.json to config.json and fill it in. It is the one file the local package needs: it names your server, the token that reaches it, the data folder you author, and where the tools pages are built. Pass its full absolute path with the --config command line option; a relative path is rejected.

{
  "datahoster-config-serverAddress": "203.0.113.5",
  "datahoster-config-apiToken": "the token the installer printed",
  "datahoster-config-contentRoot": "/home/you/datahoster/data",
  "datahoster-config-tools": "/home/you/datahoster/data/_tools"
}
Both datahoster-config-contentRoot and datahoster-config-tools are absolute paths, so the local client works the same run from anywhere.
NameTypeDescription
datahoster-config-serverAddressaddressThe IP address of your server. The local client reaches the API there over HTTPS.
datahoster-config-apiTokenstringThe admin token the server installer printed. It authorises the local client to push definitions and pull data.
datahoster-config-contentRootpathThe absolute path of your data folder: the collections, users and endpoints you author, and the copies the local client keeps.
datahoster-config-toolspathThe absolute path where the local client builds the tools pages: the data, web and server log browsers.

datahoster-config-serverAddress

The IP address of your server, a raw address with no scheme. The API is always hosted there, and the local client reaches it over HTTPS, which Caddy terminates before proxying to the API. An HTTPS connection to a bare IP uses a self-signed certificate, so the local client skips certificate checks for an IP host.

datahoster-config-apiToken

The admin token the server installer printed. The local client sends it as a bearer header on the management API, which is how it is allowed to push your definitions up and pull records down. It is the box's secret, so keep the config file private.

datahoster-config-contentRoot

An absolute path to your data folder. Inside it you author the host's collections, users and endpoints; the local client fills _data with the records it pulls and _logs with mirrored logs. An absolute path means a run does the same thing from any working directory. A relative path is rejected.

datahoster-config-tools

An absolute path to the directory the local client writes the tools site into: the data logs, web logs and server logs browsers. It is usually _tools inside your data folder. It is only needed when you run a browser tool.

The content root

Your datahoster-config-contentRoot holds the schema you author and the copies the local client keeps:

/home/you/datahoster/data/
  api.yourdomain.com/
    datahoster-collections/
      messages/
        datahoster-collection.json
        datahoster-collection-columns/
    datahoster-users/
    datahoster-endpoints/
  _data/
  _tools/
  _logs/
You author the collections, users and endpoints. The local client fills _data with records, _tools with pages, and _logs with mirrored logs.

Run it

node datahoster-local.js --config /home/you/datahoster/config.json --sync
One command, every job, selected by switches. Pass the full path to your config.
SwitchDoes
--config <path>The full absolute path to the config file. Required.
--syncPush your schema up, import your records, and mirror the data down.
--data-logsBuild the data-log pages (the collection records) from the mirrored data.
--web-logsMirror Caddy's access log and build the web-log pages.
--server-logsMirror the API's server log and build the server-log pages.
--allEverything above.

On a schedule

Run it from cron to keep the local copy current:

*/5 * * * * node /path/to/datahoster-local.js --all --config /path/to/config.json
Every five minutes: push, pull, and rebuild the pages.