From 494eaa6617d4ded01f5f3ed98fd0e8f8a4ff9877 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Oct 2025 20:09:10 +0200 Subject: [PATCH] Initial commit: Nicotine-Less Docker container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lightweight Docker container for Nicotine+ with noVNC web interface and Firefox ESR browser. Features: - noVNC web interface with dynamic resize support - Firefox ESR for testing ports and browsing - TigerVNC with AcceptSetDesktopSize enabled - Supervisor for process management - Configurable user/group permissions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .gitignore | 6 + Dockerfile | 89 ++++++++++++++ README.md | 231 +++++++++++++++++++++++++++++++++++++ docker-compose.yml.example | 60 ++++++++++ entrypoint.sh | 43 +++++++ index.html | 12 ++ openbox-autostart.sh | 5 + openbox-rc.xml | 50 ++++++++ supervisord.conf | 43 +++++++ 9 files changed, 539 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-compose.yml.example create mode 100755 entrypoint.sh create mode 100644 index.html create mode 100755 openbox-autostart.sh create mode 100644 openbox-rc.xml create mode 100644 supervisord.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..015865e --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# Dati utente e configurazioni personali +data/ + +# File di configurazione personalizzati +nicotine-config +docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..47be7bb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,89 @@ +FROM debian:bookworm-slim + +# Metadata +LABEL maintainer="Nicola" +LABEL description="Nicotine+ with noVNC web interface and SSH X forwarding support" +LABEL version="1.0" + +# Evita prompt interattivi +ENV DEBIAN_FRONTEND=noninteractive + +# Variabili d'ambiente +ENV DISPLAY=:0 \ + VNC_PORT=5900 \ + NOVNC_PORT=6080 \ + VNC_RESOLUTION=1280x720 \ + VNC_DEPTH=24 \ + USER=nicotine \ + PUID=1000 \ + PGID=1000 + +# Installa dipendenze +RUN apt-get update && apt-get install -y \ + # Window manager leggero + openbox \ + xterm \ + dbus-x11 \ + # VNC server (solo per noVNC backend) + tigervnc-standalone-server \ + tigervnc-common \ + # noVNC per interfaccia web + novnc \ + python3-websockify \ + # Dipendenze Nicotine+ + python3 \ + python3-pip \ + python3-gi \ + python3-gi-cairo \ + gir1.2-gtk-3.0 \ + # Browser leggero + firefox-esr \ + # Per SSH X forwarding + xauth \ + # Supervisord per gestire i processi + supervisor \ + # Utility + wget \ + curl \ + procps \ + net-tools \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Installa Nicotine+ ultima versione +RUN pip3 install --no-cache-dir --break-system-packages nicotine-plus + +# Crea utente non-root +RUN groupadd -g ${PGID} ${USER} && \ + useradd -u ${PUID} -g ${PGID} -m -s /bin/bash ${USER} + +# Crea directory +RUN mkdir -p \ + /config \ + /downloads \ + /incomplete \ + /home/${USER}/.config/openbox \ + /home/${USER}/.config/nicotine \ + /home/${USER}/.vnc \ + /var/log/supervisor + +# Copia configurazioni +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +COPY openbox-rc.xml /home/${USER}/.config/openbox/rc.xml +COPY index.html /usr/share/novnc/index.html + +# Permessi +RUN chmod +x /usr/local/bin/entrypoint.sh \ + && chown -R ${USER}:${USER} /home/${USER} /config /downloads /incomplete + +# Esponi solo noVNC e porte Soulseek +EXPOSE 6080 2234 2235/udp + +# Volumi +VOLUME ["/config", "/downloads", "/incomplete"] + +WORKDIR /home/${USER} + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..7504606 --- /dev/null +++ b/README.md @@ -0,0 +1,231 @@ +# Nicotine-Less + +Container Docker leggero per Nicotine+ (client Soulseek) con interfaccia web tramite noVNC e Firefox ESR integrato. + +## Caratteristiche + +- Interfaccia web accessibile da browser (noVNC) +- Firefox ESR integrato per testare porte e navigare +- Ridimensionamento dinamico della finestra VNC +- Supporto SSH X forwarding +- Gestione permessi user/group personalizzabili +- Volumi persistenti per configurazione e download +- Ottimizzato per architettura ARM64 +- Nessuna porta VNC esposta esternamente (solo web) + +## Requisiti + +- Docker e Docker Compose installati +- Raspberry Pi con architettura ARM64 +- Porte disponibili: 6080 (web), 2234 (TCP), 2235 (UDP) + +## Installazione + +### 1. Clona o crea la directory del progetto + +```bash +git clone https://git.nicola.sh/public/nicotine-less.git +cd nicotine-less +``` + +### 2. Crea le directory per i volumi + +```bash +mkdir -p data/config data/downloads data/incomplete +``` + +### 3. Configura le variabili d'ambiente (opzionale) + +Modifica `docker-compose.yml` se necessario: + +```yaml +environment: + - PUID=1000 # Cambia con il tuo user ID (comando: id -u) + - PGID=1000 # Cambia con il tuo group ID (comando: id -g) + - TZ=Europe/Rome # Cambia il tuo timezone + - VNC_RESOLUTION=1280x720 # Risoluzione desktop + - VNC_PASSWORD=nicotine # Password per VNC +``` + +### 4. Build dell'immagine + +```bash +docker-compose build +``` + +### 5. Avvia il container + +```bash +docker-compose up -d +``` + +## Utilizzo + +### Accesso Web (noVNC) + +Apri il browser e vai a: + +``` +http://localhost:6080 +``` + +O da un altro dispositivo nella stessa rete: + +``` +http://INDIRIZZO_IP_RASPBERRY:6080 +``` + +### Accesso via SSH X Forwarding + +```bash +ssh -X user@raspberry_ip +docker exec -it nicotine-less nicotine +``` + +### Gestione del container + +```bash +# Visualizza i log +docker-compose logs -f + +# Ferma il container +docker-compose down + +# Riavvia il container +docker-compose restart + +# Aggiorna e ricostruisci +docker-compose down +docker-compose build --no-cache +docker-compose up -d +``` + +## Struttura dei volumi + +``` +./data/ +├── config/ # Configurazione Nicotine+ (database, impostazioni) +├── downloads/ # File scaricati completati +└── incomplete/ # Download in corso +``` + +### Aggiungere cartelle condivise + +Per condividere cartelle con altri utenti Soulseek, modifica `docker-compose.yml`: + +```yaml +volumes: + - ./data/config:/config + - ./data/downloads:/downloads + - ./data/incomplete:/incomplete + - /percorso/musica:/shares/music:ro # Aggiungi questa riga + - /percorso/video:/shares/video:ro # E questa +``` + +Poi riavvia il container e configura le condivisioni dentro Nicotine+. + +## Configurazione Nicotine+ + +Al primo avvio: + +1. Apri l'interfaccia web (http://localhost:6080) +2. Configura username e password Soulseek +3. Vai in Preferenze → Shares per impostare le cartelle condivise +4. Vai in Preferenze → Network per verificare le porte (2234/2235) +5. Configurazione consigliata per Raspberry Pi: + - Max upload slots: 2-4 + - Max download slots: 2-4 + - Limite banda in base alla tua connessione + +## Porte utilizzate + +| Porta | Tipo | Descrizione | +|-------|------|-------------| +| 6080 | TCP | Interfaccia web noVNC | +| 2234 | TCP | Connessioni Soulseek | +| 2235 | UDP | Ricerca Soulseek | + +## Risoluzione problemi + +### L'interfaccia web non si carica + +```bash +docker-compose logs +# Verifica che tutti i servizi siano attivi +``` + +### Permessi negati sui file + +Verifica PUID e PGID nel docker-compose.yml: + +```bash +id -u # User ID +id -g # Group ID +``` + +### Performance su Raspberry Pi + +Modifica i limiti risorse in `docker-compose.yml`: + +```yaml +deploy: + resources: + limits: + memory: 512M # Riduci se necessario + cpus: '1' # Riduci se necessario +``` + +### Download lenti + +- Verifica la connettività di rete del container +- Controlla le impostazioni di banda in Nicotine+ +- Assicurati che le porte 2234/2235 siano aperte nel router + +## Backup + +Per fare backup della configurazione: + +```bash +tar -czf nicotine-backup-$(date +%Y%m%d).tar.gz data/ +``` + +Per ripristinare: + +```bash +tar -xzf nicotine-backup-YYYYMMDD.tar.gz +``` + +## Aggiornamenti + +Per aggiornare Nicotine+ all'ultima versione: + +```bash +docker-compose down +docker-compose build --no-cache +docker-compose up -d +``` + +## Sicurezza + +- Cambia la password VNC predefinita in `docker-compose.yml` +- Considera l'uso di un reverse proxy (nginx/traefik) con HTTPS +- Non esporre la porta 6080 su Internet senza protezione +- Usa VPN o SSH tunneling per accesso remoto sicuro + +## Accesso remoto sicuro (SSH tunnel) + +```bash +ssh -L 6080:localhost:6080 user@raspberry_ip +``` + +Poi apri `http://localhost:6080` sul tuo computer locale. + +## Licenza + +Questo progetto è fornito "as-is" senza garanzie. + +## Link utili + +- [Nicotine+ GitHub](https://github.com/nicotine-plus/nicotine-plus) +- [Documentazione Nicotine+](https://nicotine-plus.org) +- [noVNC GitHub](https://github.com/novnc/noVNC) diff --git a/docker-compose.yml.example b/docker-compose.yml.example new file mode 100644 index 0000000..52635ff --- /dev/null +++ b/docker-compose.yml.example @@ -0,0 +1,60 @@ +services: + nicotine-less: + build: . + container_name: nicotine-less + image: nicotine-less:latest + restart: unless-stopped + + # Porte + ports: + - "6080:6080" # Interfaccia web noVNC + - "2234:2234" # Porta Soulseek TCP + - "2235:2235/udp" # Porta Soulseek UDP + + # Variabili d'ambiente + environment: + - PUID=1000 # User ID (cambia se necessario) + - PGID=1000 # Group ID (cambia se necessario) + - TZ=Europe/Rome # Timezone + - VNC_RESOLUTION=1920x1080 # Risoluzione desktop + - VNC_DEPTH=24 # Profondità colore + - VNC_PASSWORD=nicotine # Password per VNC (opzionale) + - DISPLAY=:0 + + # Volumi persistenti + volumes: + # Configurazione Nicotine+ (database, settings, liste utenti, ecc) + - ./data/config:/config + + # Download completati - MODIFICA CON IL TUO PERCORSO + - /path/to/your/downloads:/downloads + + # Download incompleti/in corso - MODIFICA CON IL TUO PERCORSO + - /path/to/your/incomplete:/incomplete + + # Opzionale: cartelle condivise aggiuntive - MODIFICA CON I TUOI PERCORSI + # - /path/to/your/music:/shares/music:ro + # - /path/to/your/other:/shares/other:ro + + # Limiti risorse (opzionale, utile per Raspberry Pi) + deploy: + resources: + limits: + memory: 1G + cpus: '2' + reservations: + memory: 256M + + # Network + network_mode: bridge + + # Privileged mode non necessario + privileged: false + + # Healthcheck + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:6080"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..76fe1e0 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +# Aggiorna PUID e PGID se necessario +if [ ! -z "$PUID" ] && [ "$PUID" != "1000" ]; then + usermod -u $PUID nicotine +fi + +if [ ! -z "$PGID" ] && [ "$PGID" != "1000" ]; then + groupmod -g $PGID nicotine +fi + +# Correggi permessi sui volumi +chown -R nicotine:nicotine /config /downloads /incomplete 2>/dev/null || true + +# Crea directory necessarie +mkdir -p /home/nicotine/.local/share/nicotine +chown -R nicotine:nicotine /home/nicotine/.local + +# Crea link simbolico dalla config di Nicotine+ al volume persistente +if [ ! -L "/home/nicotine/.config/nicotine" ]; then + rm -rf /home/nicotine/.config/nicotine + ln -s /config /home/nicotine/.config/nicotine +fi + +# Configura password VNC se specificata +if [ ! -z "$VNC_PASSWORD" ]; then + mkdir -p /home/nicotine/.vnc + echo "$VNC_PASSWORD" | vncpasswd -f > /home/nicotine/.vnc/passwd + chmod 600 /home/nicotine/.vnc/passwd + chown nicotine:nicotine /home/nicotine/.vnc/passwd +fi + +# Esporta variabili d'ambiente per supervisord +export DISPLAY +export VNC_PORT +export NOVNC_PORT +export VNC_RESOLUTION +export VNC_DEPTH +export USER + +# Avvia supervisord come root (che poi farà partire i processi come utente nicotine) +exec "$@" diff --git a/index.html b/index.html new file mode 100644 index 0000000..82fe46a --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + + Nicotine+ noVNC + + +

Redirecting to noVNC with remote resize enabled...

+

If not redirected automatically, click here.

+ + diff --git a/openbox-autostart.sh b/openbox-autostart.sh new file mode 100755 index 0000000..8bf89a9 --- /dev/null +++ b/openbox-autostart.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Avvia Nicotine+ automaticamente +sleep 2 +nicotine & diff --git a/openbox-rc.xml b/openbox-rc.xml new file mode 100644 index 0000000..31641d8 --- /dev/null +++ b/openbox-rc.xml @@ -0,0 +1,50 @@ + + + + + 1 + + 1 + + Desktop + + 0 + + + + 8 + 500 + 0 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + C-g + + diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..4972481 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,43 @@ +[supervisord] +nodaemon=true +user=root +logfile=/var/log/supervisor/supervisord.log +pidfile=/var/run/supervisord.pid + +[program:xvnc] +command=/usr/bin/Xvnc :0 -geometry %(ENV_VNC_RESOLUTION)s -depth %(ENV_VNC_DEPTH)s -SecurityTypes None -rfbport %(ENV_VNC_PORT)s -AcceptSetDesktopSize=1 +user=%(ENV_USER)s +autostart=true +autorestart=true +priority=10 +stdout_logfile=/var/log/supervisor/xvnc.log +stderr_logfile=/var/log/supervisor/xvnc_err.log + +[program:openbox] +command=/usr/bin/openbox +environment=DISPLAY=":0" +user=%(ENV_USER)s +autostart=true +autorestart=true +priority=20 +stdout_logfile=/var/log/supervisor/openbox.log +stderr_logfile=/var/log/supervisor/openbox_err.log + +[program:novnc] +command=/usr/share/novnc/utils/novnc_proxy --vnc localhost:%(ENV_VNC_PORT)s --listen %(ENV_NOVNC_PORT)s +user=%(ENV_USER)s +autostart=true +autorestart=true +priority=30 +stdout_logfile=/var/log/supervisor/novnc.log +stderr_logfile=/var/log/supervisor/novnc_err.log + +[program:nicotine] +command=/usr/local/bin/nicotine +environment=DISPLAY=":0",HOME="/home/%(ENV_USER)s",XDG_CONFIG_HOME="/home/%(ENV_USER)s/.config",XDG_DATA_HOME="/home/%(ENV_USER)s/.local/share" +user=%(ENV_USER)s +autostart=true +autorestart=true +priority=40 +stdout_logfile=/var/log/supervisor/nicotine.log +stderr_logfile=/var/log/supervisor/nicotine_err.log