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 3f7d64e..272d2ac 100644 --- a/.drone.yml +++ b/.drone.yml @@ -71,11 +71,23 @@ 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: - 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 @@ -90,6 +102,142 @@ 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: 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: + repo: nemunaire/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: 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: + repo: nemunaire/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 +261,6 @@ trigger: - tag depends_on: +- build-amd64 +- build-arm64 - build-arm 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 e3ba621..37c31b3 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,47 @@ Hathoris is compatible with any Linux distribution that has PulseAudio. It also ### Quick Installation Guide -TODO: Add a 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` + +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` + +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 :8080` + +6. The interface will be available on the port 8080 from anywhere on your local network. + + 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! ### Build the Project @@ -242,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