Skip to content

CLI

The Fabricator CLI is a small Click program for system-level service management on a standard Linux install. It drives systemctl, reads the installed version marker, talks to the local HTTP API for status, runs the bundled update script, and can remove an installation.

Source code lives in the main repo: tools/cli.py.

Commands assume a standard deployment where:

  • Fabricator runs as the fabricator systemd service.
  • The app lives under /opt/fabricator/app.
  • The virtualenv lives under /opt/fabricator/venv.
  • The local API is reachable at http://localhost:5000.
  • /usr/local/bin/fabricator points to the CLI entry point installed by pip install -e /opt/fabricator/app.

Runs systemctl start fabricator.

  • Success: prints a green success message and exits 0.
  • Failure: prints a red error and exits with the systemctl return code.

Runs systemctl stop fabricator.

The command does not call a Flask shutdown endpoint; it delegates service shutdown to systemd.

Updates Fabricator to the latest GitHub release.

  1. Reads /opt/fabricator/app/.fabricator_version when present.
  2. Fetches https://api.github.com/repos/philderks/Fabricator/releases/latest.
  3. If already up to date, exits successfully.
  4. Otherwise runs bash /opt/fabricator/app/tools/install.sh --update with FABRICATOR_VERSION set to the latest tag.

Shows systemd state and local Flask/API reachability.

Options:

OptionDescription
--jsonPrint a JSON object instead of formatted text.

Human output includes:

  • Service: result of systemctl is-active fabricator.
  • Flask: whether GET http://localhost:5000/api/status responds within five seconds.
  • Optional Minecraft-ish keys (players, tps, uptime) when the API response includes them.

JSON shape:

{
"systemd_state": "active",
"flask_up": true,
"api_status_code": 200,
"api_body": {}
}

Prints the installed Fabricator release tag from /opt/fabricator/app/.fabricator_version.

Options:

OptionDescription
--jsonPrint { "version": "<tag or null>" }.

Destructively removes Fabricator. It prompts for yes before proceeding.

The command attempts, in order:

  1. Stop the service.
  2. Disable the service.
  3. Remove /opt/fabricator.
  4. Remove /var/lib/fabricator.
  5. Remove /etc/fabricator.
  6. Remove the fabricator service user.
  7. Remove the systemd unit.
  8. Run systemctl daemon-reload.

Individual removal steps report warnings rather than aborting the whole sequence.

Lists every registered subcommand and short description.

Options:

OptionDescription
--jsonPrint a JSON array of { "command", "description" } objects.

Use Click’s built-in help for command-specific flags:

Terminal window
fabricator status --help
fabricator update --help
CommandPurpose
startStart the systemd service.
stopStop the systemd service.
updateUpdate to latest GitHub release via installer update mode.
statusShow service/API health, optionally as JSON.
versionRead installed release marker, optionally as JSON.
uninstallInteractive destructive removal.
helpList commands, optionally as JSON.