Skip to content

Commit

Permalink
Merge pull request #1410 from baldarn/master
Browse files Browse the repository at this point in the history
NAVIDROME | Add navidrome add on
  • Loading branch information
alexbelgium authored May 22, 2024
2 parents 1fcf1c1 + 213f5c0 commit 9b98407
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 0 deletions.
3 changes: 3 additions & 0 deletions navidrome/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.52.5 (22-05-2024)

- Initial release. Welcome Navidrome to home assistant!
115 changes: 115 additions & 0 deletions navidrome/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#============================#
# ALEXBELGIUM'S DOCKERFILE #
#============================#
# _.------.
# _.-` ('>.-`"""-.
# '.--'` _'` _ .--.)
# -' '-.-';` `
# ' - _.' ``'--.
# '---` .-'""`
# /`
#=== Home Assistant Addon ===#

#################
# 1 Build Image #
#################

ARG BUILD_FROM

FROM ${BUILD_FROM}

##################
# 2 Modify Image #
##################

# Set S6 wait time
ENV S6_CMD_WAIT_FOR_SERVICES=1 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
S6_SERVICES_GRACETIME=0

USER root

##################
# 3 Install apps #
##################

# Copy local files
# COPY rootfs/ /

# Uses /bin for compatibility purposes
# hadolint ignore=DL4005
RUN if [ ! -f /bin/sh ] && [ -f /usr/bin/sh ]; then ln -s /usr/bin/sh /bin/sh; fi && \
if [ ! -f /bin/bash ] && [ -f /usr/bin/bash ]; then ln -s /usr/bin/bash /bin/bash; fi

# Modules
ARG MODULES="00-banner.sh 00-global_var.sh 01-custom_script.sh"

# Automatic modules download
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automodules.sh" "/ha_automodules.sh"
RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh

# Manual apps
ENV PACKAGES=""

# Automatic apps & bashio
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_autoapps.sh" "/ha_autoapps.sh"
RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps.sh

EXPOSE 4533

################
# 4 Entrypoint #
################

# Add entrypoint
ENV S6_STAGE2_HOOK=/ha_entrypoint.sh
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint.sh" "/ha_entrypoint.sh"

# Entrypoint modifications
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh"
RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh

ENTRYPOINT [ "/ha_entrypoint.sh" ]

############
# 5 Labels #
############

ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG BUILD_VERSION
LABEL \
io.hass.name="${BUILD_NAME}" \
io.hass.description="${BUILD_DESCRIPTION}" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="alexbelgium (https://github.com/alexbelgium)" \
org.opencontainers.image.title="${BUILD_NAME}" \
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
org.opencontainers.image.vendor="Home Assistant Add-ons" \
org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://github.com/alexbelgium" \
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}

#################
# 6 Healthcheck #
#################

ENV HEALTH_PORT="8080" \
HEALTH_URL=""
HEALTHCHECK \
--interval=5s \
--retries=5 \
--start-period=30s \
--timeout=25s \
CMD curl --fail "http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" &>/dev/null || exit 1
57 changes: 57 additions & 0 deletions navidrome/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Home assistant add-on: Navidrome

[![Donate][paypal-badge]](https://www.paypal.com/donate/?hosted_button_id=DZFULJZTP3UQA)
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)

![Version](https://img.shields.io/badge/dynamic/json?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%navidrome%2Fconfig.json)
![Ingress](https://img.shields.io/badge/dynamic/json?label=Ingress&query=%24.ingress&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%navidrome%2Fconfig.json)
![Arch](https://img.shields.io/badge/dynamic/json?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Falexbelgium%2Fhassio-addons%2Fmaster%navidrome%2Fconfig.json)

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9c6cf10bdbba45ecb202d7f579b5be0e)](https://www.codacy.com/gh/alexbelgium/hassio-addons/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexbelgium/hassio-addons&utm_campaign=Badge_Grade)
[![GitHub Super-Linter](https://img.shields.io/github/actions/workflow/status/alexbelgium/hassio-addons/weekly-supelinter.yaml?label=Lint%20code%20base)](https://github.com/alexbelgium/hassio-addons/actions/workflows/weekly-supelinter.yaml)
[![Builder](https://img.shields.io/github/actions/workflow/status/alexbelgium/hassio-addons/onpush_builder.yaml?label=Builder)](https://github.com/alexbelgium/hassio-addons/actions/workflows/onpush_builder.yaml)

[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white
[paypal-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee%20Paypal-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white

_Thanks to everyone having starred my repo! To star it click on the image below, then it will be on top right. Thanks!_

[![Stargazers repo roster for @alexbelgium/hassio-addons](https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.github/stars2.svg)](https://github.com/alexbelgium/hassio-addons/stargazers)

![downloads evolution](https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/navidrome/stats.png)

## About

Various tweaks and configuration options addition.
This addon is based on the [docker image](https://hub.docker.com/r/deluan/navidrome).

## Configuration

see https://www.navidrome.org/docs/usage/configuration-options/#available-options

```yaml
"base_url": "localhost", # Base URL to configure Navidrome behind a proxy
"music_folder": "/data/music", # Folder where your music library is stored. Can be read-only
"data_folder": "/data/data", # Folder to store application data (DB)
"log_level": "info", # Log level. Useful for troubleshooting. Possible values: error, warn, info, debug, trace
"certfile": "fullchain.pem", # Path for the TLS certificate
"keyfile": "privkey.pem", # Path for the TLS key file
"ssl": false # should the app use https or not
```
Webui can be found at `<your-ip>:port`.

## Installation

The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.

1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
1. Install this add-on.
1. Click the `Save` button to store your configuration.
1. Start the add-on.
1. Check the logs of the add-on to see if everything went well.
1. Go to the webui, where you will initialize the app
1. Restart the addon, to apply any option that should be applied

[repository]: https://github.com/alexbelgium/hassio-addons
66 changes: 66 additions & 0 deletions navidrome/apparmor.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include <tunables/global>

profile navidrome_addon flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>

capability,
file,
signal,
mount,
umount,
remount,
network udp,
network tcp,
network dgram,
network stream,
network inet,
network inet6,
network netlink raw,
network unix dgram,

capability setgid,
capability setuid,
capability sys_admin,
capability dac_read_search,
# capability dac_override,
# capability sys_rawio,

# S6-Overlay
/init ix,
/run/{s6,s6-rc*,service}/** ix,
/package/** ix,
/command/** ix,
/run/{,**} rwk,
/dev/tty rw,
/bin/** ix,
/usr/bin/** ix,
/usr/lib/bashio/** ix,
/etc/s6/** rix,
/run/s6/** rix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/init rix,
/var/run/** mrwkl,
/var/run/ mrwkl,
/dev/i2c-1 mrwkl,
# Files required
/dev/fuse mrwkl,
/dev/sda1 mrwkl,
/dev/sdb1 mrwkl,
/dev/nvme0 mrwkl,
/dev/nvme1 mrwkl,
/dev/mmcblk0p1 mrwkl,
/dev/* mrwkl,
/tmp/** mrkwl,

# Data access
/data/** rw,

# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
ptrace (trace,read) peer=docker-default,

# docker daemon confinement requires explict allow rule for signal
signal (receive) set=(kill,term) peer=/usr/bin/docker,

}
9 changes: 9 additions & 0 deletions navidrome/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"build_from": {
"aarch64": "deluan/navidrome:0.52.5",
"amd64": "deluan/navidrome:0.52.5"
},
"codenotary": {
"signer": "[email protected]"
}
}
36 changes: 36 additions & 0 deletions navidrome/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"arch": [
"amd64",
"aarch64"
],
"codenotary": "[email protected]",
"description": "Navidrome for Home Assistant",
"image": "ghcr.io/alexbelgium/navidrome-{arch}",
"init": false,
"map": [
"addon_config:rw",
"share:rw",
"ssl:rw"
],
"name": "Navidrome",
"options": {
"base_url": "localhost",
"music_folder": "/data/music",
"data_folder": "/data/data",
"log_level": "info",
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"ssl": false
},
"ports": {
"4533/tcp": 4533
},
"ports_description": {
"4533/tcp": "Web interface"
},
"slug": "navidrome",
"udev": true,
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/navidrome",
"version": "0.52.5",
"webui": "[PROTO:ssl]://[HOST]:[PORT:8080]"
}
Binary file added navidrome/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added navidrome/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions navidrome/rootfs/etc/cont-init.d/99-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bashio
# shellcheck shell=bash
set -e

# Please see available options to customize Navidrome for your needs at
# https://www.navidrome.org/docs/usage/configuration-options/#available-options

ND_MUSICFOLDER=$(bashio::config 'music_folder')
ND_DATAFOLDER=$(bashio::config 'data_folder')
ND_LOGLEVEL=$(bashio::config 'log_level')
ND_BASEURL=$(bashio::config 'base_url')
if bashio::config.true 'ssl'; then
bashio::log.info "ssl is enabled"
ND_TLSCERT=$(bashio::config 'certfile')
ND_TLSKEY=$(bashio::config 'keyfile')
end


##############
# LAUNCH APP #
##############

bashio::log.info "Please wait while the app is loading!"

/app/navidrome
8 changes: 8 additions & 0 deletions navidrome/updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"last_update": "22-05-2024",
"repository": "alexbelgium/hassio-addons",
"slug": "openproject",
"source": "github",
"upstream_repo": "openproject/openproject",
"upstream_version": "14.1.0"
}

0 comments on commit 9b98407

Please sign in to comment.