🍴 Aquest repositori és un fork de
uhcv/PiBlockamb les correccions derivades de l'auditoria post-tribunal (vegeuCHANGELOG.md). El repositori original es manté com a referència; aquest fork conté la versió neta de erratas i pensada per a futurs deployments.
Un servidor de Minecraft per a aules sobre una Raspberry Pi 5. Java i Bedrock al mateix món.
PiBlock converteix una Raspberry Pi 5 en un servidor de Minecraft preparat per a classes. S'instal·la amb un curl ... | bash i deixa l'stack llest perquè els alumnes es connectin des de Java o Bedrock al mateix món. La gestió es fa des d'un panell web propi a http://piblock.cat. Si voleu, hi ha un daemon Pyrodactyl Elytra inclòs perquè el podeu vincular a un panell extern.
Estat: el stack de joc funciona via install.sh. La provisió automàtica de MariaDB, els backups programats des de la web, el registre automàtic de noves màquines i la interfície del professor estan documentats a sota com a feina pendent.
flowchart TB
subgraph clients["Clients (Internet · LAN del centre)"]
J["Java Client (PC)<br>TCP · 25565"]
B["Bedrock Client (mòbil · consola)<br>UDP · 19132"]
end
subgraph pi["Raspberry Pi 5 · Debian/Ubuntu · OpenJDK 21"]
direction TB
V["VELOCITY 3.4.0<br>Port 25565 · TCP<br>online-mode · modern forwarding"]
G["GEYSER STANDALONE<br>Port 19132 · UDP<br>+ Floodgate (auth Bedrock)"]
P["PAPER 1.21.4<br>Port 30066 · TCP · localhost<br>món principal"]
L["LIMBO 0.7.18<br>Port 30000 · TCP · localhost<br>sala d'espera"]
W["Nginx + PHP-FPM<br>Port 80<br>http://piblock.cat"]
E["Elytra (Pyrodactyl)<br>Port 8080<br>panell extern manual"]
D["MariaDB<br>usuaris · logs · authorized_users · config_servidor"]
end
J == Connexió Java ==> V
B == Connexió Bedrock ==> G
G == Traducció de paquets ==> V
V == Jugador autenticat ==> P
V -. Failover si Paper cau .-> L
W == PDO ==> D
E -. Vinculació manual .-> Ext[Panell Pyrodactyl extern]
classDef client fill:#2c3e50,stroke:white,color:white,stroke-width:2px
classDef velocity fill:#09add3,stroke:white,color:white,stroke-width:4px
classDef geyser fill:#2ecc71,stroke:white,color:white
classDef paper fill:#F44336,stroke:white,color:white
classDef limbo fill:#AFB42B,stroke:white,color:white
classDef web fill:#005f73,stroke:white,color:white
classDef pyro fill:#5b3fd6,stroke:white,color:white
classDef db fill:#003545,stroke:white,color:white
J:::client
B:::client
V:::velocity
G:::geyser
P:::paper
L:::limbo
W:::web
E:::pyro
D:::db
Cada servei té la seva unitat systemd (piblock-velocity.service, piblock-paper.service, piblock-limbo.service, piblock-geyser.service, tots amb Restart=on-failure) i elytra.service. La xarxa la fan nginx + php-fpm, mariadb i avahi-daemon (mDNS, per resoldre piblock.cat a la LAN).
PiBlock/
├── README.md
├── install.sh
├── config/
│ ├── paper/ # server.properties · spigot.yml · paper-global.yml · plugins/floodgate
│ ├── velocity/ # velocity.toml · plugins/floodgate
│ ├── geyser/ # config.yml
│ └── limbo/ # server.properties · spawn.schem · plugins/floodgate
├── web/ # Panell web PHP (pla, sense subdirs)
│ ├── login.php · register.php · dashboard.php · config.php
│ ├── admin_users.php · delete_users.php · logs.php
│ ├── auth.php · db.php · logout.php · style.css
└── docs/ # Memòria tècnica (PDF) i presentació bundled (HTML)
Cal Debian o Ubuntu (LTS recomanat) sobre la Raspberry Pi 5, sortida a Internet i accés root.
curl -sSL piblock.cat/install.sh | sudo bashinstall.sh són 605 línies. El que fa, en ordre:
- Detecta l'arquitectura (
amd64/arm64/armhf) i comprova els recursos. - Instal·la dependències: OpenJDK 21, Nginx, PHP-FPM, UFW, Avahi,
openssl,sqlite3. - Instal·la Docker (el necessita el daemon Elytra).
- Baixa Paper 1.21.4 build 222, Velocity 3.4.0-SNAPSHOT build 469, Limbo 0.7.18 i Geyser latest.
- Baixa els plugins: Floodgate, Hurricane, PacketEvents 2.11.2-SNAPSHOT, GeyserExtras 2.0.0-BETA-11.
- Instal·la Elytra (daemon Pyrodactyl) i Rustic (backups deduplicats i encriptats).
- Crea l'usuari de sistema
pyrodactyl(UID 8888) i el posa al grupdocker. - Genera secrets: la clau de modern forwarding per a Velocity i
key.pem(EC P-384) per a Floodgate. - Crea les unitats
systemdpiblock-*ambRestart=on-failurei obre el firewall UFW (22, 80, 443, 25565/TCP, 19132/UDP, 8080). - Configura Nginx perquè serveixi
/var/www/piblockahttp://piblock.cat. - Configura
avahi-daemon(mDNS) perquè anunciïpiblockipiblock.cata la xarxa local. - Llança un backup inicial amb Rustic.
Després pots fer servir:
/opt/piblock/start_all.sh
/opt/piblock/stop_all.sh
systemctl status piblock-*Elytra queda instal·lat però no configurat. Per vincular-lo a un panell Pyrodactyl extern:
cd /etc/elytra && elytra configure \
--panel-url <URL_DEL_PANELL> --token <TOKEN> --node <NODE_ID>
systemctl enable --now elytra| Servei | URL / Port | Visibilitat |
|---|---|---|
| Panell web propi | http://piblock.cat (port 80) | Internet (UFW) |
| Servidor Java | piblock.cat:25565 | Internet (UFW) |
| Servidor Bedrock | piblock.cat:19132/UDP | Internet (UFW) |
| Daemon Elytra | :8080 | Internet (UFW) |
| Paper (intern) | :30066 | Només localhost |
| Limbo (intern) | :30000 | Només localhost |
El panell web va per HTTP, no HTTPS. La resolució piblock.cat a la LAN va per mDNS (avahi-daemon).
Login amb password_hash (bcrypt) i sessions PHP. Totes les consultes a la BD passen per PDO amb prepared statements.
Hi ha tres rols definits a usuaris.rol:
admin: gestiona usuaris, logs i eliminacions.professor: és el rol per defecte quan algú es registra amb codi d'invitació.user: rol bàsic que unadmincrea a mà.
| Taula | Columnes | Per a què |
|---|---|---|
usuaris |
id, username, password_hash, rol |
Comptes i credencials |
authorized_users |
id, username, invite_code, used |
Codis d'invitació |
logs |
id, username, action, created_at |
Activitat |
config_servidor |
clau, valor |
Dificultat, gamemode, whitelist |
| Àrea | Estat |
|---|---|
| Stack Minecraft (Paper, Velocity, Geyser, Floodgate, Limbo) | Operatiu |
| Failover a Limbo | Operatiu |
| Java + Bedrock al mateix món | Operatiu |
| install.sh (one-liner) | Operatiu |
| Backup inicial amb Rustic | Operatiu |
| UFW + mDNS (piblock.cat) | Operatiu |
| Panell web (login, dashboard, config, admin, logs) | Operatiu |
| Daemon Elytra instal·lat | Cal vincular-lo manualment a un Pyrodactyl |
| Provisió automàtica de MariaDB i esquema | Pendent |
| Backups programats des de la web | Pendent |
| Registre automàtic de noves màquines | Pendent |
| Interfície educativa del professor (CU-07, CU-08) | Pendent |
- Memòria tècnica (PDF):
docs/MemoriaTecnica.pdf - Presentació pública: https://uhcv.github.io/
- Panell web: http://piblock.cat
- Gantt a ClickUp: https://app.clickup.com/90152331687/v/s/90159849084
Projecte intermodular del cicle SMX2, Mòdul M12, INS Palamós, curs 2025-26.
- Mohamed Amen Adaardour Majdi: infraestructura, proxy, scripts.
- Diego Morazán: web PHP, documentació, repositori.
Tutor: Antonio Alcalà.
Fork: Neudron/PiBlock-Fix · Original: uhcv/PiBlock