From a592b310b15a74cec9dd08314391bb590b662f51 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 26 Apr 2025 10:56:02 +0200 Subject: [PATCH 1/6] Also build tag for amd64 and arm64 --- .drone.yml | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/.drone.yml b/.drone.yml index 3f7d64e..a4d1cec 100644 --- a/.drone.yml +++ b/.drone.yml @@ -90,6 +90,120 @@ trigger: - push - tag +--- +kind: pipeline +type: docker +name: build-amd64 + +platform: + os: linux + arch: amd64 + +workspace: + base: /go + path: src/git.nemunai.re/nemunaire/hathoris + +steps: +- name: build front + image: node:21 + commands: + - mkdir deploy + - cd ui + - npm install --network-timeout=100000 + - npm run build + +- name: build + image: golang:1-alpine + commands: + - apk --no-cache add alsa-lib-dev build-base git pkgconf + - go get -v -d + - go vet -v + - go build -v -ldflags '-w -X main.Version=${DRONE_BRANCH}-${DRONE_COMMIT} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + - ln deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} hathoris + +- name: gitea release + image: plugins/gitea-release + settings: + api_key: + from_secret: gitea_api_key + base_url: https://git.nemunai.re/ + files: + - deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + +- name: docker + image: plugins/docker + settings: + registry: registry.nemunai.re + repo: registry.nemunai.re/hathoris + auto_tag: true + auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + dockerfile: Dockerfile-norebuild + username: + from_secret: docker_username + password: + from_secret: docker_password + +trigger: + event: + - tag + +--- +kind: pipeline +type: docker +name: build-arm64 + +platform: + os: linux + arch: arm64 + +workspace: + base: /go + path: src/git.nemunai.re/nemunaire/hathoris + +steps: +- name: build front + image: node:21 + commands: + - mkdir deploy + - cd ui + - npm install --network-timeout=100000 + - npm run build + +- name: build + image: golang:1-alpine + commands: + - apk --no-cache add alsa-lib-dev build-base git pkgconf + - go get -v -d + - go vet -v + - go build -v -ldflags '-w -X main.Version=${DRONE_BRANCH}-${DRONE_COMMIT} -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + - ln deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} hathoris + +- name: gitea release + image: plugins/gitea-release + settings: + api_key: + from_secret: gitea_api_key + base_url: https://git.nemunai.re/ + files: + - deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + +- name: docker + image: plugins/docker + settings: + registry: registry.nemunai.re + repo: registry.nemunai.re/hathoris + auto_tag: true + auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + dockerfile: Dockerfile-norebuild + username: + from_secret: docker_username + password: + from_secret: docker_password + +trigger: + event: + - tag + --- kind: pipeline name: docker-manifest @@ -113,4 +227,6 @@ trigger: - tag depends_on: +- build-amd64 +- build-arm64 - build-arm From b82316752d17ee2dc892dc1fa60e5556b24148ce Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 26 Apr 2025 12:24:59 +0200 Subject: [PATCH 2/6] Deploy containers to Docker Hub --- .drone-manifest.yml | 8 ++++---- .drone.yml | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.drone-manifest.yml b/.drone-manifest.yml index 70818c7..c87ef06 100644 --- a/.drone-manifest.yml +++ b/.drone-manifest.yml @@ -1,4 +1,4 @@ -image: registry.nemunai.re/hathoris:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +image: nemunaire/hathoris:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} {{#if build.tags}} tags: {{#each build.tags}} @@ -6,16 +6,16 @@ tags: {{/each}} {{/if}} manifests: - - image: registry.nemunai.re/hathoris:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 + - image: nemunaire/hathoris:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 platform: architecture: amd64 os: linux - - image: registry.nemunai.re/hathoris:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64 + - image: nemunaire/hathoris:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64 platform: architecture: arm64 os: linux variant: v8 - - image: registry.nemunai.re/hathoris:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm + - image: nemunaire/hathoris:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm platform: architecture: arm os: linux diff --git a/.drone.yml b/.drone.yml index a4d1cec..19abf21 100644 --- a/.drone.yml +++ b/.drone.yml @@ -74,8 +74,7 @@ steps: - name: docker image: plugins/docker:linux-arm settings: - registry: registry.nemunai.re - repo: registry.nemunai.re/hathoris + repo: nemunaire/hathoris auto_tag: true auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} dockerfile: Dockerfile-norebuild @@ -133,8 +132,7 @@ steps: - name: docker image: plugins/docker settings: - registry: registry.nemunai.re - repo: registry.nemunai.re/hathoris + repo: nemunaire/hathoris auto_tag: true auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} dockerfile: Dockerfile-norebuild @@ -190,8 +188,7 @@ steps: - name: docker image: plugins/docker settings: - registry: registry.nemunai.re - repo: registry.nemunai.re/hathoris + repo: nemunaire/hathoris auto_tag: true auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} dockerfile: Dockerfile-norebuild From 2b38d0d4b20e89104e66a07b5ffb2d584ac4b928 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 26 Apr 2025 12:33:32 +0200 Subject: [PATCH 3/6] Deploy binaries on Github --- .drone.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.drone.yml b/.drone.yml index 19abf21..272d2ac 100644 --- a/.drone.yml +++ b/.drone.yml @@ -71,6 +71,19 @@ steps: event: - tag +- name: github release + image: plugins/github-release:linux-arm + settings: + api_key: + from_secret: github_api_token + github_url: https://github.com + files: + - deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}hf + - deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}v7 + when: + event: + - tag + - name: docker image: plugins/docker:linux-arm settings: @@ -129,6 +142,18 @@ steps: files: - deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} +- name: github release + image: plugins/github-release + settings: + api_key: + from_secret: github_api_token + github_url: https://github.com + files: + - deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + when: + event: + - tag + - name: docker image: plugins/docker settings: @@ -185,6 +210,18 @@ steps: files: - deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} +- name: github release + image: plugins/github-release + settings: + api_key: + from_secret: github_api_token + github_url: https://github.com + files: + - deploy/hathoris-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + when: + event: + - tag + - name: docker image: plugins/docker settings: From 42b795ae352ba16f43aa6db8db23181c45ddbedd Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 26 Apr 2025 11:19:36 +0200 Subject: [PATCH 4/6] Add a quick start guide --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e3ba621..f5387fc 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,27 @@ Hathoris is compatible with any Linux distribution that has PulseAudio. It also ### Quick Installation Guide -TODO: Add a quick installation guide. +1. Install dependancies. + On Debian/Ubuntu/Raspbian/armbian/...: `sudo apt install alsa-utils pulseaudio-utils mpv yt-dlp` + On Alpine: `sudo apk add alsa-utils pulseaudio-utils mpv yt-dlp` + On ArchLinux/Manjaro: `sudo pacman -S alsa-utils pulseaudio mpv yt-dlp` + +2. Download the latest release binary for your architecture; choose between ARMv6 (Raspberry Pi Zero), ARMv7 (Voltastreams, Raspberry Pi 2+), ARM64 (Raspberry Pi Zero 2 and 3+ **with 64 bits OS**): https://git.nemunai.re/nemunaire/hathoris/releases/latest + +3. Give execution permissions: `chmod +x hathoris-linux-armv7` + +4. (optional) [Prepare a configuration for optional virtual inputs](#audio-sources) (like radios, streaming sources) + + The file is called `settings.json`, it is expected to be in the directory where you execute `hathoris`. It can be overwrited by adding a command line argument like `-settings-file /etc/hathoris/settings.json`. + +5. Launch the binary: `./hathoris -bind :8081` + +6. The interface will be available on the port 8081 from anywhere on your local network. + + From your local machine, it'll be on + +Enjoy! ### Build the Project From d47393fa486c7e9b74c89f35e4cc9ea27672cb73 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 26 Apr 2025 18:24:56 +0200 Subject: [PATCH 5/6] Docker image ready --- Dockerfile | 6 +++++- Dockerfile-norebuild | 6 +++++- README.md | 34 +++++++++++++++++++++++++++------- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2456062..3d32176 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,11 @@ RUN go get && go generate && go build -ldflags="-s -w" FROM alpine:3.18 +ENV HATHORIS_BIND=:8080 EXPOSE 8080 -CMD ["/srv/hathoris"] +ENTRYPOINT ["/srv/hathoris"] +WORKDIR /var/lib/hathoris + +RUN mkdir /var/lib/hathoris; apk --no-cache add alsa-utils pulseaudio-utils mpv yt-dlp COPY --from=build /go/src/git.nemunai.re/nemunaire/hathoris/hathoris /srv/hathoris diff --git a/Dockerfile-norebuild b/Dockerfile-norebuild index e083f4f..34d05fa 100644 --- a/Dockerfile-norebuild +++ b/Dockerfile-norebuild @@ -1,6 +1,10 @@ FROM alpine:3.18 +ENV HATHORIS_BIND=:8080 EXPOSE 8080 -CMD ["/srv/hathoris"] +ENTRYPOINT ["/srv/hathoris"] +WORKDIR /var/lib/hathoris + +RUN mkdir /var/lib/hathoris; apk --no-cache add alsa-utils pulseaudio-utils mpv yt-dlp COPY hathoris /srv/hathoris diff --git a/README.md b/README.md index f5387fc..bd8680b 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,31 @@ Hathoris is compatible with any Linux distribution that has PulseAudio. It also ### Quick Installation Guide +#### With Docker + +[Prepare a configuration for optional virtual inputs](#audio-sources) (like radios, streaming sources), create the file at `~/.config/hathoris/settings.json`. + +``` +docker run -p 8080:8080 \ + --device /dev/snd \ + -e PULSE_SERVER=unix:/run/pulse/native \ + -v ${XDG_RUNTIME_DIR}/pulse/native:/run/pulse/native \ + -v ~/.config/pulse/cookie:/root/.config/pulse/cookie \ + -v ~/.config/hathoris:/var/lib/hathoris \ + nemunaire/hathoris:1 +``` + +⚠️ Please note that if your host is directly reachable on the Internet, it will be accessible to anyone who can reach this port. It is recommended to use a reverse proxy and/or configure proper firewall rules to secure your setup. + +#### Without Docker + 1. Install dependancies. - On Debian/Ubuntu/Raspbian/armbian/...: `sudo apt install alsa-utils pulseaudio-utils mpv yt-dlp` - On Alpine: `sudo apk add alsa-utils pulseaudio-utils mpv yt-dlp` - On ArchLinux/Manjaro: `sudo pacman -S alsa-utils pulseaudio mpv yt-dlp` + - On Debian/Ubuntu/Raspbian/armbian/...: `sudo apt install alsa-utils pulseaudio-utils mpv yt-dlp` + - On Alpine: `sudo apk add alsa-utils pulseaudio-utils mpv yt-dlp` + - On ArchLinux/Manjaro: `sudo pacman -S alsa-utils pulseaudio mpv yt-dlp` -2. Download the latest release binary for your architecture; choose between ARMv6 (Raspberry Pi Zero), ARMv7 (Voltastreams, Raspberry Pi 2+), ARM64 (Raspberry Pi Zero 2 and 3+ **with 64 bits OS**): https://git.nemunai.re/nemunaire/hathoris/releases/latest +2. Download the [latest release binary for your architecture](https://github.com/nemunaire/hathoris/releases/latest); choose between ARMv6 (Raspberry Pi Zero), ARMv7 (Voltastreams, Raspberry Pi 2+), ARM64 (Raspberry Pi Zero 2 and 3+ **with 64 bits OS**). 3. Give execution permissions: `chmod +x hathoris-linux-armv7` @@ -61,11 +79,13 @@ Hathoris is compatible with any Linux distribution that has PulseAudio. It also The file is called `settings.json`, it is expected to be in the directory where you execute `hathoris`. It can be overwrited by adding a command line argument like `-settings-file /etc/hathoris/settings.json`. -5. Launch the binary: `./hathoris -bind :8081` +5. Launch the binary: `./hathoris -bind :8080` -6. The interface will be available on the port 8081 from anywhere on your local network. +6. The interface will be available on the port 8080 from anywhere on your local network. - From your local machine, it'll be on + From your local machine, it'll be on + +⚠️ Please note that if your host is directly reachable on the Internet, it will be accessible to anyone who can reach this port. It is recommended to use a reverse proxy and/or configure proper firewall rules to secure your setup. Enjoy! From 02fdc0ed79dd39536e41679e813c92e6b86d84cc Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 26 Apr 2025 22:40:39 +0200 Subject: [PATCH 6/6] Speak about kodi.script.hathoris and LibreELEC autostart --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index bd8680b..37c31b3 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,17 @@ curl http://127.0.0.1:8080/api/mixer' ] ``` +#### With Kodi + +An companion script is available to control hathoris directly from Kodi: + + +You can also create a script to automaticaly enable your Kodi input when it lauches. +Eg. for LibreELEC, append in `~/.config/autostart.sh`: + +``` +curl 'http://192.168.0.42:8080/api/sources/spdif/enable' -X POST +``` ## Compatible Hardware