Git Product home page Git Product logo

Comments (20)

kuzi-moto avatar kuzi-moto commented on September 22, 2024 2

I believe I fixed this. Should be able to specify UID and GID environment values in the docker-compose.yml file. Will set Ampache's internal www-data user to the ID you specify.

from ampache-docker.

arielelkin avatar arielelkin commented on September 22, 2024 1

Update:

We need to add the following line to run.sh to let PHP write to the config directory:

chown www-data:www-data -R /var/www/config

The install wizard will then tell us that ampache.cfg.php is writable!

But at the step where it generates the config file, it’s giving me this error:

Error: Config files not found or unreadable

Basically it can’t find the template ampache.cfg.php… But the dockerfile doesn’t actually install it?

Am I missing something?

from ampache-docker.

lachlan-00 avatar lachlan-00 commented on September 22, 2024 1

you shouldn't need to do anything special.
If you build with your config file it gets copied over from the dockerfile and then copied on run.

Dockerfile

COPY ampache.cfg.* /var/temp/

run.sh

if [[ -f /var/temp/ampache.cfg.php && ! -f /var/www/config/ampache.cfg.php ]]; then
    mv /var/temp/ampache.cfg.php /var/www/config/ampache.cfg.php
fi

from ampache-docker.

bigforcegun avatar bigforcegun commented on September 22, 2024 1

If you build with your config file it gets copied over from the dockerfile and then copied on run.

This issue is not about custom build of image, it's about launching a image with mounted volume for configs. Even if i build custom docker container with my dist config - the issue still here - i will get not readable config

you shouldn't need to do anything special.

In most host machines docker www-data GID UID not match with HOST machine GID UID - so when image start and copy config we have bad file permissions 🤷‍♂️

So i need do many special things to run this image properly.

  • i need map host machine user to www-data docker user for normal file permissions
    • read/write config
    • read/write media
    • read/write podcast downloads

For now i use special entrypoint for docker-compose

#!/usr/bin/env bash
usermod -a -G users www-data #I't work only for my host machine, you need use groups from yours
exec /run.sh

then my config.php becomes readable

from ampache-docker.

KaeTuuN avatar KaeTuuN commented on September 22, 2024 1

@kuzi-moto That works great!

@raaron773 It's PID and UID not PGID and PUID!

@lachlan-00 I think this can be closed.

from ampache-docker.

TanqBQZ avatar TanqBQZ commented on September 22, 2024 1

@KaeTuuN It's GID and UID

from ampache-docker.

tonyisworking avatar tonyisworking commented on September 22, 2024

I followed your tip above

chown www-data:www-data -R /var/www/config

Then I got the ampache.cfg.php.dist in the repo and manually put it in the config folder. Then the buttons were then set to OK and was able to proceed.

You can check the run.sh file to see that it moved it over.
mv /var/temp/ampache.cfg.php.dist /var/www/config/ampache.cfg.php.dist

Then everything seems to install okay.

from ampache-docker.

bigforcegun avatar bigforcegun commented on September 22, 2024

I't bad idea modify files on host machine from docker.

Instead you need use right UID and GID from host machine in image for www-data user.

from ampache-docker.

bigforcegun avatar bigforcegun commented on September 22, 2024

Here good example of GID and UID setup for docker-containers - https://docs.linuxserver.io

It sad, but another way to map user rights from host machine to docker volumes are full of pain

--user docker options working bad with volumes

from ampache-docker.

lachlan-00 avatar lachlan-00 commented on September 22, 2024

I'll test out what you've said and see what I can do.

from ampache-docker.

lachlan-00 avatar lachlan-00 commented on September 22, 2024

This worked fine. test.php comes up all readable.

docker run --name=ampache -d -v /mnt/files-music/albums/:/media:ro -v /var/www/config/:/var/www/config/:rw -p 8888:80 ampache/ampache

from ampache-docker.

bigforcegun avatar bigforcegun commented on September 22, 2024

Can you check in this example /mnt/files-music/albums/ default file permissions?

/mnt/files-music/albums/ - very similar to SMB mount with default 777 permissions


My point has not changed - on host machine we have user www-data with different UID then internal docker or host machine have no user www-data.

You can emulate this with usermod -u 3333 www-data or just try to mount volume with no www-data owner - then config been nor readable.

from ampache-docker.

lachlan-00 avatar lachlan-00 commented on September 22, 2024

That seems like something that's not an issue with the host not the image.

from ampache-docker.

Superpiffer avatar Superpiffer commented on September 22, 2024

Can you check in this example /mnt/files-music/albums/ default file permissions?

/mnt/files-music/albums/ - very similar to SMB mount with default 777 permissions

My point has not changed - on host machine we have user www-data with different UID then internal docker or host machine have no user www-data.

You can emulate this with usermod -u 3333 www-data or just try to mount volume with no www-data owner - then config been nor readable.

I second that, the approach in this container works if the music folder is used only by ampache or if all other containers use the same UID and GID, but for configurations with many concurrent services (like mine) maybe is not ideal. Using the USER docker directive it's not useful too because the container use root for the database.

from ampache-docker.

xeruf avatar xeruf commented on September 22, 2024

@kuzi-moto can you show how to concretely do this?

from ampache-docker.

kuzi-moto avatar kuzi-moto commented on September 22, 2024

I will try to remember to do it tomorrow!

from ampache-docker.

raaron773 avatar raaron773 commented on September 22, 2024

I tried adding PGID and PUID in environment section in the docker-compose file. It's the same thing right ? @kuzi-moto because if it is then it didn't work if not then how do I go about this?

EDIT: This is what I did: https://pastebin.com/RKTxP7JN

from ampache-docker.

xeruf avatar xeruf commented on September 22, 2024

The warning stays, even though the option seems to work...

from ampache-docker.

lead0r avatar lead0r commented on September 22, 2024

I tried adding PGID and PUID in environment section in the docker-compose file. It's the same thing right ? @kuzi-moto because if it is then it didn't work if not then how do I go about this?

EDIT: This is what I did: https://pastebin.com/RKTxP7JN

There is a typo in your file: "enivironment"

from ampache-docker.

KaeTuuN avatar KaeTuuN commented on September 22, 2024

@KaeTuuN It's GID and UID

That's what I wrote!?

from ampache-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.