This commit is contained in:
Mateusz Gruszczyński committed 2026-10-30 13:11:36 +01:00
1 parent 0efaae1715
commit c1a2a8cc30
13 files changed
+180 -137

No files matched your search

+77 -65
View File
@@ -1,30 +1,41 @@
# rustbox-package-builder
Linux-only builder i repozytorium pakietów dla RustBox. Projekt jest uproszczoną wersją pipeline'u używanego dla RustProxy: nie zawiera FreeBSD, OPNsense ani dodatkowego agenta.
Linux-only package builder and signed repository publisher for RustBox. It watches the RustBox source repository, builds release binaries, produces distribution-specific packages, signs repository metadata, and serves a small read-only repository dashboard.
## Co buduje
## Supported Linux families
Z jednego commita RustBox dla `amd64/x86_64`:
A single RustBox source commit is published for `amd64/x86_64` in three equal Linux families:
- podpisany DEB i repo APT,
- podpisany RPM i repo DNF/YUM,
- opcjonalny osobny RPM dla SUSE/openSUSE i repo Zypper,
- panel WWW repozytorium w stylistyce RustBox,
- publiczny JSON `GET /api/v1/packages`.
- Debian / Ubuntu: DEB package and signed APT repository
- RHEL / AlmaLinux / Rocky Linux: RPM package and signed DNF/YUM repository
- SUSE / openSUSE: RPM package and signed Zypper repository
Builder obserwuje `SOURCE_BRANCH`. Nowy commit lub zmiana `PACKAGING_REVISION` uruchamia testy, release build i publikację nowego snapshotu. `current` jest przełączany atomowo dopiero po udanym pakowaniu i podpisaniu metadanych.
The dashboard and API use these three families directly. There is no separate generic `Linux` channel.
## Wymaganie po stronie źródeł RustBox
## Repository dashboard
Repo RustBox musi obsługiwać natywne logowanie plikowe przez `log_dir`. Pakiet ustawia:
The repository UI is English-only and intentionally text-only. It has no logo, favicon, decorative icons, or letter badge. The default public HTTP port is `18965`.
The dashboard provides:
- latest RustBox package version
- status for Debian / Ubuntu, RHEL / AlmaLinux / Rocky Linux, and SUSE / openSUSE
- downloadable package list
- installation commands for each Linux family
- repository metadata and build information
- JSON API at `GET /api/v1/packages`
## RustBox source requirement
RustBox must support native file logging through `log_dir`. The package configuration uses:
```toml
log_dir = "/var/log/rustbox"
```
Builder celowo przerywa build, jeśli w źródłach nie ma obsługi `log_dir`. Dzięki temu logi aplikacji trafiają do `/var/log/rustbox/rustbox.log`, a nie do stdout usługi systemd.
The builder rejects RustBox sources that do not contain this setting. Application logs are written to `/var/log/rustbox/rustbox.log` instead of normal systemd stdout logging.
## Szybki start
## Quick start
```bash
cp .env.example .env
@@ -32,30 +43,26 @@ nano .env
./start.sh
```
Minimalnie ustaw:
Minimum configuration:
```env
SOURCE_REPO=https://git.example.com/rustbox/RustBox.git
SOURCE_BRANCH=master
REPOSITORY_URL=https://repo.example.com
REPOSITORY_URL=http://127.0.0.1:18965
HTTP_PORT=18965
```
Dla lokalnego HTTP można użyć:
For a public installation, set `REPOSITORY_URL` to the externally reachable URL. If a reverse proxy terminates HTTPS, it can forward traffic to local port `18965`.
```env
REPOSITORY_URL=http://192.168.1.100
HTTP_PORT=18765
```
`start.sh` creates a persistent GPG signing key in `gpg/`, builds the containers, and starts:
`start.sh` utworzy trwały klucz GPG w `gpg/`, zbuduje obrazy i uruchomi:
- `rustbox-package-builder`: source watcher, build, package and publication process
- `repository-dashboard`: read-only dashboard and API
- `repository-http`: Nginx serving the dashboard and package repositories on port `18965` by default
- `rustbox-package-builder` — watcher + build + publikacja,
- `repository-dashboard` — read-only panel/API,
- `repository-http` — Nginx udostępniający panel oraz artefakty APT/RPM.
Persistent builder state is stored in `data/`.
Dane buildera są trwałe w `data/`.
## Domyślne ustawienia builda
## Default build settings
```env
POLL_INTERVAL=300
@@ -64,15 +71,16 @@ REPO_COMPONENT=main
PACKAGE_RELEASE=auto
RUN_LINUX_TESTS=compile
MAX_GLIBC_VERSION=2.34
BUILD_SUSE=1
RELEASE_RETENTION=10
```
`RUN_LINUX_TESTS=compile` uruchamia `cargo test --release --locked --no-run`. Ustaw `full`, aby uruchamiać wszystkie testy, albo `0`, aby je wyłączyć.
`RUN_LINUX_TESTS=compile` runs `cargo test --release --locked --no-run`. Use `full` to run the test suite or `0` to skip Rust tests.
## Instalacja pakietu RustBox
All three supported Linux package families are built on every successful release. SUSE is not treated as a separate non-Linux target.
Pakiet instaluje:
## Installed RustBox layout
The generated packages install:
```text
/usr/local/bin/rustbox
@@ -81,7 +89,7 @@ Pakiet instaluje:
/etc/logrotate.d/rustbox
```
oraz tworzy:
They create and maintain:
```text
/var/lib/rustbox rustbox:rustbox 0700
@@ -89,11 +97,11 @@ oraz tworzy:
/etc/rustbox rustbox:rustbox 0750
```
`/etc/rustbox/rustbox.toml` ma finalnie `rustbox:rustbox 0640` i jest oznaczony jako `config|noreplace`, więc aktualizacja pakietu nie nadpisuje lokalnej konfiguracji.
`/etc/rustbox/rustbox.toml` is owned by `rustbox:rustbox`, mode `0640`, and packaged as a non-replacing configuration file so package upgrades preserve local changes.
### systemd
## systemd
Jednostka używa:
The service uses the dedicated `rustbox` user and hardened systemd settings:
```ini
User=rustbox
@@ -108,19 +116,13 @@ ProtectHome=true
NoNewPrivileges=true
```
Logi tracing RustBox trafiają do `/var/log/rustbox/rustbox.log`. `StandardOutput=null`; `StandardError=journal` zostaje tylko dla błędów startowych, które wystąpią zanim aplikacja uruchomi własny logger.
RustBox tracing logs are written to `/var/log/rustbox/rustbox.log`. `StandardOutput=null` is used for normal output. `StandardError=journal` remains available for startup failures that happen before the application logger is initialized.
### logrotate
## logrotate
`/etc/logrotate.d/rustbox`:
`/etc/logrotate.d/rustbox` rotates `/var/log/rustbox/rustbox.log` daily, keeps 7 rotations, compresses old files, and recreates the active log with `rustbox:rustbox` ownership.
```text
/var/log/rustbox/rustbox.log
```
jest obracany codziennie i przechowywany przez 7 rotacji, z kompresją i właścicielem `rustbox:rustbox`.
## Domyślna konfiguracja pakietu
## Default RustBox configuration
```toml
host = "0.0.0.0"
@@ -156,51 +158,58 @@ pgp_max_key_bytes = 1048576
pgp_allow_private_export = true
```
## Repo APT
Panel pokazuje gotowe polecenia. Ręcznie:
## Debian / Ubuntu
```bash
curl -fsSL https://repo.example.com/repo-key.gpg \
curl -fsSL http://repo.example.com:18965/repo-key.gpg \
| sudo gpg --dearmor -o /usr/share/keyrings/rustbox.gpg
echo "deb [signed-by=/usr/share/keyrings/rustbox.gpg] https://repo.example.com/apt stable main" \
echo "deb [signed-by=/usr/share/keyrings/rustbox.gpg] http://repo.example.com:18965/apt stable main" \
| sudo tee /etc/apt/sources.list.d/rustbox.list
sudo apt update
sudo apt install rustbox
```
## Repo DNF/YUM
## RHEL / AlmaLinux / Rocky Linux
```bash
sudo rpm --import https://repo.example.com/repo-key.gpg
sudo rpm --import http://repo.example.com:18965/repo-key.gpg
sudo tee /etc/yum.repos.d/rustbox.repo >/dev/null <<'REPO'
[rustbox]
name=RustBox Repository
baseurl=https://repo.example.com/rpm/$basearch
name=RustBox Package Repository
baseurl=http://repo.example.com:18965/rpm/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://repo.example.com/repo-key.gpg
gpgkey=http://repo.example.com:18965/repo-key.gpg
REPO
sudo dnf install rustbox
```
## Repo SUSE/Zypper
## SUSE / openSUSE
```bash
sudo rpm --import https://repo.example.com/repo-key.gpg
sudo zypper addrepo --refresh --gpgcheck https://repo.example.com/suse/x86_64/ rustbox
sudo rpm --import http://repo.example.com:18965/repo-key.gpg
sudo zypper addrepo --refresh --gpgcheck http://repo.example.com:18965/suse/x86_64/ rustbox
sudo zypper refresh rustbox
sudo zypper install rustbox
```
## Reverse proxy
## Repository paths
Nginx buildera nasłuchuje lokalnie na `HTTP_PORT` (domyślnie `18765`). Dla publicznego HTTPS zalecany jest zewnętrzny reverse proxy kierujący na ten port.
```text
/apt/ Debian / Ubuntu APT repository
/rpm/x86_64/ RHEL / AlmaLinux / Rocky Linux RPM repository
/suse/x86_64/ SUSE / openSUSE RPM repository
/repo-key.gpg public package signing key
/DEBIAN-BUILD-INFO.txt Debian / Ubuntu build metadata
/RHEL-BUILD-INFO.txt RHEL-family build metadata
/SUSE-BUILD-INFO.txt SUSE-family build metadata
/api/v1/packages repository JSON API
```
## Logi buildera
## Builder logs
```bash
docker compose --env-file .env logs -f rustbox-package-builder
@@ -208,11 +217,14 @@ docker compose --env-file .env logs -f repository-http
docker compose --env-file .env logs -f repository-dashboard
```
## Licencja paczki
## Runtime package dependencies
Dostarczone źródła RustBox nie zawierają autorytatywnego pliku `LICENSE`; `NOTICE.md` zaleca weryfikację licencji upstream przed publiczną redystrybucją. Dlatego builder ustawia obecnie metadane pakietu na `UNKNOWN`, zamiast zgadywać licencję. Przed publicznym repozytorium warto ustalić właściwe oznaczenie i wtedy zmienić je w `scripts/prepare-package.sh`.
Generated packages declare the system OpenSSL and GnuPG dependencies used by RustBox:
## Zależności runtime
- Debian / Ubuntu: `libssl3` or `libssl3t64`, plus `gnupg`
- RHEL / AlmaLinux / Rocky Linux: `openssl-libs` and `gnupg2`
- SUSE / openSUSE: `libopenssl3` and `gpg2`
Pakiety deklarują jawnie systemowy OpenSSL i GnuPG używane przez RustBox. Dla APT są to `libssl3`/`libssl3t64` i `gnupg`, dla RHEL/Rocky `openssl-libs` i `gnupg2`, a dla SUSE `libopenssl3` i `gpg2`.
## Package license metadata
The supplied RustBox source archive does not contain an authoritative `LICENSE` file. The builder therefore keeps package license metadata as `UNKNOWN` instead of guessing. Set the correct license in `scripts/prepare-package.sh` before public redistribution once the upstream license has been confirmed.