horizon-server: install scripts, a Docker image, and boot services

- packaging/server/install.sh (Linux, macOS) and install.ps1 (Windows) install the latest release (or
  --version) from GitHub, check the SHA-256 GitHub publishes for it, and keep releases side by side:
  <dir>/current points at the one in use, so an update or a rollback is one link, and the game files
  prepared from the owner's Minecraft stay in <dir>/game-files across updates.
- packaging/server/Dockerfile builds the server and the engine; the prepared game files are mounted
  read-only, and the first start writes server.toml from HORIZON_EULA, HORIZON_WORLD, HORIZON_SEED,
  HORIZON_PORT, HORIZON_WHITELIST, HORIZON_PLAYERS and HORIZON_OP (`init` reads them too).
- `horizon-server service install|uninstall|print` writes and loads a systemd unit (user, or --system),
  a launchd agent, or a Windows task at logon. It runs the installer's launcher, so updates apply on
  the next restart.
- Releases build horizon-server and ship it beside horizon-ctl and horizon-prepare; PLAY.txt says how
  to run a server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-16 20:19:57 +02:00
parent 3510764cc6
commit ed6af00ff8
9 changed files with 657 additions and 12 deletions
+8 -7
View File
@@ -1,8 +1,8 @@
//! Repository tasks, run with `cargo run -p xtask -- TASK`.
//!
//! `package BINARY OUTDIR`: a playable Horizon folder with the game binary, horizon-ctl and
//! horizon-prepare (built beside it: cargo build --release -p horizon-client --bins -p
//! horizon-prepare), the exporters horizon-prepare compiles, its sources (the launcher compares
//! `package BINARY OUTDIR`: a playable Horizon folder with the game binary, horizon-ctl,
//! horizon-prepare and horizon-server (built beside it: cargo build --release -p horizon-client
//! --bins -p horizon-prepare -p horizon-server), the exporters horizon-prepare compiles, its sources (the launcher compares
//! them to its own), and PLAY.txt. It holds none of Minecraft's files: players prepare those
//! from their own copy. .github/workflows/release.yml makes the release folders with it.
//!
@@ -29,9 +29,10 @@ const ARCHIVED: [&str; 5] = [
];
/// The programs that sit beside the client: horizon-ctl, the command line and MCP server that
/// play the game, and horizon-prepare, which prepares the resources from the player's own
/// Minecraft.
const TOOLS: [&str; 2] = ["horizon-ctl", "horizon-prepare"];
/// play the game, horizon-prepare, which prepares the resources from the player's own
/// Minecraft, and horizon-server, which hosts a server with the client as its engine
/// (docs/server.md).
const TOOLS: [&str; 3] = ["horizon-ctl", "horizon-prepare", "horizon-server"];
fn main() -> ExitCode {
let args: Vec<String> = std::env::args().skip(1).collect();
@@ -234,7 +235,7 @@ fn package(binary: &Path, out: &Path) -> Result<(), String> {
let path = binary.parent().unwrap_or(Path::new("")).join(name);
if !path.is_file() {
return Err(format!(
"{} is missing; build it too: cargo build --release -p horizon-client --bins -p horizon-prepare",
"{} is missing; build it too: cargo build --release -p horizon-client --bins -p horizon-prepare -p horizon-server",
path.display()
));
}