Add one-command server mod updates: build_mods.py --push via update.sh (stop/sync/start, prunes stale jars)

This commit is contained in:
2026-08-21 10:58:38 +02:00
parent 7475ce0942
commit 89c0c47bb1
5 changed files with 247 additions and 13 deletions
+53 -9
View File
@@ -22,7 +22,7 @@ and verifies every mod by sha1 before installing.
|------|--------|
| System packages | `openjdk-21-jre-headless`, `curl`, `unzip` (needs root/`sudo`) |
| NeoForge server | Official installer from Maven → server files + `libraries/` |
| Mods | Downloads the 90 server-safe mods pinned in `mods.json`, sha1-verified |
| Mods | Downloads the 90 server-safe mods pinned in `mods.json`, sha1-verified; prunes jars no longer in the pack |
| Config | `eula.txt` (EULA accepted), `server.properties` (IP, motd, 8 G) |
| Run script | `run.sh` with 8 GB + G1GC (`nogui`) |
@@ -54,13 +54,57 @@ Stop the server cleanly with the console command `stop` (Ctrl-c also works).
the server will crash with `Cannot assign requested address`.
- `difficulty=hard`, `spawn-protection=0`, `view-distance=10` are set for the
airship-focused, land-claim-friendly experience.
- The 19 client-only mods (Iris/shaders, Sodium, Minimap, Jade, JEI, etc.) are
intentionally excluded here — the server is pure gameplay logic.
- The 17 client-only mods (Iris/shaders, Sodium, Minimap, MouseTweaks, etc.)
are intentionally excluded here — everything gameplay-relevant runs on the
server too (including JEI and Jade).
## Updating the pack
## Updating the server's mods
1. Add/remove mods in the Prism instance `Reaper's Sky - dev`.
2. Rebuild + push the mrpack (see repo root `README.md`).
3. Re-run `server/build_mods.py` or regenerate `mods.json`, commit, push.
4. On the server: `git pull && sudo ./deploy.sh && ./run.sh`
(also remove any stale jars from `~/reaper-sky-server/mods/` first).
### The easy way — one command from your PC
If your PC has SSH key access to the server (`ssh root@ReapersSky` works
without a password), you can push mod changes to the live server with a single
command run **from the repo root on your PC**:
```sh
python3 server/build_mods.py --push
```
This does everything:
1. Scans the Prism instance `Reaper's Sky - dev` and regenerates
`server/mods.json` (skipping client-only mods).
2. Uploads that manifest to the server.
3. On the server: **stops** it cleanly, **syncs** `mods/` against the manifest
(deletes jars that are no longer in the pack, downloads + sha1-verifies new
or changed ones), then **starts** it again.
4. Waits for boot and prints `Server is UP` once the log shows `Done (...)`.
No git commit/push is needed first — it works straight from your working tree,
so you can test changes on the server before committing them.
Useful variations:
```sh
python3 server/build_mods.py --push # full cycle: stop -> sync -> start
RS_SERVER_HOST=user@otherhost python3 server/build_mods.py --push # different box
```
### Manual / on-server way
If you already have a `mods.json` on the server (e.g. uploaded by hand), run
this **on the server box**:
```sh
bash ~/update.sh /path/to/mods.json # stop -> sync -> start
bash ~/update.sh /path/to/mods.json --no-start # sync only, leave stopped
```
`update.sh` is safe to re-run at any time: if the server isn't running it just
syncs; every jar is verified by sha1 before it counts as installed.
### Full reinstall
For a brand-new box (or to rebuild everything from scratch), use the one-shot
installer described at the top — it also prunes stale jars since it shares the
same sync logic.