ned-kelly / docker-multicontainer-libretime

A multi-container deployment of the Libretime Radio Broadcast Server, PostgreSQL, Icecast2 & RabbitMQ, all based on Ubuntu Xenial & Alpine Linux!
56 stars 22 forks source link

correct ownership of /external-media folder #7

Closed frecuencialibre closed 5 years ago

frecuencialibre commented 5 years ago

Upon initial installation with a LOCAL_MUSIC_MAPPING path specified in the .env file, I've been unable to upload audio files until I've manually changed ownership or permissions of the /external-media folder (which by default is owned by 1000:celery) in order to give the www-data user permission to create the imported and organized folders into which to copy files.

Perhaps there is a better fix for this than my manual hack? This seems like precisely the kind of extra step that is frustrating to new users who have no experience troubleshooting.

I'm seeing this behaviour on fresh docker-ce installs in debian. no vm or sshfs complications, just a mounting a standard 755 folder owned by the default user in the host system.

frecuencialibre commented 5 years ago

I've looked into this, but am missing something and it's time to check in.

Neither line 36 of the Dockerfile, nor my various attempts haven't been able to change folder ownership out of the box when an existing folder on the host is specified for LOCAL_MUSIC_MAPPING.

All fresh containers I've created still show the following:

r@rdebian:/var/www/html/docker-multicontainer-libretime$ docker exec -it libretime-core bash
root@6345cf7b120e:/# ls -la /external-media/
total 8
drwxr-xr-x 2 1000 celery 4096 Oct 10 19:00 .
drwxr-xr-x 1 root root   4096 Oct 10 19:10 ..

I've tried adding

RUN chown www-data:www-data /external-media

at the very end of the Dockerfile, after firstrun.sh does its Media Setup business. Not even adding www-data to the celery group works, since as you can see the group has no write access... Could changes be being overwritten?

Thanks all!

frecuencialibre commented 5 years ago
RUN mkdir -p /external-media/imported && \
    mkdir -p /external-media/organize

did not even create the folders. perhaps i'm misunderstanding something related to the way the volume is mounted in docker-compose?

Robbt commented 5 years ago

For me I found that I needed to change the permissions of my local folder external to docker and I just decided to do chmod 777 local_music but I'm sure that it can probably be fixed without making anyone be able to write it. But I didn't have any issues inside of docker after that to get it working. It seems like you were trying to fix the permissions inside of the libretime-core docker container. I'm not too familiar with docker but thought I'd add my experience.

ned-kelly commented 5 years ago

Documentation updated last week to address this, Ideally the files should be owned by the same owner on the parent host as the Libratime user within the container -- In reality this is probably never going to be the case if you're writing to directory from outside of the container as well, so it's will need to come back and have a closer look at this in the future, if you're only uploading files from within the Libretime UI it will be fine.