Date: 2026-05-11
Time: 15:53
This is the CLI entry point for ftl2-servercraft, a Minecraft server lifecycle manager built on FTL2. It provides subcommands to provision, start, stop, back up, verify, and monitor game servers on Linode infrastructure. Each command loads server definitions from a YAML config file, sets up FTL2 automation with secret bindings and state management, then delegates to per-server-type scripts for the actual work.
The CLI is invoked as a single binary with subcommands:
# Show status of all configured servers
ftl2-servercraft status
# Provision and start a server, restoring from latest backup
ftl2-servercraft launch my-server
# Start fresh without restoring a backup
ftl2-servercraft launch my-server --fresh
# Re-provision a running server (e.g. after config change)
ftl2-servercraft reconfigure my-server
# Back up, then destroy a server
ftl2-servercraft stop my-server
# Check if the server's tmux session is alive
ftl2-servercraft verify my-server
# Back up without stopping
ftl2-servercraft backup my-server
# Run the auto-teardown watchdog (stops server when no players)
ftl2-servercraft watchdog my-server
# Launch the TUI dashboard (default when no subcommand given)
ftl2-servercraft tui
ftl2-servercraft # also launches TUI
All commands accept --config path/to/servers.yml (defaults to servers.yml).
Config file (servers.yml): Defines servers by name. Each config object exposes .name, .label, .script, .inventorypath, .statepath, .slackchannel, plus methods like .getip(), .isprovisioned(), .getbackups().
FTL2 automation context: Every command that touches infrastructure creates an automation() context with:
secretbindings — maps module FQCNs to Vault secret names (LINODETOKEN, LINODEROOTPASS, SLACK_TOKEN)inventory — path from server configstate_file — path from server config (crash recovery / idempotency)fail_fast=True — abort on first module failuregate_modules="auto" — pre-build modules for remote execution (launch/reconfigure only)gate_dependencies=["httpx"] — additional Python deps for gated modulesautoinstalldeps=True — install missing module dependencies automaticallyLogging: Each command creates a timestamped log file under logs/ (e.g. logs/provision-my-server-20260511-143022.log). Output goes to both file and stdout.
RuntimeError and exits with code 1.--fresh is not passed, the latest backup is restored. If no backups exist, it logs a message and proceeds fresh anyway.config.is_provisioned() and exit early with a message if not.servers.yml; unknown names print available options and exit.config.load_config() — loads and parses servers.yml into server config objectsscripts.getscript() — returns a script module by name with provision(), startserver(), verifyserver(), saveandstop(), backupworld(), restore_world(), destroy() functionsftl2.automation — the FTL2 async context manager providing the ftl handle for running modulescommunity.general.linodev4 — Linode provisioning module (bound to LINODETOKEN, LINODEROOTPASS)community.general.slack — Slack notification module (bound to SLACK_TOKEN).watchdog.runwatchdog / .tui.runtui / .tui.ServerState — watchdog and TUI subsystems