Next Gen Deemix

This commit is contained in:
Henning Bocklage 2021-05-30 01:10:34 +02:00
parent 77518f5a24
commit 0a580acd36
14 changed files with 114 additions and 297 deletions

View File

@ -9,29 +9,26 @@ variables:
IMAGE: registry.gitlab.com/bockiii/deemix-docker
IMAGE_TAG: latest
DOCKER_CLI_EXPERIMENTAL: enabled
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- apk add --update curl && rm -rf /var/cache/apk/*
- apk add --update curl jq && rm -rf /var/cache/apk/*
- export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
build:
stage: build
script:
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
- docker build --pull -f Dockerfile.arm64v8 --build-arg BUILDDATE=$CI_JOB_TIMESTAMP -t $IMAGE:arm64v8-${IMAGE_TAG} .
- docker build --pull -f Dockerfile.arm32v7 --build-arg BUILDDATE=$CI_JOB_TIMESTAMP -t $IMAGE:arm32v7-${IMAGE_TAG} .
- docker build --pull --build-arg BUILDDATE=$CI_JOB_TIMESTAMP -t $IMAGE:amd64-${IMAGE_TAG} .
- docker push $IMAGE:arm64v8-${IMAGE_TAG}
- docker push $IMAGE:arm32v7-${IMAGE_TAG}
- docker push $IMAGE:amd64-${IMAGE_TAG}
- docker manifest create "$IMAGE:${IMAGE_TAG}"
"$IMAGE:amd64-${IMAGE_TAG}"
"$IMAGE:arm32v7-${IMAGE_TAG}"
"$IMAGE:arm64v8-${IMAGE_TAG}"
- docker manifest annotate "$IMAGE:${IMAGE_TAG}" "$IMAGE:arm32v7-${IMAGE_TAG}" --os=linux --arch=arm --variant=v7
- docker manifest annotate "$IMAGE:${IMAGE_TAG}" "$IMAGE:arm64v8-${IMAGE_TAG}" --os=linux --arch=arm64 --variant=v8
# Push manifest to official registry
- docker manifest push "$IMAGE:${IMAGE_TAG}"
# Validate multi-arch manifest
- docker run --rm mplatform/mquery $IMAGE:${IMAGE_TAG}
# Download latest buildx bin from github
- mkdir -p ~/.docker/cli-plugins/
- BUILDX_LATEST_BIN_URI=$(curl -s -L https://github.com/docker/buildx/releases/latest | grep 'linux-amd64' | grep 'href' | sed 's/.*href="/https:\/\/github.com/g; s/amd64".*/amd64/g')
- curl -s -L ${BUILDX_LATEST_BIN_URI} -o ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
# Get and run the latest docker/binfmt tag to use its qemu parts
- BINFMT_IMAGE_TAG=$(curl -s https://registry.hub.docker.com/v2/repositories/docker/binfmt/tags | jq '.results | sort_by(.last_updated)[-1].name' -r)
- docker run --rm --privileged docker/binfmt:${BINFMT_IMAGE_TAG}
# create the multibuilder
- docker buildx create --name multibuilder
- docker buildx use multibuilder
# build and push
- docker buildx build --platform "${PLATFORMS}" -t $IMAGE:${IMAGE_TAG} . --push

View File

@ -1,4 +1,9 @@
# Changelog
## 2021-06-28
- Full rework of the latest by promoting the next gen version to current after the python version is permanently broken now
- Aside from the serverwide-arl, everything should work for now. As soon as that feature is available in the source, I will update the container with that functionality again.
## 2021-05-30
- Added next gen version of deemix as container variant
## 2021-04-12
- Added "packagedate" to see when the source was pulled in the logfiles
## 2021-03-29

View File

@ -1,4 +1,4 @@
FROM lsiobase/alpine:3.13
FROM lsiobase/ubuntu:focal
ARG BUILDDATE
ENV BUILDDATEENV=${BUILDDATE}
@ -6,38 +6,33 @@ ENV BUILDDATEENV=${BUILDDATE}
LABEL \
app.deemix.image.created="${BUILDDATE}" \
app.deemix.image.url="https://gitlab.com/Bockiii/deemix-docker" \
app.deemix.image.title="Docker image for Deemix" \
app.deemix.image.description="Docker image for Deemix and the pyweb frontend" \
maintainer="Bocki"
app.deemix.image.title="Docker image for Deemix" \
app.deemix.image.description="Docker image for Deemix" \
maintainer="Bocki"
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
gcc \
g++ \
libffi-dev \
python3-dev \
git \
curl \
jq \
make && \
echo "**** install packages ****" && \
apk add --no-cache \
py3-pip \
python3 && \
echo "**** setup directories ****" && \
mkdir /deem && \
mkdir /deem/Music && \
rm -R /config && \
ln -sf /deem/.config/deemix /config && \
ln -sf /downloads /deem/Music/deemix\ Music && \
chown abc:abc /deem && \
echo "**** clean up ****" && \
rm -rf \
/root/.cache \
/tmp/*
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash && \
apt-get -y --no-install-recommends install >/dev/null \
nodejs \
jq \
iputils-ping \
curl \
git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
npm install --global yarn
RUN git clone https://gitlab.com/RemixDev/deemix-gui.git --recursive && \
rm -R /config && \
mkdir /deemix-gui/server/music && \
mkdir -p /deem/.config/deemix && \
ln -sf /deemix-gui/server/music /downloads && \
ln -sf /deem/.config/deemix /config
WORKDIR /deemix-gui/server
RUN yarn install
COPY root/ /
EXPOSE 6595
VOLUME /downloads /config
ENTRYPOINT [ "/init" ]

View File

@ -1,53 +0,0 @@
FROM alpine AS builder
# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261
ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v5.2.0%2Bbalena4/qemu-5.2.0.balena4-arm.tar.gz
RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1
FROM lsiobase/alpine:arm32v7-3.13
# Add QEMU
COPY --from=builder qemu-arm-static /usr/bin
ARG BUILDDATE
ENV BUILDDATEENV=${BUILDDATE}
LABEL \
app.deemix.image.created="${BUILDDATE}" \
app.deemix.image.url="https://gitlab.com/Bockiii/deemix-docker" \
app.deemix.image.title="Docker image for Deemix" \
app.deemix.image.description="Docker image for Deemix and the pyweb frontend" \
maintainer="Bocki"
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
gcc \
g++ \
libffi-dev \
python3-dev \
git \
curl \
jq \
make && \
echo "**** install packages ****" && \
apk add --no-cache \
py3-pip \
python3 && \
echo "**** setup directories ****" && \
mkdir /deem && \
mkdir /deem/Music && \
rm -R /config && \
ln -sf /deem/.config/deemix /config && \
ln -sf /downloads /deem/Music/deemix\ Music && \
chown abc:abc /deem && \
echo "**** clean up ****" && \
rm -rf \
/root/.cache \
/tmp/*
COPY root/ /
EXPOSE 6595
VOLUME /downloads /config

View File

@ -1,54 +0,0 @@
FROM alpine AS builder
# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261
ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v5.2.0%2Bbalena4/qemu-5.2.0.balena4-aarch64.tar.gz
RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1
FROM lsiobase/alpine:arm64v8-3.13
# Add QEMU
COPY --from=builder qemu-aarch64-static /usr/bin
ARG BUILDDATE
ENV BUILDDATEENV=${BUILDDATE}
LABEL \
app.deemix.image.created="${BUILDDATE}" \
app.deemix.image.url="https://gitlab.com/Bockiii/deemix-docker" \
app.deemix.image.title="Docker image for Deemix" \
app.deemix.image.description="Docker image for Deemix and the pyweb frontend" \
maintainer="Bocki"
EXPOSE 9666
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
gcc \
g++ \
libffi-dev \
python3-dev \
git \
curl \
jq \
make && \
echo "**** install packages ****" && \
apk add --no-cache \
py3-pip \
python3 && \
echo "**** setup directories ****" && \
mkdir /deem && \
mkdir /deem/Music && \
rm -R /config && \
ln -sf /deem/.config/deemix /config && \
ln -sf /downloads /deem/Music/deemix\ Music && \
chown abc:abc /deem && \
echo "**** clean up ****" && \
rm -rf \
/root/.cache \
/tmp/*
COPY root/ /
EXPOSE 6595
VOLUME /downloads /config

View File

@ -12,74 +12,61 @@ Deemix in a Docker container.
## How to run this
Deemix will work out of the box, but you should at least set a fixed port for the web interface and mount a folder to the container for where your downloads will go.
You can also map a folder on the host for the config file (mount a local folder to /config/), but that's optional. If they add or rework settings in the future, there is no guarantee that your old configs will work, so beware.
> If using a config folder and global ARL, make sure to set it is in /path/config/.arl and that the file is the plaintext token
Run the container either via commandline or via docker-compose (see the provided example file).
Check the parameter explanation below to see which ones are mandatory.
### Example for Docker:
```
$ docker run -d --name Deemix \
-v /your/storage/path/:/downloads \
-v /your/config/location:/config \
-e PUID=1000 \
-e PGID=1000 \
-e ARL=1234567 \
-e UMASK_SET=022 \
-e DEEZUI=false \
-p 6595:6595 \
registry.gitlab.com/bockiii/deemix-docker
-v /your/storage/path/:/downloads \
-v /your/config/location:/config \
-e PUID=1000 \
-e PGID=1000 \
-e UMASK_SET=022 \
-p 6595:6595 \
registry.gitlab.com/bockiii/deemix-docker
```
### Example for Docker Compose:
```
version: '3.3'
services:
deemix:
image: registry.gitlab.com/bockiii/deemix-docker
container_name: Deemix
volumes:
- /your/storage/path/:/downloads
- /your/config/location:/config
environment:
- PUID=1000
- PGID=1000
- ARL=1234567
- UMASK_SET=022
- DEEZUI=false
ports:
- 6595:6595
deemix:
image: registry.gitlab.com/bockiii/deemix-docker
container_name: Deemix
volumes:
- /your/storage/path/:/downloads
- /your/config/location:/config
environment:
- PUID=1000
- PGID=1000
- UMASK_SET=022
ports:
- 6595:6595
```
### Updating Deemix
The container will look for a new update in the Deemix repo on every start and will update itself. So if you want to update Deemix, just stop and start the Container. Also works with docker-compose stop.
Pull the latest container for the latest Deemix version
### Explanation:
`-v /your/storage/path/:/downloads` - Path for your music downloads.
`-v /your/config/location:/config` - OPTIONAL: Path to your local configuration.
`-e PUID=1000` - OPTIONAL: User ID of the user you want the container to run as in order to fix folder permission issues.
`-e PGID=1000` - OPTIONAL: Group ID, see above.
`-e ARL=1234567` - OPTIONAL: If you want Deemix to automatically log in for everyone who opens the website, provide your ARL token via this Environment variable.
`-e UMASK_SET=022 - OPTIONAL: Setting UMASK for file permissions Default is 022
`-e DEEZUI=false - OPTIONAL: Setting DEEZUI to true will change your GUI to the legacy Deezloader UI.
`-p 6595:6595` - Port opened for the web interface.
`registry.gitlab.com/bockiii/deemix-docker` - This container.
| Parameter | Function |
| :----: | --- |
| `-v /your/storage/path/:/downloads` | Path for your music downloads |
| `-v /your/config/location:/config` | Path to your local configuration |
| `-e PUID=1000` | OPTIONAL: User ID of the user you want the container to run as in order to fix folder permission issues |
| `-e PGID=1000` | OPTIONAL: Group ID, see PUID |
| `-e UMASK_SET=022` | OPTIONAL: Setting UMASK for file permissions Default is 022 |
| `-p 6595:6595` | Port opened for the web interface |
| `-e INTPORT=3333` | EXTRA OPTIONAL: This changes the internal port of deemix. DON'T CHANGE THIS IF YOU DONT KNOW WHY YOU WOULD DO IT |
| `registry.gitlab.com/bockiii/deemix-docker` | This container |
To access the web interface, go to http://YOURSERVERIP:6595
## Tags
`latest` : Latest state of the master branch. Can be considered "working" but Deemix is under heavy development.
`latest` : Latest state of the main branch.
Tag includes `amd64`, `arm32v7` and `arm64v8` architectures.
@ -95,5 +82,4 @@ Gitlab link for this container: https://gitlab.com/Bockiii/deemix-docker
Issue Tracker for this Docker: https://gitlab.com/Bockiii/deemix-docker/-/issues
Feel free to open an issue that is Docker related, and not related to Deemix development. Go to the Deemix repository for that.

View File

@ -1,16 +0,0 @@
version: '3.3'
services:
deemix:
image: registry.gitlab.com/bockiii/deemix-docker
container_name: Deemix
volumes:
- /your/storage/path/:/downloads
- /your/config/location:/config
environment:
- PUID=1000
- PGID=1000
- ARL=1234567
- UMASK_SET=022
- DEEZUI=false
ports:
- 6595:6595

View File

@ -0,0 +1,14 @@
version: '3.3'
services:
deemix:
image: registry.gitlab.com/bockiii/deemix-docker
container_name: Deemix
volumes:
- /your/storage/path/:/downloads
- /your/config/location:/config
environment:
- PUID=1000
- PGID=1000
- UMASK_SET=022
ports:
- 6595:6595

View File

@ -0,0 +1,16 @@
#!/usr/bin/with-contenv bash
# test write access to download and config folder and test internet connectivity
printf '[cont-init.d] Fixing Folder Permissions\n'
chown abc:abc /deemix-gui/server
chown -R abc:abc /deem
chown -R abc:abc /config
chown -R abc:abc /deemix-gui/server/music
# Fix misconfigured download locations. The container's download map is always /downloads.
if [ -f "/config/config.json" ]; then
jq '.downloadLocation = "/downloads"' /config/config.json > tmp.$$.json && mv tmp.$$.json /config/config.json
chown abc:abc /config/config.json
fi

View File

@ -6,4 +6,4 @@ printf '%-50s %2s %-5s \n' "[cont-init.d] Container Builddate" ":" "$BUILDDATEEN
if [ -w "/downloads" ]; then printf '%-50s %2s %-5s \n' "[cont-init.d] Download Folder Write Access" ":" "Success"; else printf '%-50s %2s %-5s \n' "[cont-init.d] Download Folder Write Access" ":" "Failure"; fi && \
if [ -w "/config" ]; then printf '%-50s %2s %-5s \n' "[cont-init.d] Config Folder Write Access" ":" "Success"; else printf '%-50s %2s %-5s \n' "[cont-init.d] Config Folder Write Access" ":" "Failure"; fi && \
until ping -c 1 www.deezer.com &> /dev/null; do printf '%-50s %2s %-5s \n' "[cont-init.d] Internet Access" ":" "Failure. Trying again in 5 seconds"; sleep 5; done
printf '%-50s %2s %-5s \n' "[cont-init.d] Internet Access" ":" "Success"
printf '%-50s %2s %-5s \n' "[cont-init.d] Internet Access" ":" "Success"

View File

@ -1,22 +0,0 @@
#!/usr/bin/with-contenv bash
# download and unpack
echo "[cont-init.d] Downloading and unpacking"
if [ ! -f "/deemix/server.py" ]; then
echo "[cont-init.d] First start, downloading repo"
if [[ "${DEEZUI}" == "true" ]]; then
echo "[cont-init.d] Using Deezloader UI"
curl -L -o deemix_pyweb.zip http://gitlab.com/Bockiii/deemix-src/-/jobs/artifacts/master/download?job=dl_src
unzip -qq deemix_pyweb.zip -d /
rm -R /deemix/webui
mv /deezui /deemix/webui
touch /deemix/updated
else
echo "[cont-init.d] Using Deemix UI"
curl -L -o deemix_pyweb.zip http://gitlab.com/Bockiii/deemix-src/-/jobs/artifacts/master/download?job=dl_src
unzip -qq deemix_pyweb.zip -d /
rm -R /deezui
touch /deemix/updated
fi
fi

View File

@ -1,13 +0,0 @@
#!/usr/bin/with-contenv bash
# set home of the abc user
usermod -d /deem abc
# permissions
echo "[cont-init.d] Setting permissions this may take some time"
chown -R abc:abc \
/deem/.config/
chown abc:abc \
/downloads/

View File

@ -1,30 +0,0 @@
#!/usr/bin/with-contenv bash
# install deemix
if [ -f "/deemix/updated" ]; then
echo "[cont-init.d] Installing"
cd /deemix
pip3 install -U -r server-requirements.txt --quiet --disable-pip-version-check
rm /deemix/updated
echo "[cont-init.d] Installation done"
fi
# check for arl environment variable. if it is set, create the arl file.
# if the arl was previously set but is out of date, update the file with the arl from the env variable
if [ ${#ARL} -gt 10 ]; then
# this file might not exist; happens when the users runs for the first time
OLDARL=$(cat /config/.arl 2>/dev/null || echo 0) # ignore if the file doesn't exist
if [ "$ARL" != "$OLDARL" ]; then
echo "[cont-init.d] !!! ARL from environment variable does not match current ARL. Using environment variable. !!!"
echo "[cont-init.d] !!! Please update your ARL in the variable instead of the webinterface or remove the ARL from the container call. !!!"
printf $ARL > /config/.arl
fi
fi
# Fix misconfigured download locations. The container's download map is always /downloads.
if [ -f "/config/config.json" ]; then
jq '.downloadLocation = "/downloads"' /config/config.json > tmp.$$.json && mv tmp.$$.json /config/config.json
chown abc:abc /config/config.json
fi

View File

@ -3,24 +3,16 @@
UMASK_SET=${UMASK_SET:-022}
umask "$UMASK_SET"
cd /deemix
cd /deemix-gui/server
HOME=/deem
printf '%-50s %2s %-5s \n' "[cont-init.d] Package Build Date" ":" "$(cat /deemix/packagedate)"
if [ ! -z ${INTPORT} ]; then
port=$INTPORT
else
port=6595
fi
if [ -f "/config/.arl" ]; then
echo "[services.d] Starting with ARL"
exec \
s6-setuidgid abc python3 /deemix/server.py $port --serverwide-arl --host 0.0.0.0
else
echo "[services.d] Starting without ARL"
exec \
s6-setuidgid abc python3 /deemix/server.py $port --host 0.0.0.0
fi
echo "[services.d] Starting Deemix"
s6-setuidgid abc yarn start-build --host 0.0.0.0 --port $port