mirror of
https://gitcode.com/JianFeeeee/ModelRouter.git
synced 2026-09-19 16:39:15 +00:00
Previously only the Electron GUI had installers; server admins had to build the
core by hand (`make build` -> bare binary). This adds a first-class server
distribution:
- `make core-dist` -> packaging/core-dist.sh -> cmd/build/dist/
llmsproxy_<ver>_amd64.deb (systemd unit + adapters + example config)
llmsproxy-<ver>.x86_64.rpm
llmsproxy-<ver>-linux-amd64.tar.gz
- nfpm config (packaging/nfpm.yaml): binary to /usr/bin, systemd unit with the
measured memory tuning (GOGC=50, MALLOC_ARENA_MAX=2) baked in, Lua adapters to
/usr/share/llmsproxy/adapters, repo's config.yaml as the example.
- postinst seeds /etc/llmsproxy/config.yaml on first install and keeps existing
runtime state across reinstalls; prerm stops the service on removal.
Gotchas handled: nfpm v2 here does not render `{{ .Env.VERSION }}`, so the script
stamps the version into a throwaway config copy; and under `set -o pipefail` the
idiom `strings | grep -q` is broken (grep -q closes the pipe and strings dies on
SIGPIPE -> spurious 141), so the symbol sanity-gate stages strings in a temp file.
README (zh/en) updated: memory figures replaced with production-measured
32-35 MB settled (was 37-42), and the packaging docs now describe core-dist and
the dockerized Windows build.
22 lines
738 B
Bash
Executable File
22 lines
738 B
Bash
Executable File
#!/bin/sh
|
|
# llmsproxy core package postinst
|
|
set -e
|
|
|
|
# Runtime state belongs under /etc/llmsproxy just like the production layout:
|
|
# runtime.json holds keys/created sources and is NOT touched on reinstall.
|
|
mkdir -p /etc/llmsproxy/adapters
|
|
|
|
if [ -f /etc/llmsproxy/config.yaml ]; then
|
|
echo "llmsproxy: keeping existing /etc/llmsproxy/config.yaml"
|
|
else
|
|
# seed a starter config from the packaged example
|
|
cp -f /usr/share/llmsproxy/config.example.yaml /etc/llmsproxy/config.yaml 2>/dev/null || true
|
|
chmod 0644 /etc/llmsproxy/config.yaml
|
|
fi
|
|
|
|
# systemd
|
|
if command -v systemctl >/dev/null 2>&1; then
|
|
systemctl daemon-reload >/dev/null 2>&1 || true
|
|
echo "llmsproxy: use 'systemctl enable --now llmsproxy' to start"
|
|
fi
|
|
exit 0 |