ajnart / homarr

Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr)
https://homarr.dev
MIT License
6k stars 275 forks source link

:sparkles: Environment variable: PUID and PGID (#240) #2011

Closed nyok1912 closed 4 months ago

nyok1912 commented 5 months ago

This PR fixes #240

Category

Feature

Issue Number

Related issue: #240

New Vars

PUID and PGID

nyok1912 commented 5 months ago

Are you sure this works without any repercussions ? I'm pretty sure I or we have tried to implement this previously by using the base image of a famous set of Images (hotio base image)

We had made it so that the CI manually builds before creating the docker images so that it doesn't take like 15 minutes for the ARM VMs to build, and before that they couldn't even build the project because of errors in NextJS.

Can you document the PR more ? I'm not sure what a supervisor and the conf.d files are supposed to do

Must be works without any repercussion because i don't touch any homarr code, only added new features same as keep synced PUID, PGID and DOCKER_PGID.

PUID - Must be same UID on host user, under container this UID will applied to homarr user. PGID - Must be same GID on host user group, under container this GID will applied to homarr group. DOCKER_PGID - Is needed for work with host docker without any problem, under container docker GID must be same as host docker GID to interact with host docker.sock bind mount.

Added docker entrypoint: All sh scripts in the /docker-entrypoint.d folder will be run on every container startup, this allows you to configure the custom details needed on many systems; In this case, I wrote a user configuration script. 00-user-setup.sh – This script ensures that permissions between the host and container remain the same UID and GID when binded mount volumes. It also changes the GID of the docker to maintain the homarr user's permissions to interact with the docker as a binded mount volume. PUID and PGID can be modified any time, this allow easy migrations and changes in host for any reason.

Persistence data is all under /app/data/configs, this must be volumed between host, path binded mount volume based or docker named volumes system. This path always keeps PUID and PGID. I think database too must be save here.

And yes, the Docker build of this image is a bit heavy task because i included homarr build process inside docker build image. Thereby anyone can do git clone of this repo and build image directly doing: docker build -t custom_homarr . Without do anything more, building and all nedded actions was written in multi step Dockerfile.

Meierschlumpf commented 5 months ago

Hi thanks for the pull request, seems a little confusing right now for me, but probably mostly knowledge issues on my side. We prefer to wait for one of our colleagues to come back from vacations so we can discuss how we move forward.

joecarl commented 5 months ago

One week ago I was about to open an issue about PUID but then I found that it is a well known issue... So I found this PR and I just wanted to thank the homarr team and @nyok1912 for this PR, this really saved me from a headache and I thought it deserverd the acknowledgement. Thanks!

nyok1912 commented 5 months ago

I have to admit that I don't fully understand every line. Have you made tests using existing data / setups to ensure that it doesn't break? Would you also be willing to assist us on the upcoming version 1.0 (which requires a new dockerfile due to changed architecture).

Of course I can help in future versions, I love this project!