diff --git a/CHANGELOG.md b/CHANGELOG.md index aac2856..bb37473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.8.1 +- Dockerfile auf HAOS-kompatible Build-Basis umgestellt (`ARG BUILD_FROM`) +- FAH-Download-Logik korrigiert (arch-spezifisch, kein fehlerhafter "debian"-Filter) +- s6-overlay: LinuxServer-spezifische Abhängigkeiten entfernt (`init-config-end`, `init-config`, `init-services`) +- s6-overlay: Abhängigkeitskette korrigiert (`base → config → video → service`) +- Service-Skript: Syntax-Fehler behoben, alle CLI-Argumente (user, team, passkey, power) ergänzt +- Env-Variable `USER` → `FAH_USER` (Konflikt mit Shell-Variable vermieden) +- Architektur-Support auf `amd64` und `aarch64` beschränkt (FAH 8 unterstützt kein armhf/armv7) +- Dokumentation vollständig überarbeitet + ## 0.8.0 -- Aktualisiert auf Folding@home 8.4. -- Initiale Version des Forks. \ No newline at end of file +- Aktualisiert auf Folding@home 8.4 +- Initiale Version des Forks diff --git a/DOCS.md b/DOCS.md index 71b1dd3..d336fe9 100644 --- a/DOCS.md +++ b/DOCS.md @@ -1,10 +1,144 @@ # Folding@home Add-on Dokumentation -## Konfiguration -- **user**: Dein Folding@home-Benutzername (optional). -- **team**: Team-ID, z. B. 247478 für Home Assistant. -- **passkey**: Dein Folding@home-Passkey (optional). -- **power**: Leistungsstufe (light, medium, full). +## Über dieses Add-on -## Zugriff -- Webinterface: `http://localhost:7396` \ No newline at end of file +Dieses Add-on führt den [Folding@home](https://foldingathome.org/) Client (Version 8.x) als +Home Assistant Add-on aus. Folding@home ist ein verteiltes Rechenprojekt, das die Rechenleistung +deines Computers nutzt, um Proteinfaltungssimulationen für medizinische Forschung durchzuführen +(z. B. Alzheimer, Krebs, COVID-19). + +--- + +## Installation + +1. Öffne Home Assistant und gehe zu: + **Einstellungen → Add-ons → Add-on Store** +2. Klicke oben rechts auf **⋮ → Repositories** +3. Füge folgende URL hinzu: + ``` + https://gitea.bitfire.work/retr0/dont-stop-folding + ``` +4. Schließe den Dialog – das Add-on „Folding@home" erscheint nun im Store +5. Klicke auf das Add-on und dann auf **Installieren** +6. Konfiguriere die gewünschten Optionen (siehe unten) +7. Klicke auf **Starten** + +--- + +## Konfiguration + +### Optionen + +| Option | Typ | Standard | Beschreibung | +|-----------------|---------|------------|--------------| +| `user` | string | _(leer)_ | Dein Folding@home-Benutzername. Wird für die Statistikseite verwendet. | +| `team` | string | `247478` | Team-ID. `247478` ist das offizielle Home Assistant Team. | +| `passkey` | string | _(leer)_ | Dein persönlicher Passkey von foldingathome.org. Aktiviert Bonus-Punkte. | +| `power` | Auswahl | `medium` | Leistungsstufe: `light`, `medium` oder `full`. | +| `account_token` | string | _(leer)_ | Token für das neue FAH 8 Online-Konto (von foldingathome.org). | +| `machine_name` | string | _(leer)_ | Anzeigename dieser Maschine im FAH-Online-Konto. | + +### Beispielkonfiguration + +```yaml +user: "mein_benutzername" +team: "247478" +passkey: "abc123..." +power: "medium" +``` + +Mit FAH 8 Online-Konto: +```yaml +account_token: "eyJ..." +machine_name: "homeassistant" +power: "full" +``` + +### Leistungsstufen + +| Stufe | Beschreibung | +|----------|--------------| +| `light` | Niedrige CPU-Last, läuft im Hintergrund ohne spürbaren Einfluss | +| `medium` | Moderate Last (Standardwert) | +| `full` | Maximale Rechenleistung, kann das System spürbar belasten | + +--- + +## Web-Interface + +Nach dem Start ist die Folding@home Web-UI erreichbar unter: + +``` +http://:7396 +``` + +Dort kannst du: +- Aktuelle Work Units und Fortschritt einsehen +- Die Leistungsstufe manuell anpassen +- Folding pausieren oder fortsetzen +- Statistiken abrufen + +--- + +## Zwei Kontosysteme + +Folding@home bietet zwei Möglichkeiten, Punkte zu sammeln: + +### Klassisch (user + passkey) +Das bewährte System – erstelle einen Account auf [foldingathome.org](https://foldingathome.org/), +trage Benutzernamen und optional einen Passkey ein. + +### FAH 8 Online-Konto (account_token) +Das neue System seit Version 8. Erstelle ein Konto auf +[foldingathome.org](https://foldingathome.org/), generiere einen Token und trage +ihn unter `account_token` ein. `machine_name` gibt der Maschine einen erkennbaren Namen +in deinem Konto-Dashboard. + +> Hinweis: Beide Systeme können nicht gleichzeitig aktiv sein. Wenn `account_token` +> gesetzt ist, wird er bevorzugt. Ohne beides wird anonym gefaltet. + +--- + +## Datenspeicherung + +Der FAH Client speichert seine Konfiguration und Work-Unit-Daten im +Home Assistant Konfigurationsverzeichnis unter: + +``` +/config/ (innerhalb des Containers) +``` + +Die Daten bleiben bei Neustarts und Updates des Add-ons erhalten. + +--- + +## Unterstützte Architekturen + +| Architektur | Unterstützt | +|-------------|-------------| +| `amd64` | ✓ | +| `aarch64` | ✓ | +| `armhf` | ✗ (vom FAH 8 Client nicht unterstützt) | +| `armv7` | ✗ (vom FAH 8 Client nicht unterstützt) | + +--- + +## Problembehandlung + +### Add-on startet nicht +- Prüfe im Log-Tab des Add-ons auf Fehlermeldungen +- Stelle sicher, dass Port `7396` nicht von einem anderen Dienst belegt ist + +### Web-Interface nicht erreichbar +- Warte 30–60 Sekunden nach dem Start – der FAH Client benötigt etwas Zeit zum Initialisieren +- Prüfe, ob das Add-on im Status „Läuft" angezeigt wird + +### Keine Punkte / kein Fortschritt +- Der FAH Server weist Work Units zu – bei geringer Auslastung der Server kann es zu Wartezeiten kommen +- Prüfe im Web-Interface unter `http://:7396`, ob aktiv gefaltet wird +- Stelle sicher, dass `user` und `team` korrekt eingetragen sind + +### Anonym falten +Wenn weder `user` noch `account_token` gesetzt sind, werden Beiträge unter dem +anonymen Benutzer gesammelt. Die Leistung ist identisch, nur die Statistiken werden +keinem Konto zugeordnet. diff --git a/Dockerfile b/Dockerfile index 8f1918e..97d1d46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,48 +1,60 @@ -# syntax=docker/dockerfile:1 - -FROM ghcr.io/linuxserver/baseimage-ubuntu:noble - -# set version label -ARG BUILD_DATE -ARG VERSION -ARG FOLDINGATHOME_RELEASE -LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="aptalca" - -#Add needed nvidia environment variables for container toolkit -ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" - -# global environment settings -ENV DEBIAN_FRONTEND="noninteractive" - -RUN \ - echo "**** install runtime packages ****" && \ - apt-get update && \ - apt-get install -y \ - bzip2 \ - intel-opencl-icd \ - libexpat1 && \ - ln -s libOpenCL.so.1 /usr/lib/x86_64-linux-gnu/libOpenCL.so && \ - echo "**** install foldingathome ****" && \ - download_url="https://download.foldingathome.org/releases/public/fah-client/"$(curl -s https://download.foldingathome.org/releases/public/fah-client/meta.json | jq -r '.[] | select((.package | contains("debian")) and (.package | contains("release"))) | .package' | grep -v "arm64" | grep "tar.bz2") && \ - curl -o \ - /tmp/fah.tar.bz2 -L \ - ${download_url} && \ - tar xf /tmp/fah.tar.bz2 -C /app --strip-components=1 && \ - printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \ - echo "**** cleanup ****" && \ - apt-get clean && \ - rm -rf \ - /tmp/* \ - /var/lib/apt/lists/* \ - /var/tmp/* \ - /var/log/* - -# add local files -COPY root/ / - -# ports and volumes -EXPOSE 7396 - -VOLUME /config -CMD ["/usr/bin/fahclient", "--config", "/config/config.xml", "${CLI_ARGS}"] \ No newline at end of file +# syntax=docker/dockerfile:1 + +ARG BUILD_FROM +FROM $BUILD_FROM + +ARG BUILD_DATE +ARG BUILD_REF +ARG BUILD_VERSION +ARG BUILD_ARCH + +LABEL \ + io.hass.name="Folding@home" \ + io.hass.description="Run Folding@home to contribute to scientific research" \ + io.hass.arch="${BUILD_ARCH}" \ + io.hass.type="addon" \ + io.hass.version=${BUILD_VERSION} \ + maintainer="retr0" + +# Add needed NVIDIA environment variables for container toolkit +ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" + +# Prevent interactive prompts during package installation +ENV DEBIAN_FRONTEND="noninteractive" + +RUN \ + echo "**** install runtime packages ****" && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + bzip2 \ + curl \ + jq \ + libexpat1 \ + netcat-openbsd && \ + echo "**** install foldingathome ****" && \ + if [ "${BUILD_ARCH}" = "aarch64" ]; then \ + ARCH_PATTERN="arm64"; \ + else \ + ARCH_PATTERN="x86_64"; \ + fi && \ + DOWNLOAD_PATH=$(curl -fsSL "https://download.foldingathome.org/releases/public/fah-client/meta.json" | \ + jq -r --arg arch "${ARCH_PATTERN}" \ + '.[] | select((.package | contains("linux")) and (.package | contains("release")) and (.package | contains($arch)) and (.package | endswith(".tar.bz2"))) | .package' \ + | head -1) && \ + echo "Downloading FAH client: ${DOWNLOAD_PATH}" && \ + curl -fsSL "https://download.foldingathome.org/releases/public/fah-client/${DOWNLOAD_PATH}" \ + -o /tmp/fah.tar.bz2 && \ + mkdir -p /app && \ + tar xf /tmp/fah.tar.bz2 -C /app --strip-components=1 && \ + echo "**** cleanup ****" && \ + apt-get clean && \ + rm -rf \ + /tmp/* \ + /var/lib/apt/lists/* \ + /var/tmp/* \ + /var/log/* + +# Add local files +COPY root/ / + +EXPOSE 7396 diff --git a/build.yaml b/build.yaml index 1e91747..030fdcb 100644 --- a/build.yaml +++ b/build.yaml @@ -1,6 +1,4 @@ build_from: - amd64: ghcr.io/hassio-addons/debian-base:7.3.1 - armhf: ghcr.io/hassio-addons/debian-base:7.3.1 - armv7: ghcr.io/hassio-addons/debian-base:7.3.1 - aarch64: ghcr.io/hassio-addons/debian-base:7.3.1 -squash: false \ No newline at end of file + amd64: ghcr.io/hassio-addons/debian-base/amd64:7.3.1 + aarch64: ghcr.io/hassio-addons/debian-base/aarch64:7.3.1 +squash: false diff --git a/config.yaml b/config.yaml index e69ac21..f746b32 100644 --- a/config.yaml +++ b/config.yaml @@ -1,12 +1,10 @@ name: Folding@home -version: 0.8.0 +version: 0.8.1 slug: foldingathome description: Run Folding@home to contribute to scientific research url: https://gitea.bitfire.work/retr0/dont-stop-folding arch: - amd64 - - armhf - - armv7 - aarch64 init: false ports: @@ -23,7 +21,7 @@ options: account_token: "" machine_name: "" environment: - USER: "{user}" + FAH_USER: "{user}" TEAM: "{team}" PASSKEY: "{passkey}" POWER: "{power}" @@ -35,4 +33,4 @@ schema: passkey: str? power: list(light|medium|full) account_token: str? - machine_name: str? \ No newline at end of file + machine_name: str? diff --git a/readme.md b/readme.md index 51956c0..1c64c3e 100644 --- a/readme.md +++ b/readme.md @@ -1,14 +1,36 @@ -# Folding@home Home Assistant Add-on +# dont-stop-folding -Ein Community-gepflegtes Add-on für Home Assistant, um Folding@home (Version 8.4) auszuführen und zur wissenschaftlichen Forschung beizutragen. +Home Assistant Add-on für [Folding@home](https://foldingathome.org/) – nutze die Rechenleistung +deines Home Assistant Servers, um zur wissenschaftlichen Forschung beizutragen. + +## Was ist Folding@home? + +Folding@home ist ein verteiltes Rechenprojekt der Washington University. Es simuliert +Proteinfaltungen, um Krankheiten wie Alzheimer, Krebs und Virusinfektionen besser zu verstehen. +Jeder Haushalt mit einem laufenden Server kann einen Beitrag leisten. ## Installation -1. Füge dieses Repository in Home Assistant hinzu: `https://gitea.bitfire.work/retr0/dont-stop-folding` -2. Installiere das Add-on über den Add-on-Store. -3. Konfiguriere Benutzername, Team-ID (z. B. 247478 für Home Assistant) und andere Einstellungen. -## Dokumentation -Siehe [DOCS.md](DOCS.md) für Details. +1. **Repository hinzufügen** in Home Assistant: + **Einstellungen → Add-ons → Add-on Store → ⋮ → Repositories** + ``` + https://gitea.bitfire.work/retr0/dont-stop-folding + ``` +2. **Add-on installieren** – suche nach „Folding@home" im Store +3. **Konfigurieren und starten** + +Eine vollständige Anleitung inkl. aller Konfigurationsoptionen findest du in der +[Dokumentation](DOCS.md). + +## Features + +- Folding@home Client 8.x +- Web-Interface auf Port 7396 +- Unterstützung für klassische Konten (user + passkey) und FAH 8 Online-Konten (account_token) +- Leistungsstufen: light, medium, full +- Unterstützte Architekturen: `amd64`, `aarch64` +- Konfigurationsdaten bleiben bei Updates erhalten ## Lizenz -MIT License, siehe [LICENSE](LICENSE). \ No newline at end of file + +MIT License – siehe [LICENSE.txt](LICENSE.txt) diff --git a/repository.json b/repository.json index 4502a36..ba4744a 100644 --- a/repository.json +++ b/repository.json @@ -1,16 +1,5 @@ { - "name": "dont-stop-folding Add-on Repository", + "name": "dont-stop-folding", "url": "https://gitea.bitfire.work/retr0/dont-stop-folding", - "maintainer": "retr0", - "addons": { - "foldingathome": { - "name": "Folding@home", - "version": "0.8.0", - "slug": "foldingathome", - "description": "Run Folding@home to contribute to scientific research", - "url": "https://gitea.bitfire.work/retr0/dont-stop-folding", - "arch": ["amd64", "armhf", "armv7", "aarch64"], - "image": "local/addon-foldingathome:{version}" - } - } -} \ No newline at end of file + "maintainer": "retr0" +} diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-foldingathome-video b/root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/dependencies.d/base similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-foldingathome-video rename to root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/dependencies.d/base diff --git a/root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/run b/root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/run index ca1fb3c..fd6d050 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/run @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -# permissions on config root and folders -lsiown -R abc:abc \ - /config +echo "**** setting up config directory ****" +mkdir -p /config +chmod 755 /config diff --git a/root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/dependencies.d/init-config b/root/etc/s6-overlay/s6-rc.d/svc-foldingathome/dependencies.d/init-foldingathome-video similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-foldingathome-config/dependencies.d/init-config rename to root/etc/s6-overlay/s6-rc.d/svc-foldingathome/dependencies.d/init-foldingathome-video diff --git a/root/etc/s6-overlay/s6-rc.d/svc-foldingathome/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-foldingathome/dependencies.d/init-services deleted file mode 100644 index e69de29..0000000 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-foldingathome/run b/root/etc/s6-overlay/s6-rc.d/svc-foldingathome/run index 5fa5280..4919eec 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-foldingathome/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-foldingathome/run @@ -1,27 +1,46 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -if [[ -n "${ACCOUNT_TOKEN}" ]] && [[ -n "${MACHINE_NAME}" ]]; then - TOKEN_AND_NAME="--account-token ${ACCOUNT_TOKEN} --machine-name ${MACHINE_NAME}" -else - echo ' -*************************************************************************** -*************************************************************************** -**** **** -**** **** -**** On first run, both the ACCOUNT_TOKEN and the MACHINE_NAME **** -**** env vars are required. Please set them and recreate the container **** -**** unless the instance was previously added to online account. **** -**** **** -**** **** -*************************************************************************** -*************************************************************************** -' +declare -a args + +# Network: bind to all interfaces, allow all connections +args+=(--http-addresses "0.0.0.0:7396") +args+=(--allow "0/0") + +# FAH account credentials +if [[ -n "${FAH_USER}" ]]; then + args+=(--user "${FAH_USER}") fi +if [[ -n "${TEAM}" ]]; then + args+=(--team "${TEAM}") +fi + +if [[ -n "${PASSKEY}" ]]; then + args+=(--passkey "${PASSKEY}") +fi + +# Power level (light, medium, full) +if [[ -n "${POWER}" ]]; then + args+=(--power "${POWER}") +fi + +# Online account token (new FAH 8 account system) +if [[ -n "${ACCOUNT_TOKEN}" ]]; then + args+=(--account-token "${ACCOUNT_TOKEN}") + if [[ -n "${MACHINE_NAME}" ]]; then + args+=(--machine-name "${MACHINE_NAME}") + fi +fi + +if [[ -z "${FAH_USER}" ]] && [[ -z "${ACCOUNT_TOKEN}" ]]; then + echo "INFO: No FAH_USER or ACCOUNT_TOKEN set — folding anonymously." +fi + +# Run from /config so fah-client stores its data there +mkdir -p /config +cd /config || exit 1 exec \ s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 7396" \ - cd /config s6-setuidgid abc /app/fah-client \ - --http-addresses 0.0.0.0:7396 --allow 0/0 ${TOKEN_AND_NAME} \ - ${CLI_ARGS} + /app/fah-client "${args[@]}" ${CLI_ARGS}