Local

Do this on your own computer, where your game folders live. The local sync tool is small, the same idea as the Sitehoster one, that pushes your games/ definitions up to the server. It doesn't run your game; it just keeps the server's copy of each definition in step with your filesystem.

Coming soon

1

Download

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

unzip gamehoster-local-0.1.0.zip
cd local
# what's inside:
#   gamehoster-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
#   gamehoster-tools/       game-logs
#   gamehoster-sync/        the sync command + compiler
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 games. See the config file below.

cp config.example.json config.json
3

Sync

The first run uploads every definition; each later run pushes only what changed. Pass the full path to your config. The games root's children are domains; a game folder pong/ inside a domain game.example.com/ goes live at wss://game.example.com/pong.

node gamehoster-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, --game-logs, or --all.

node gamehoster-local.js --config /path/to/config.json --sync --game-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 games you author, and where the tools pages are built.

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

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

NameTypeDescription
gamehoster-config-serverAddressaddressThe IP address of your game server. The local tool reaches the API there over HTTPS.
gamehoster-config-apiTokenstringThe token the server installer printed. It authorises the local tool to push game definitions and pull logs.
gamehoster-config-contentRootpathThe absolute path of your games folder. Each top-level folder is one game.
gamehoster-config-toolspathThe absolute path where the local tool builds the tools pages: the game, web and server browsers.

gamehoster-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 server. 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.

gamehoster-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.

gamehoster-config-contentRoot

An absolute path to your games folder. Each top-level folder is one game, built into an authoritative server and a generated client. An absolute path means a run does the same thing from any working directory.

gamehoster-config-tools

An absolute path to where the local tool builds the tools pages: the game, web and server browsers. It is usually _tools inside your games folder. It is only needed when you run a browser tool.

Next steps

With a game synced, wire up its front end with the generated client library on Frontend.