Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation of Mono docker on a Synology DS416play #15

Closed
dmurphydrtc opened this issue Feb 3, 2019 · 24 comments
Closed

Installation of Mono docker on a Synology DS416play #15

dmurphydrtc opened this issue Feb 3, 2019 · 24 comments

Comments

@dmurphydrtc
Copy link

dmurphydrtc commented Feb 3, 2019

I have one of the above devices that holds my music, videos & backups. It is an Intel based CPU. I have
Docker running on the device and have run numerous types of images (nginx, alpine, mysql etc.) and docker seems to be stable.

I downloaded the all-in-one image from this repo.

If I start the container with the default envir. variables as listed in the attached image..the container runs ok but I cannot gain access via 192.168.1.117:4033 (random port number I have chosen)

I am not sure how I go about setting up the environment variables to get this running. I have attached the default settings for the container as determined by synology/docker. These variables don't align with the setup as per the installation guide from this repo or the official Funkwhale repo. Thanks in advance.

screenshot 67

@michaelmob
Copy link
Owner

michaelmob commented Feb 4, 2019

Could you clarify what you mean when you say you cannot gain access. Does your browser say it doesn't connect? Do you get an error like a 500 Server Error? Anything like that?

Can you show the other tabs in that edit window?
Your environment variables look correct. Unless the Synology pulls in all of those environment variables, the only one you really need to add manually is FUNKWHALE_HOSTNAME=<yourdomain.funkwhale>

You mapped the host port 4033 to container port 80, correct?

@dmurphydrtc
Copy link
Author

Thanks for the prompt reply.

Correct the error is a "Server Error (500)"

I have attached photos of other tabs, processes etc.
screenshot 73
screenshot 72
screenshot 71
screenshot 70
screenshot 69
screenshot 68

This is part of the

/volume1/@docker/btrfs/subvolumes/6399dfad94ce4c781b9238e451518f5e43aee812920622dba77590b75444c889/var/lib/nginx/logs/error.log

2019/02/04 12:27:05 [error] 21814#21814: *395225 open() "/var/services/web/front/index.html" failed (2: No such file or directory), client: 172.17.0.2, server: , request: "GET /front/index.html HTTP/1.1", host: "192.168.1.117"
2019/02/04 12:27:06 [error] 21815#21815: *395229 open() "/var/services/web/front/index.html" failed (2: No such file or directory), client: 172.17.0.2, server: , request: "GET /front/index.html HTTP/1.1", host: "192.168.1.117"
2019/02/04 12:27:10 [error] 21815#21815: *395234 open() "/var/services/web/front/index.html" failed (2: No such file or directory), client: 172.17.0.2, server: , request: "GET /front/index.html HTTP/1.1", host: "192.168.1.117"
2019/02/04 12:27:10 [error] 21815#21815: *395240 open() "/var/services/web/front/index.html" failed (2: No such file or directory), client: 172.17.0.2, server: , request: "GET /front/index.html HTTP/1.1", host: "192.168.1.117"
2019/02/04 12:28:30 [error] 21815#21815: *395318 open() "/var/services/web/front/index.html" failed (2: No such file or directory), client: 172.17.0.2, server: , request: "GET /front/index.html HTTP/1.1", host: "192.168.1.117"
2019/02/04 12:28:30 [error] 21814#21814: *395322 stat() "/var/services/web/front/index.html" failed (2: No such file or directory), client: 172.17.0.2, server: , request: "GET /front/index.html HTTP/1.1", host: "192.168.1.117"

@michaelmob
Copy link
Owner

Judging by those logs something went wrong with the nginx template, it should be pointing to /app and not /var/services.

What are the contents of /etc/nginx/conf.d/funkwhale.conf?

docker exec -it $CONTAINER_ID cat /etc/nginx/conf.d/funkwhale.conf

A complete repull (delete the old image) of funkwhale/all-in-one:0.18.1 may fix it

@dmurphydrtc
Copy link
Author

As requested;

Current config.

docker exec -it 761285947e0a cat /etc/nginx/conf.d/funkwhale.conf

upstream funkwhale-api {
# depending on your setup, you may want to update this
server 127.0.0.1:8000;
}

required for websocket support

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
listen 80 default_server;
server_name _;

# TLS
# Feel free to use your own configuration for SSL here or simply remove the
# lines and move the configuration to the previous server block if you
# don't want to run funkwhale behind https (this is not recommended)
# have a look here for let's encrypt configuration:
# https://certbot.eff.org/all-instructions/#debian-9-stretch-nginx

root /app/front/dist;

location / {
    include /etc/nginx/funkwhale_proxy.conf;
    # this is needed if you have file import via upload enabled
    client_max_body_size 100M;
    proxy_pass   http://funkwhale-api/;
}

location /front/ {
    alias /app/front/dist/;
    expires 30d;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

location /federation/ {
    include /etc/nginx/funkwhale_proxy.conf;
    proxy_pass   http://funkwhale-api/federation/;
}

# You can comment this if you do not plan to use the Subsonic API
location /rest/ {
    include /etc/nginx/funkwhale_proxy.conf;
    proxy_pass   http://funkwhale-api/api/subsonic/rest/;
}

location /.well-known/ {
    include /etc/nginx/funkwhale_proxy.conf;
    proxy_pass   http://funkwhale-api/.well-known/;
}

location /media/ {
    alias /data/media/;
}

location /_protected/media {
    # this is an internal location that is used to serve
    # audio files once correct permission / authentication
    # has been checked on API side
    internal;
    alias   /data/media;
}

location /_protected/music {
    # this is an internal location that is used to serve
    # audio files once correct permission / authentication
    # has been checked on API side
    # Set this to the same value as your MUSIC_DIRECTORY_PATH setting
    internal;
    alias   /music;
}

location /staticfiles/ {
    # django static files
    alias /app/api/staticfiles/;

@dmurphydrtc
Copy link
Author

Deleted container and image (all-in-one:0.18.1) and repulled image still having - Server error (500) .

Then I pulled image from your repo and i am getting to the landing page. Will createsuperuser and
see how far I can get with importing music etc.

Your repo is version 0.17 however ??

Heading in the right direction.

screenshot 78
screenshot 77
screenshot 76

@dmurphydrtc
Copy link
Author

Any ideas why your image works fine but those pulled from Eliot's repo don't? I have tried 0.18, 0.18.1 from his repo and all give the 500 error.

@michaelmob
Copy link
Owner

michaelmob commented Feb 5, 2019

Something must have changed when Eliot was setting up CI. My image is a bit older from before that, so that is probably why.

Now, that the excellent @EliotBerriot's patch has been merged in to fix the final issue in #14 which is similar if not the same problem you are having. So that commit should fix that 500 error in the next image build.

I'll update this when that's up for you to try out
Update: Okay I've pushed up an image thetarkus/funkwhale:0.18.1 for you to try out

@dmurphydrtc
Copy link
Author

Excellent.. Will give it a whirl in an hour..

@dmurphydrtc
Copy link
Author

Mike...(love the artwork (your own creation?)

Pulled the image and managed to flash up the landing page. From the CLI managed to create a superuser.

Alas when I try and import music via the gui , i'm getting the attached denied message..

I wonder do I have some permissions issue. I'm not getting any error messages in the logs to indicate an issue.

Any ideas?
screenshot 79

@michaelmob
Copy link
Owner

michaelmob commented Feb 5, 2019

The artwork was created by Francis Gading!

I'm glad the container is up and running. I believe you're right, the error being a permissions issue. Since you are uploading the file, you'll need write permission on your music directory so try changing those to something like 0755.

Also try out importing music via CLI may also throw an error that could give us more insight.

You may need to set the PUID and PGID variables too. More info here

@dmurphydrtc
Copy link
Author

Mike,

Thanks again. As much as i wanted to host my music on the Synology i'm not sure if it is going to be possible as the version of docker used by Synology is a few years old and users on the forum (i should have checked earlier) are not happy with the pace of updates and the issues it causing other apps etc.

I reverted back to my rpi3 (mono build version) and built the image using your latest repo without any issues and deployed that image only to find I am having the exact same issue (denied) when I try to import music via the gui.

Coincidence or some issue with the latest build?

PS - Will try import via CLI later

@michaelmob
Copy link
Owner

michaelmob commented Feb 6, 2019

I'm actually getting the same Denied error now too. Looking into it.

@dmurphydrtc
Copy link
Author

Thanks for the update. Await news of your findings

@michaelmob
Copy link
Owner

I'm able to upload files < 2.5mb, anything above that and it is denied. No daphne/worker errors whatsoever lead me to believe nginx was causing the problem.

client_max_body_size is set to 100M by default.
Setting this in /etc/nginx/conf.d/funkwhale.conf (in / location directive and server scope), /etc/nginx/nginx.conf and even /etc/nginx/funkwhale_proxy.conf, no dice. After, I tried setting the value to 0 to disable the upload limit completely, still nothing.

Looked at the differences in the nginx templates, and the only one worth anything was the /api/ location directive, but alas, upload denied.
https://github.com/thetarkus/docker-funkwhale/blob/9e9d9aee28ed15015d654311823aa9b9b5ebd6f5/root/etc/nginx/funkwhale_nginx.template#L35-L40

I'm inclined to believe that some change in funkwhale is denying the upload.
CLI import works though.

@EliotBerriot does funkwhale do any checking of its own for individual file size?

@dmurphydrtc
Copy link
Author

dmurphydrtc commented Feb 6, 2019

Ok same results here..i'm able to import files < 2.5mb

Do u use this for CLI imports...

For file structures similar to ./Artist/Album/Track.mp3

docker exec -it funkwhale manage import_files $LIBRARY_ID "/music///*.mp3" --in-place --async

@agateblue
Copy link
Collaborator

Hi there, someone else reported the same issue yesterday, I'm going to look into that :)

@agateblue
Copy link
Collaborator

@thetarkus I cannot reproduce this issue locally on my laptop, can you share the exact set of commands and steps (including the docker run) that leads to the issue?

This is what I did:

mkdir /tmp/funkwhale
cd /tmp/funkwhale
touch .env
export FUNKWHALE_VERSION="0.18.1"

echo "FUNKWHALE_HOSTNAME=localhost" >> .env
echo "FUNKWHALE_PROTOCOL=http" >> .env  
echo "DJANGO_SECRET_KEY=$(openssl rand -hex 45)" >> .env

docker run \
    --name=funkwhale \
    --env-file=/tmp/funkwhale/.env \
    -v /tmp/funkwhale/data:/data \
    -e PUID=$UID -e FUNKWHALE_SPA_HTML_ROOT=http://localhost/front/ \
    -e PGID=$GID \
    -p 5000:80 \
    -d \
    funkwhale/all-in-one:$FUNKWHALE_VERSION

docker exec -it funkwhale manage createsuperuser

Then visit http://localhost:5000, login with my superuser, create a library, upload a 4,5Mb mp3 file, without any issue.

I feel like I'm missing something obvious here.

@dmurphydrtc
Copy link
Author

I had to rebuild the mono image (rpi3) - did that twice and using the above procedure (on 3 occasions, just for kicks) it still bombs out.

Must the build of the image part.

@agateblue
Copy link
Collaborator

Allright, I can indeed reproduce if I rebuild the image myself!

@agateblue
Copy link
Collaborator

Both nginx config are identical, and apparently, it's the application itself that answers with a 413 (Entity too large) status code.

@agateblue
Copy link
Collaborator

So, I found out what the issue was: one of our dependency released a bugfix release which enforce a size check that was not here before: django/channels@a1ecd5e

You should be able to fix the issue by running: docker exec funkwhale pip install channels==2.1.6 then docker restart funkwhale

Implementing an proper fix will likely take a bit more time, I'll keep you updated.

@dmurphydrtc
Copy link
Author

dmurphydrtc commented Feb 6, 2019

I can confirm the fix is in..All good. Newly built container works a treat. In the mean time we await the official fix.

Can I ask a simple and noob question. Given I am running the mono docker image on a rpi3 that sits in my LAN behind a ASUS router DSL-AC86U. what is the most straightforward way to implement https as I would like to share / incorporate external instances with mine.

Any guides that I have read imply that I need my own domain name because self signed certs no longer are flavour of the day.

I understand you guys are busy and have better things to fill your day but a some pointers would be wonderful.

I am happy using the CLI and am gaining a good understanding of the OS but this has me in a corner.

Thanks.

@agateblue
Copy link
Collaborator

There is likely a bug in our dependency, cf django/channels#1240

@dmurphydrtc you will indeed need a domain name. That's a hard requirement if you want to join the federation. Serving your instance publicly can be done using a nginx reverse proxy on the host and requesting free SSL certificates via Let's encrypt.

If you need help with that, please open a dedicated topic on https://socialhub.network/c/funkwhale/support and I'll detail the process :)

@dmurphydrtc
Copy link
Author

Eliot..

I will indeed document my requirements and post in above forum. I really appreciate your dedication and efforts. I love learning, but impatient and time hungry. I feel awkward asking such noob questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants