xemle / home-gallery

Self-hosted open-source web gallery to view your photos and videos featuring mobile-friendly, tagging and AI powered image discovery
https://home-gallery.org
MIT License
805 stars 61 forks source link

Can't seem to get this to work when deploying. #101

Closed huntson closed 10 months ago

huntson commented 10 months ago

I've got the following for my docker-compose in stacks in Portainer

version: "3.9" services: api:

custom build via

#build: packages/api-server
image: xemle/home-gallery-api-server
environment:
  # TensorflowJS backends
  # - cpu: slowest and best support
  # - wasm: good perfromance for arm64 and amd64 platforms
  # - node: best performance on amd64 platform
  #- BACKEND=cpu
  - BACKEND=wasm
  #- BACKEND=node

gallery:

custom build via

#build: .
image: xemle/home-gallery
environment:
  - GALLERY_API_SERVER=http://api:3000
  #- GALLERY_API_SERVER_CONCURRENT=1 # On low powered devices
  #- GALLERY_API_SERVER_TIMEOUT=60 # On low powered devices
  - GALLERY_OPEN_BROWSER=false
  # Use polling for safety of possible network mounts. Try 0 to use inotify via fs.watch
  - GALLERY_WATCH_POLL_INTERVAL=300
volumes:
  - /share/CACHEDEV1_DATA/docker/homegallery/data:/data
  # Mount your media directories below /data
  - /share/CACHEDEV1_DATA/docker/homegallery/data/Pictures:/data/Pictures
ports:
  - "3010:3000"
user: "${CURRENT_USER}"
entrypoint: ['node', '/app/gallery.js']
command: ['run', 'server']

No matter what I keep getting this in the docker logs:

[2023-11-14 02:02:33.163]: cli.run error Error: Error: Configuration file /data/config/gallery.config.yml does not exist

I have attempted to manually create a gallery.config.yml and that still doesn't work.

xemle commented 10 months ago

Hi. Did you try to initialize the config as describe in the installation docs? Alternativly you can copy and modify your config from gallery.config-example.ym and edit the sources something to

sources:
  - ~/Pictures

Your base directory is /share/CACHEDEV1_DATA/docker/homegallery/data. The config needs to be added than in /share/CACHEDEV1_DATA/docker/homegallery/data/config

huntson commented 10 months ago

The subfolder of 'config' is what I was missing. Putting the .yml file I had already generated inside of that (after creating it) solved the startup issue. Now to other issues

rykou commented 7 months ago

have the same issue, just using docker compose, seems to be broken,

xemle commented 7 months ago

@rykou how is your mounted folder structure of /data? There should be a /data/config/gallery.config.yml after initialization.

If possible, please provide the log output for better analysis of your error.

rykou commented 7 months ago

@xemle Logs from the Gallexy-1 Docker

[2024-03-03 17:29:48.937]: cli.run error Error: Error: Configuration file /data/config/gallery.config.yml does not exist

its all it has,

this is the compose i use on portainer running on Raspberry pi 4

version: "3.9" services: api:

custom build via

#build: packages/api-server
image: xemle/home-gallery-api-server
environment:
  # TensorflowJS backends
  # - cpu: slowest and best support
  # - wasm: good perfromance for arm64 and amd64 platforms
  # - node: best performance on amd64 platform
  #- BACKEND=cpu
  - BACKEND=wasm
  #- BACKEND=node

gallery:

custom build via

#build: .
image: xemle/home-gallery
environment:
  - GALLERY_API_SERVER=http://api:3000
  - GALLERY_API_SERVER_CONCURRENT=1 # for SoC devices like Rasperry Pi. Use 5 otherwise
  - GALLERY_API_SERVER_TIMEOUT=60 # for SoC devices like Rasperry Pi. Use 30 otherwise
  #- GALLERY_USE_NATIVE=ffprobe,ffmpeg,vipsthumbnail # On issues with sharp resizer
  - GALLERY_OPEN_BROWSER=false
  # Use polling for safety of possible network mounts. Try 0 to use inotify via fs.watch
  - GALLERY_WATCH_POLL_INTERVAL=300
volumes:
  - ./data:/data
  # Mount your media directories below /data
  - /mnt/photos:/data/Pictures
ports:
  - "3000:3000"
user: "${CURRENT_USER}"
entrypoint: ['node', '/app/gallery.js']
command: ['run', 'server']

Screenshot 2024-03-03 173255

API server logs attached _picturemanagement-api-1_logs.txt

Enviroment : Screenshot 2024-03-03 173458

rykou commented 7 months ago

For me it seems the image from docker, is not creating the default gallery.config

xemle commented 7 months ago

Have you followed the installation instructions for docker compose?

mkdir -p data
echo "CURRENT_USER=$(id -u):$(id -g)" >> .env
docker compose run gallery run init --source /data/Pictures
docker compose up -d
rykou commented 7 months ago

Have you followed the installation instructions for docker compose?

mkdir -p data
echo "CURRENT_USER=$(id -u):$(id -g)" >> .env
docker compose run gallery run init --source /data/Pictures
docker compose up -d

Hi,

These instructions are very vague, where should i run this? inside the docker after i have used the compose, or outside (but there is already a data folder on the linux root,

After that, docker compose run gallery run init --source /data/Pictures This is supposed to run at the docker is "gallery" something that is supposed to exist by just using the Compose or should we be using the Container ID instead,

also --source /data/Picture does not exist in the root system (nor inside the container)

please can you be more clear on these documentation? or maybe setup in a way that the compose is enough

xemle commented 7 months ago

@rykou thank you for your comment. Have you checked the documentation as described above?

The gallery.config.yml states regarding the mounted volumes that you should mount your media files from your host to the corresponding folder in the container:

    volumes:
      - ./data:/data
      # Mount your media directories below /data
      - ${HOME}/Pictures:/data/Pictures

The assumption for the example is that your host directory ${HOME}/Pictures is mounted to /data/Pictures in the gallery container. The real folder names needs to be adopted for your settings and than also for your initialization call of docker compose run gallery run init --source /data/Pictures.

Hope that helps further. I am not aware of Azure Cloud and how the docker compose commands should be mapped to your cloud provider. If you like we can have a 1-2-1 shared session...

inuonly commented 3 weeks ago

@rykou thank you for your comment. Have you checked the documentation as described above?

The gallery.config.yml states regarding the mounted volumes that you should mount your media files from your host to the corresponding folder in the container:

    volumes:
      - ./data:/data
      # Mount your media directories below /data
      - ${HOME}/Pictures:/data/Pictures

The assumption for the example is that your host directory ${HOME}/Pictures is mounted to /data/Pictures in the gallery container. The real folder names needs to be adopted for your settings and than also for your initialization call of docker compose run gallery run init --source /data/Pictures.

Hope that helps further. I am not aware of Azure Cloud and how the docker compose commands should be mapped to your cloud provider. If you like we can have a 1-2-1 shared session...

With reading all the instruction I understood there is a process to do because I am getting same error. So there is some extra stepo unfortunately in docker compose example file there si no such way to know what is to be done . The aboev command you are trying to say to fire is supposed to be fired on cli and the same is not reflected in the documentation of the docker compose instructions as well as compose file. I think the confusion is you are trying to ask people to fire a cli command while peopel are using compose file ( in my case I am ) resulting in this error . Updating the compose file with respective comand included in there should fix this. However I am not a programmer just a user so you know it better. I though how we reach this situation is an important thign to know before approaching for any fix. I simply used docker compose file mounted columes as per the instruction but ddidn't know how to implement that command ( using portainer stacking method so using only compose file in ui) unless I searched online what was wrong and ended up being here. I will try to fire the command in cli but that defeats the whole purpose of having a compose file in the forst place . A better instruction on steps for separate methods could help. I am kind of in the middle to search online on how to implement the command in the compose file itself but you might know it better and correct way to do so .

Hope my experienmce helps solve the cause of this issue. And yes this issue still persists unless you dont mix the instructions for command line as well as compose methods together and you need to know docker compose in detail as a user to sort the error. Disclaimer : english is not my native language so sorry in advance for bad choice of words if any i hope this does not affect the actual logic or point i am trying to convery here, Good Luck!

xemle commented 3 weeks ago

Hi @inuonly

thank you for your detailed response and your concerns. HomeGallery is an open source project and relies on feedback, discussions and contributions.

It is also a spare time project and exists for fun. Therefore the time is limited and it is quite hard to find the right end user level. My assumption is, that there are some basic understanding how some stuff is working like docker and docker compose. So the basic usage of docker and docker compose is out of scope of the documentation. (But of cause, it can be added if someone is contribute it via a PR).

The documentation should provide enough hints how to run it with docker compose. Other environments like portainer or proxmox. While the usage should be quite similar, it is not covered in the documentation. It is not covered be cause I am not using it and no one contributed a installation guide so far.

I try to answer as best as I can and try to understand the issue here. If you bring some time and patient we can try to find a solution to get the gallery running on your side. But at the moment I do not know where to start with the help.

Are there issues running portainer in general? Do you have an understanding how to run compose files in portainer? Do you know how to mount volumes? Maybe we should clarify your issue in a real-time session via discord?

The basic idea is that the HomeGallery container ships the software and needs to read your images and will serve you a gallery. The access and reading of your files is done via volumes. The documentation tells that in following lines about the compose.yml files

    volumes:
      - ./data:/data
      # Mount your media directories below /data
      - ${HOME}/Pictures:/data/Pictures

So your local path ${HOME}/Pictures is mapped to the container path /data/Pictures. ${HOME}/Pictures needs to be adjusted to your needs and your local disk layout.

Then the gallery needs to be configured and needs to know where your images are located. Which is done via

docker compose run gallery run init --source /data/Pictures

So this instruction calls the CLI (which is docker compose run gallery for docker compose setups) with the arguments run init --source /data/Pictures where /data/Pictures is the mapped volume inside the container which is at the end your local ${HOME}/Pictures directory. This is also only an example and you might have several volumes and you can adjust it to your local setting or your container volume paths.

If any questions are still open, please do not hesitate to ask your questions in discord and we can agree on some date and times to solve your issues. Then it is also easier to find the right level of abstraction and to spot your issue.

inuonly commented 3 weeks ago

Sure I understand that. First of all thank you that such a thing even exist because of the time and effort by everyone contributing. I do run around 40 to 50 containers. So yeah that should solve most of the doubts above. I will try to rephrase : The command docker compose run gallery run init --source /data/Pictures

mentioned in the docuemntation - https://docs.home-gallery.org/install/index.html#docker-compose image

So when we are in the workign directory where we have compose file and we issue docker compose up -d that is where I wanted to add the command run init --source /data/Pictures .

So doing compose up -d does not run init and to run init comadn (this is my limited knowledge) i think i have seen a way to add that to docker compose file itself. And that as what I was tryin to say if that is added might solve the config not found issue showing in portainer logs of docker container. I also did not know that such a small change needs a separate PR if that is just a line to be added in compose yaml file. I am also trying to learn stuff mentined above ( cmd in config chaging docker container raising PR , searchign and learning.) So if by any chance I could help I would do the needful as you instructed.

Will try to join discord too if that is of any use. I mean I am not a programmer so I don't know how could I help the team in any way but hey whats to lose.

TLDR : Don't bother much I was trying to help. I guess I am not much of a help as of now. Am on my path. If this was not useful or helpful in any way, then please accept my apologies. Have a good one ahead. <3

xemle commented 3 weeks ago

@inuonly

Thank you for your reply.

i have seen a way to add that to docker compose file itself. And that as what I was tryin to say if that is added might solve the config not found issue showing in portainer logs of docker container

Do I understand you correctly that it would be a help for you if the quickstart section is:

mkdir -p gallery/data
cd gallery
# copy and adjust compose.yml from above
echo "CURRENT_USER=$(id -u):$(id -g)" >> .env
docker compose run gallery run init --source /data/Pictures
docker compose up -d

Please continue to ask questions for clarifications. It is just complex to cover every usecase. And with your help we can fix one of them.

inuonly commented 3 weeks ago

Thank you. The problem was with my file permissions. Thanks for your help and support and time.

xemle commented 2 weeks ago

@inuonly Can we close this issue?

inuonly commented 2 weeks ago

I think there is some glitch. At my side it still shows closed. But yes please close the issue. Once again thanks for your help. Have a good day!

xemle commented 2 weeks ago

@inuonly you are right. My fault