diff --git a/Dockerfile b/Dockerfile index 4cee80a..2b384ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,36 +7,39 @@ ARG MSTREAM_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="chbmb" +ENV HOME="/config" + RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ curl \ git && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache --upgrade \ + echo "**** install runtime packages ****" && \ + apk add --no-cache --upgrade \ nodejs \ npm \ openssl && \ - echo "**** install app ****" && \ - mkdir -p \ + echo "**** install app ****" && \ + mkdir -p \ /opt/mstream && \ - if [ -z ${MSTREAM_RELEASE+x} ]; then \ - MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /tmp/mstream.tar.gz -L \ + if [ -z ${MSTREAM_RELEASE+x} ]; then \ + MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + fi && \ + curl -o \ + /tmp/mstream.tar.gz -L \ "https://github.com/IrosTheBeggar/mStream/archive/${MSTREAM_RELEASE}.tar.gz" && \ - tar xzf \ + tar xzf \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ - cd /opt/mstream && \ - npm install --only=production && \ - npm link && \ - echo "**** cleanup ****" && \ - apk del --purge \ + cd /opt/mstream && \ + npm install --only=production && \ + npm link && \ + echo "**** cleanup ****" && \ + npm cache clean --force && \ + apk del --purge \ build-dependencies && \ - rm -rf \ + rm -rf \ /tmp/* # add local files diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index ed44152..4c86927 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -7,36 +7,39 @@ ARG MSTREAM_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="chbmb" +ENV HOME="/config" + RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ curl \ git && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache --upgrade \ + echo "**** install runtime packages ****" && \ + apk add --no-cache --upgrade \ nodejs \ npm \ openssl && \ - echo "**** install app ****" && \ - mkdir -p \ + echo "**** install app ****" && \ + mkdir -p \ /opt/mstream && \ - if [ -z ${MSTREAM_RELEASE+x} ]; then \ - MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /tmp/mstream.tar.gz -L \ + if [ -z ${MSTREAM_RELEASE+x} ]; then \ + MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + fi && \ + curl -o \ + /tmp/mstream.tar.gz -L \ "https://github.com/IrosTheBeggar/mStream/archive/${MSTREAM_RELEASE}.tar.gz" && \ - tar xf \ + tar xf \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ - cd /opt/mstream && \ - npm install --only=production && \ - npm link && \ - echo "**** cleanup ****" && \ - apk del --purge \ + cd /opt/mstream && \ + npm install --only=production && \ + npm link && \ + echo "**** cleanup ****" && \ + npm cache clean --force && \ + apk del --purge \ build-dependencies && \ - rm -rf \ + rm -rf \ /tmp/* # add local files diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 6a9b0c5..4cafc01 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -7,36 +7,39 @@ ARG MSTREAM_RELEASE LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="chbmb" +ENV HOME="/config" + RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ curl \ git && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache --upgrade \ + echo "**** install runtime packages ****" && \ + apk add --no-cache --upgrade \ nodejs \ npm \ openssl && \ - echo "**** install app ****" && \ - mkdir -p \ + echo "**** install app ****" && \ + mkdir -p \ /opt/mstream && \ - if [ -z ${MSTREAM_RELEASE+x} ]; then \ - MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /tmp/mstream.tar.gz -L \ + if [ -z ${MSTREAM_RELEASE+x} ]; then \ + MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + fi && \ + curl -o \ + /tmp/mstream.tar.gz -L \ "https://github.com/IrosTheBeggar/mStream/archive/${MSTREAM_RELEASE}.tar.gz" && \ - tar xf \ + tar xf \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ - cd /opt/mstream && \ - npm install --only=production && \ - npm link && \ - echo "**** cleanup ****" && \ - apk del --purge \ + cd /opt/mstream && \ + npm install --only=production && \ + npm link && \ + echo "**** cleanup ****" && \ + npm cache clean --force && \ + apk del --purge \ build-dependencies && \ - rm -rf \ + rm -rf \ /tmp/* # add local files diff --git a/README.md b/README.md index 1a20eb3..d2e774d 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,14 @@ The architectures supported by this image are: ## Application Setup -Access the webui at `http://:3000`, For most users specifying a `$USER` and `$PASSWORD` is sufficient, the `USE_JSON` option allows for more granular control of mStream, but with added complexity, requiring manual editing of `config.json` to configure your install, for more information check out [Mstream](https://github.com/IrosTheBeggar/mStream/blob/master/docs/json_config.md#json-config). Note using this option will make the default username:password `admin` and `password` respectively and any environmental variables will be ignored. +Access the webui at `http://:3000` + +Settings are adjusted through the web ui or via editing of `config.json`. For more information check out [Mstream](https://github.com/IrosTheBeggar/mStream/blob/master/docs/json_config.md#json-config). + +## IMPORTANT NOTICE: +mStream v5 no longer accepts cli arguments for setting the user and password and requires the use of `config.json`. Therefore, the environment variables `USER`, `PASSWORD` and `USE_JSON` are deprecated. + +v4's `config.json` is not compatible with v5. Existing `config.json` will be renamed to `config.json.v4-bak` for your reference and a new default `config.json` will be created upon upgrade from v4 to v5. ## Usage @@ -79,13 +86,10 @@ services: environment: - PUID=1000 - PGID=1000 - - USER=admin - - PASSWORD=password - - USE_JSON=true/false - TZ=Europe/London volumes: - - :/config - - :/music + - /path/to/data:/config + - /path/to/music:/music ports: - 3000:3000 restart: unless-stopped @@ -98,13 +102,10 @@ docker run -d \ --name=mstream \ -e PUID=1000 \ -e PGID=1000 \ - -e USER=admin \ - -e PASSWORD=password \ - -e USE_JSON=true/false \ -e TZ=Europe/London \ -p 3000:3000 \ - -v :/config \ - -v :/music \ + -v /path/to/data:/config \ + -v /path/to/music:/music \ --restart unless-stopped \ ghcr.io/linuxserver/mstream ``` @@ -118,9 +119,6 @@ Container images are configured using parameters passed at runtime (such as thos | `-p 3000` | The port for the mStream webinterface | | `-e PUID=1000` | for UserID - see below for explanation | | `-e PGID=1000` | for GroupID - see below for explanation | -| `-e USER=admin` | Set username to login | -| `-e PASSWORD=password` | Set password for user | -| `-e USE_JSON=true/false` | Run mStream using the config specified at `/config/config.json`, note this will mean user/password is defined in `config.json` | | `-e TZ=Europe/London` | Specify a timezone to use e.g. Europe/London | | `-v /config` | mStream config | | `-v /music` | Music location | @@ -234,6 +232,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **17.05.21:** - Deprecating the env vars `USER`, `PASSWORD` and `USE_JSON` as mStream v5 requires the use of `config.json`. * **23.01.21:** - Rebasing to alpine 3.13. * **01.06.20:** - Rebasing to alpine 3.12. * **19.12.19:** - Rebasing to alpine 3.11. diff --git a/readme-vars.yml b/readme-vars.yml index 82257cc..e8d33c0 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -15,24 +15,29 @@ available_architectures: param_container_name: "{{ project_name }}" param_usage_include_vols: true param_volumes: - - { vol_path: "/config", vol_host_path: "", desc: "mStream config" } - - { vol_path: "/music", vol_host_path: "", desc: "Music location" } + - { vol_path: "/config", vol_host_path: "/path/to/data", desc: "mStream config" } + - { vol_path: "/music", vol_host_path: "/path/to/music", desc: "Music location" } param_usage_include_ports: true param_ports: - { external_port: "3000", internal_port: "3000", port_desc: "The port for the mStream webinterface" } param_usage_include_env: true param_env_vars: - - { env_var: "USER", env_value: "admin", desc: "Set username to login" } - - { env_var: "PASSWORD", env_value: "password", desc: "Set password for user" } - - { env_var: "USE_JSON", env_value: "true/false", desc: "Run mStream using the config specified at `/config/config.json`, note this will mean user/password is defined in `config.json`" } - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use e.g. Europe/London" } # application setup block app_setup_block_enabled: true app_setup_block: | - Access the webui at `http://:3000`, For most users specifying a `$USER` and `$PASSWORD` is sufficient, the `USE_JSON` option allows for more granular control of mStream, but with added complexity, requiring manual editing of `config.json` to configure your install, for more information check out [{{ project_name|capitalize }}](https://github.com/IrosTheBeggar/mStream/blob/master/docs/json_config.md#json-config). Note using this option will make the default username:password `admin` and `password` respectively and any environmental variables will be ignored. + Access the webui at `http://:3000` + + Settings are adjusted through the web ui or via editing of `config.json`. For more information check out [{{ project_name|capitalize }}](https://github.com/IrosTheBeggar/mStream/blob/master/docs/json_config.md#json-config). + + ## IMPORTANT NOTICE: + mStream v5 no longer accepts cli arguments for setting the user and password and requires the use of `config.json`. Therefore, the environment variables `USER`, `PASSWORD` and `USE_JSON` are deprecated. + + v4's `config.json` is not compatible with v5. Existing `config.json` will be renamed to `config.json.v4-bak` for your reference and a new default `config.json` will be created upon upgrade from v4 to v5. # changelog changelogs: + - { date: "17.05.21:", desc: "Deprecating the env vars `USER`, `PASSWORD` and `USE_JSON` as mStream v5 requires the use of `config.json`." } - { date: "23.01.21:", desc: "Rebasing to alpine 3.13." } - { date: "01.06.20:", desc: "Rebasing to alpine 3.12." } - { date: "19.12.19:", desc: "Rebasing to alpine 3.11." } diff --git a/root/defaults/config.json b/root/defaults/config.json index 699003b..adf6ea8 100644 --- a/root/defaults/config.json +++ b/root/defaults/config.json @@ -1,7 +1,7 @@ { "port": 3000, - "webAppDirectory": "public", - "writeLogs": false, + "webAppDirectory": "webapp", + "writeLogs": true, "noUpload": true, "scanOptions": { "skipImg": false, @@ -12,17 +12,10 @@ }, "storage": { "albumArtDirectory": "/config/album-art", - "dbDirectory": "/config/db" + "dbDirectory": "/config/db", + "logsDirectory": "/config/logs" }, "folders": { "library": { "root": "/music" } - }, - "users": { - "admin": { - "password":"password", - "vpaths": ["library"], - "lastfm-user": "username", - "lastfm-password": "password" - } } } diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config index cbfd8ee..2000fd4 100644 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/cont-init.d/30-config @@ -2,12 +2,55 @@ # make folders mkdir -p \ - /config/{album-art,db} + /config/{album-art,db,logs} # copy config.json if doesn't exist [[ ! -e /config/config.json ]] && \ cp /defaults/config.json /config/config.json +# Backwards compatibility notice +if [ -n "$USER" ] || [ -n "$PASSWORD" ] || [ -n "$USE_JSON" ]; then + echo ' +************************************* +************************************* +**** **** +**** $USER, $PASSWORD and **** +**** **** +**** $USE_JSON env vars are **** +**** **** +**** deprecated. **** +**** **** +**** Please edit config.json **** +**** **** +**** or use the web ui to **** +**** **** +**** modify the settings. **** +**** **** +************************************* +*************************************' +fi + +if grep -q '"webAppDirectory": "public"' /config/config.json; then + mv /config/config.json /config/config.json.v4-bak + echo ' +************************************* +************************************* +**** **** +**** **** +**** v4 config.json detected **** +**** **** +**** renaming to **** +**** **** +**** config.json.v4-bak **** +**** **** +**** due to incompatibility **** +**** **** +**** with v5 **** +**** **** +************************************* +*************************************' +fi + # permissions chown abc:abc -R \ /config diff --git a/root/etc/services.d/mstream/run b/root/etc/services.d/mstream/run index 19e1908..d835887 100644 --- a/root/etc/services.d/mstream/run +++ b/root/etc/services.d/mstream/run @@ -2,10 +2,5 @@ cd /opt/mstream || exit -if [ "$USE_JSON" == "true" ]; then - exec \ - s6-setuidgid abc mstream -j /config/config.json -else - exec \ - s6-setuidgid abc mstream -m /music -I /config/album-art/ -d /config/db/ -u ${USER} -x ${PASSWORD} -fi \ No newline at end of file +exec \ + s6-setuidgid abc mstream -j /config/config.json \ No newline at end of file