From ebdb3472978a2a43e752a2c24e3f11d20eeca288 Mon Sep 17 00:00:00 2001 From: Morgan Wattiez <morgan@zoemp.be> Date: Mon, 31 Mar 2025 02:33:53 +0200 Subject: [PATCH] wip: init packaging, build & run --- .gitignore | 1 + CHANGELOG.md | 5 +++ CloudronManifest.json | 18 +++++++++++ DESCRIPTION.md | 17 ++++++++++ Dockerfile.cloudron | 72 +++++++++++++++++++++++++++++++++++++++++++ README.md | 4 +++ VERSION | 2 ++ build.sh | 13 ++++++++ dev.sh | 11 +++++++ docker-compose.yml | 11 +++++++ soulseek.conf | 7 +++++ start.sh | 22 +++++++++++++ 12 files changed, 183 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 CloudronManifest.json create mode 100644 DESCRIPTION.md create mode 100644 Dockerfile.cloudron create mode 100644 README.md create mode 100644 VERSION create mode 100755 build.sh create mode 100755 dev.sh create mode 100644 docker-compose.yml create mode 100644 soulseek.conf create mode 100755 start.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1269488 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +data diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c6995d9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## [1.0.0] - 2023-XX-XX +- Initial release of Soulseek on Cloudron. + diff --git a/CloudronManifest.json b/CloudronManifest.json new file mode 100644 index 0000000..083d337 --- /dev/null +++ b/CloudronManifest.json @@ -0,0 +1,18 @@ +{ + "id": "org.zoemp.zikkenek", + "title": "Zikkenek Soulseek", + "author": "Morgan Wattiez", + "description": "file://DESCRIPTION.md", + "changelog": "Initial release.", + "tagline": "Soulseek client packaged for Cloudron", + "version": "1.0.0", + "healthCheckPath": "/", + "httpPort": 6080, + "addons": { + "localstorage": {}, + "sendmail": {} + }, + "manifestVersion": 2, + "minBoxVersion": "9.0.0" +} + diff --git a/DESCRIPTION.md b/DESCRIPTION.md new file mode 100644 index 0000000..e2caea9 --- /dev/null +++ b/DESCRIPTION.md @@ -0,0 +1,17 @@ +# Zikkenek Soulseek + +Soulseek client packagé pour Cloudron. + +## Vue d'ensemble + +Cette application permet d'accéder au client Soulseek via une interface web (noVNC). + +## Configuration + +- Le fichier de configuration par défaut se trouve dans `/app/code/soulseek.conf`. +- Pour le surcharger, place ton propre fichier `soulseek.conf` dans `/app/data` (il écrasera le défaut). + +## Accès + +Accède à l'application via l'URL fournie par Cloudron. + diff --git a/Dockerfile.cloudron b/Dockerfile.cloudron new file mode 100644 index 0000000..688e72f --- /dev/null +++ b/Dockerfile.cloudron @@ -0,0 +1,72 @@ +FROM ubuntu:20.04 AS builder +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y curl ca-certificates xz-utils binutils patch && rm -rf /var/lib/apt/lists/* +WORKDIR /tmp +# Récupérer l'AppImage avec l'URL fournie +RUN curl -fL# 'https://drive.usercontent.google.com/download?id=1I7v1fh7jXa_YOh_AJ52XqRB3QJlqc1Hi&export=download&authuser=0' -o SoulseekQt-2024-2-4.AppImage && \ + chmod +x SoulseekQt-2024-2-4.AppImage && \ + ./SoulseekQt-2024-2-4.AppImage --appimage-extract && \ + mv squashfs-root /soulseek + +FROM ubuntu:20.04 +ENV LANG=C.UTF-8 +ENV QT_XCB_NO_ACCESS_CONTROL=1 +ENV QT_X11_NO_MITSHM=1 +ENV DISPLAY=:1 +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y \ + xvfb \ + x11vnc \ + websockify \ + ca-certificates \ + curl \ + libegl1-mesa \ + libfontconfig1 \ + libxcb-cursor0 \ + libx11-xcb1 \ + libxcomposite1 \ + libxcursor1 \ + libxi6 \ + libxinerama1 \ + libxrandr2 \ + libxkbcommon-x11-0 \ + libxrender1 \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-keysyms1 \ + libxcb-render-util0 \ + libxcb-shape0 \ + libxcb-shm0 \ + libxcb-xfixes0 \ + libxcb-xinerama0 \ + libxcb-xkb1 \ + libxshmfence1 \ + libgl1 \ + libdbus-1-3 \ + libxtst6 \ + libxss1 \ + libxv1 \ + libxvmc1 \ + libxxf86dga1 \ + libxxf86vm1 \ + gosu \ + xauth \ + x11-xserver-utils \ + && rm -rf /var/lib/apt/lists/* +# Créer les répertoires nécessaires +RUN mkdir -p /app/code /app/data /usr/share/novnc +# Télécharger noVNC +RUN curl -fL# "https://github.com/novnc/noVNC/archive/master.tar.gz" -o /tmp/novnc.tar.gz && \ + tar -xf /tmp/novnc.tar.gz --strip-components=1 -C /usr/share/novnc && \ + rm /tmp/novnc.tar.gz +# Copier l'app Soulseek depuis le builder +COPY --from=builder /soulseek /app/code +# Copier nos fichiers Cloudron spécifiques +COPY start.sh /app/code/start.sh +COPY soulseek.conf /app/code/soulseek.conf +# Créer l'utilisateur non-root Cloudron et régler les droits sur les dossiers persistants +RUN useradd -u 1000 -m -d /app/data -s /bin/false cloudron && \ + chown -R cloudron:cloudron /app/code /app/data +EXPOSE 6080 +CMD ["/app/code/start.sh"] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b75188 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +1. Construisez l'image Docker en utilisant le script build.sh. +2. Installez l'application sur Cloudron en utilisant la commande suivante : +`cloudron install --image dr.zoemp.be/soulseek:$(command cat VERSION) --location soulseek +` diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..5bc4571 --- /dev/null +++ b/VERSION @@ -0,0 +1,2 @@ +1.0.0 + diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..dd34c1e --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -x +set -eu + +# Construire l'image Docker +docker build --platform linux/amd64 -t dr.zoemp.be/soulseek:$(cat VERSION) -f Dockerfile.cloudron . + +# Pousser l'image vers le registre +docker push dr.zoemp.be/soulseek:$(cat VERSION) + +# Installer l'application sur Cloudron +cloudron update --image dr.zoemp.be/soulseek:$(cat VERSION) --app soulseek + diff --git a/dev.sh b/dev.sh new file mode 100755 index 0000000..244cd06 --- /dev/null +++ b/dev.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -x +set -eu + +# Construire l'image Docker +docker build --platform linux/amd64 -t dr.zoemp.be/soulseek:$(cat VERSION) -f Dockerfile.cloudron . + +# Lancer l'image Docker en mode développement +docker run --platform linux/amd64 --rm -it -v $(pwd)/data:/app/data/ -p 8080:80 dr.zoemp.be/soulseek:$(cat VERSION) +#docker run --rm -it -p 6080:6080 -v /Users/morganwattiez/Code/soulseek/data:/app/data dr.zoemp.be/zikkenek:1.0.0 + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..958a97d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3" +services: + soulseek: + build: + context: . + dockerfile: Dockerfile.cloudron + ports: + - "6080:6080" + volumes: + - ./data:/app/data + diff --git a/soulseek.conf b/soulseek.conf new file mode 100644 index 0000000..48ce1e1 --- /dev/null +++ b/soulseek.conf @@ -0,0 +1,7 @@ +# Configuration Soulseek par défaut (remplace les placeholders) +soulseek: + address: vps.slsknet.org + port: 2271 + username: USERNAME + password: PASSWORD + diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..853937f --- /dev/null +++ b/start.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +# Créer le répertoire de données persistant +mkdir -p /app/data + +# Lancer le framebuffer virtuel sur DISPLAY :1 +Xvfb :1 -screen 0 1280x720x24 & +sleep 2 + +# Lancer x11vnc pour partager le display :1 sur le port 5900 (sans mot de passe) +x11vnc -display :1 -rfbport 5900 -nopw -forever -shared & +sleep 2 + +# Lancer websockify (noVNC) pour exposer x11vnc sur le port 6080 +websockify --web /usr/share/novnc 6080 localhost:5900 & +sleep 2 + +# Exporter le DISPLAY et lancer l'application en tant que user cloudron +export DISPLAY=:1 +exec gosu cloudron /app/code/SoulseekQt +