Overview

Date: 2026-05-11

Time: 15:53

Overview

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.

Usage Patterns

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

API and Configuration

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:

Logging: 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.

Key Behaviors

Relationships