From 61ed1617d816f4303c39376eabf64528dfbb223d Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Sun, 5 Mar 2023 11:55:41 +0100 Subject: [PATCH] use postgres as backend --- Dockerfile | 18 +++++++++--------- README.md | 14 ++++++++++++++ .../etc/confd/conf.d/airsonic.properties.toml | 6 ++++++ .../confd/templates/airsonic.properties.tmpl | 6 ++++++ .../s6-overlay/s6-rc.d/airsonic/dependencies | 1 + 5 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 rootfs/etc/confd/conf.d/airsonic.properties.toml create mode 100644 rootfs/etc/confd/templates/airsonic.properties.tmpl create mode 100644 rootfs/etc/s6-overlay/s6-rc.d/airsonic/dependencies diff --git a/Dockerfile b/Dockerfile index 35b971b..676b83d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM docker.io/alpine:3.16 AS builder +FROM docker.io/alpine:3.17 AS builder -ENV VERSION=11.0.0-SNAPSHOT.20220625052932 +ENV VERSION=11.0.0-SNAPSHOT.20230217142243 RUN apk add --no-cache \ openjdk17-jdk \ maven \ @@ -13,18 +13,18 @@ RUN git checkout "$VERSION" RUN mvn package -DskipTests -FROM docker.io/thallian/alpine-s6:3.16 +FROM docker.io/thallian/confd-env:3.17-3.1.3.0 ENV JAVA_OPTIONS=-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ENV AIRSONIC_DIR=/home/airsonic RUN apk add --no-cache \ - ca-certificates \ - openssl \ - ffmpeg \ - flac \ - opus \ - lame \ + ca-certificates \ + openssl \ + ffmpeg \ + flac \ + opus \ + lame \ openjdk17-jre-headless RUN addgroup -g 2222 airsonic diff --git a/README.md b/README.md index 0d77f86..6e3e76b 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,19 @@ - `/home/airsonic/playlists` - `/home/airsonic/podcasts` +# Environment Variables +## DB_URL + +JDBC url for the postgres conection. + +## DB_USER +- default: airsonic + +Username with which to connect to the database. + +## DB_PASSWORD + +Password for the databse connection. + # Ports - 8080 diff --git a/rootfs/etc/confd/conf.d/airsonic.properties.toml b/rootfs/etc/confd/conf.d/airsonic.properties.toml new file mode 100644 index 0000000..6f6084a --- /dev/null +++ b/rootfs/etc/confd/conf.d/airsonic.properties.toml @@ -0,0 +1,6 @@ +[template] +src = "airsonic.properties.tmpl" +dest = "/home/airsonic/data/airsonic.properties" +gid = 2222 +uid = 2222 +mode = "0660" diff --git a/rootfs/etc/confd/templates/airsonic.properties.tmpl b/rootfs/etc/confd/templates/airsonic.properties.tmpl new file mode 100644 index 0000000..1b785c5 --- /dev/null +++ b/rootfs/etc/confd/templates/airsonic.properties.tmpl @@ -0,0 +1,6 @@ +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url={{ getenv "DB_URL" }} +spring.datasource.username={{ getenv "DB_USER" "airsonic" }} +spring.datasource.password={{ getenv "DB_PASSWORD" }} +spring.liquibase.parameters.userTableQuote=" +server.forward-headers-strategy=native diff --git a/rootfs/etc/s6-overlay/s6-rc.d/airsonic/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/airsonic/dependencies new file mode 100644 index 0000000..7ba7514 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/airsonic/dependencies @@ -0,0 +1 @@ +confd