RushLana
Hi again.
If you want to use another drive/folder for the galleries folder in piwigo you can edit the compose.yaml file and add another bind-mount in the volumes section of piwigo-main.
Assuming you have an external hard drive mounted at /mnt/ExternalHDD and you want to use the folder /mnt/ExternalHDD/MyPhotos as a galleries folder you can do the following : (please manually edit your compose)
networks:
piwigo-network:
external: false
services:
piwigo-main:
image: piwigo/piwigo:latest
restart: always
environment:
- TZ=${timezone}
networks:
- piwigo-network
ports:
- ${piwigo_port}:80
depends_on:
- piwigo-db
volumes:
- ./piwigo-data/piwigo:/var/www/html/piwigo/
- ./piwigo-data/scripts:/usr/local/bin/scripts/
- /mnt/ExternalHDD/MyPhotos:/var/www/html/piwigo/galleries
piwigo-db:
image: docker.io/library/mariadb:lts
restart: always
environment:
- MARIADB_RANDOM_ROOT_PASSWORD=true
- MARIADB_USER=piwigodb_user
- MARIADB_DATABASE=piwigodb
# Defined in .env
- MARIADB_PASSWORD=${db_user_password}
- TZ=${timezone}
networks:
- piwigo-network
volumes:
- ./piwigo-data/mysql:/var/lib/mysql
Anne-FORUM-PiWigo
Hi RushLana, I did what you are suggesting and yes it allowed piwigo to access the HD, HOWEVER, it borked up piwigo ,, all kinds of stuff broke, like the admin button in the upper right corner failed with a divide by zero error, and the addon to synchronize no longer worked, could not access files, and a bunch of other things... I had to reinstall piwigo to get things fixed... However, I will try it again this weekend or sooner if I get the chance..
Anne
RushLana
Hi,
Can you open an issue here ?
https://github.com/Piwigo/piwigo-docker/issues
I didn't encounter any issue when using an USB key during my testing.
Anne-FORUM-PiWigo
hi again..
2 Questions...
1. Can Piwigo (docker) use BOTH a local drive folder AND a ext drive folder, as the "galleries" folder ,,, at the same time ?
2. Can Piwigo (docker) use local drive folder "A" AND local drive drive folder "B", as the "galleries" folder, at the same time ?
OR,, can there only be (1) "galleries" folder location in use at one time ?
As to your request to create a ticket,
I will reinstall Piwigo (docker) once again from scratch to make sure "I" didn't mess up something trying to get things up and running with the external drive and folder,, and then create the report if it fails the same way again...
Anne
Anne-FORUM-PiWigo
RushLana...... Got the chance to remove everything associated with Piwigo today, and then totally re-install the program... No more divide by zero errors...... or any of the other quirky things and errors I was getting before.... This new install pulled the 16.3.0c (Docker),... maybe something there,, or maybe I just made an error in the the things I tried when I was trying to get the external drive function to work .. BTW,,I had to add the galleries folder back to the path you posted to get it to work,, ,,,,,, /mnt/ExternalHDD/MyPhotos/galleries:/var/www/html/piwigo/galleries ... Is that OK, or am I getting it to work by doing something wrong ???
RushLana
Hi Anne,
To answer your previous question, yes you can use an alternative folder to the "galleries" folder, it work exactly like it would on a non docker install.
The path I propose is an example, you should use the path where you external hard drive is.
You can find the exact path to your external HDD using lsblk or findmnt and may need to add rules in fstab to automount your drive.
Anne-FORUM-PiWigo
RushLana, Thanks for the reply...
Really important question for my unique use of Piwigo.....
Can two (2) locations be used at the same time for the galleries folder,, ie.,
home/anne/Piwigo/piwigo-data/piwigo/galleries AND
home/anne/videos/old-training-videos/galleries
Situation,,
first location files on laptop install,
second location on another device
first location, files needed by all everyday are on laptop install,
second location, files on a different device, files used rarely
Hope this makes some sense of what I am trying to do....
RushLana
Hi, you can probably use a subfolder
volumes:
- ./piwigo-data/piwigo:/var/www/html/piwigo/
- home/anne/Piwigo/piwigo-data/piwigo/galleries:/var/www/html/piwigo/galleries
- home/anne/videos/old-training-videos/galleries:/var/www/html/piwigo/galleries/Old-Training-Video
- ./piwigo-data/scripts:/usr/local/bin/scripts/
it should work, if I have the time I can do more testing but I have more pressing issues to fix first.
Anne-FORUM-PiWigo
Hi RushLana,
I have been testing adding other locations to the galleries folder, and I can not get it to work with 2 locations..
Every time I add another location, the location added becomes the only location detected, with all its files and folders,,
Did you have any success with your testing ??
Anne
RushLana
Hi Anne,
I did a lot of testing today and couldn't reproduce your issue.
Can you send your compose.yaml ?
Mine for reference :
services:
piwigo-main:
image: piwigo/piwigo:latest
restart: always
environment:
- TZ=${timezone}
- PIWIGO_UID=${PIWIGO_UID}
- PIWIGO_GID=${PIWIGO_GID}
networks:
- piwigo-network
ports:
- ${piwigo_port}:80
depends_on:
- piwigo-db
volumes:
- ./piwigo-data/piwigo:/var/www/html/piwigo/
- ./galleries:/var/www/html/piwigo/galleries
- ./subgallery:/var/www/html/piwigo/galleries/subgal
- ./piwigo-data/scripts:/usr/local/bin/scripts/
Keep in mind that the order is important, the parent folder should be before the sub-folder.
Anne-FORUM-PiWigo
Hi RushLana,
Been extra busy, but I finally got time to send you the compose file....
Thanks for helping...
The compose file below makes media in /home/anne/Piwigo/xx/galleries:/var/www/html/piwigo/galleries the ONLY source
Each of the commented out lines, when added, make that location the ONLY location recognized for media
networks:
piwigo-network:
external: false
services:
piwigo-main:
image: piwigo/piwigo:latest
restart: always
environment:
- TZ=${timezone}
networks:
- piwigo-network
ports:
- ${piwigo_port}:80
depends_on:
- piwigo-db
volumes:
- ./piwigo-data/piwigo:/var/www/html/piwigo/
- ./piwigo-data/scripts:/usr/local/bin/scripts/
- /home/anne/Piwigo/xx/galleries:/var/www/html/piwigo/galleries
# - /mnt/12TB_Ext/PiwigoPhotos/galleries:/var/www/html/piwigo/galleries
# - /mnt/12TB_Ext/PiwigoMEDIA/galleries:/var/www/html/piwigo/galleries
piwigo-db:
image: docker.io/library/mariadb:lts
restart: always
environment:
- MARIADB_RANDOM_ROOT_PASSWORD=true
- MARIADB_USER=piwigodb_user
- MARIADB_DATABASE=piwigodb
# Defined in .env
- MARIADB_PASSWORD=${db_user_password}
- TZ=${timezone}
networks:
- piwigo-network
volumes:
- ./piwigo-data/mysql:/var/lib/mysql
RushLana
Hi, anne.
I see the issue.
Docker uses bind-mounts to link directories, that mean only one directory can be mapped to another and only the last one matters.
You can't "merge" directories.
The best solution for you should be to use sub-folders, just append after /var/www/html/piwigo/galleries the name of the subfolder you want to use like I did in my previous comment ( see the subgalleries line ).
Anne-FORUM-PiWigo
Hi RushLana,
OK, I guess I do not understand docker stuff enough,,, I do not know the why and how to get this to work.... I tried....
Could you please explain how your code works with an example..
.
Using two locations,, the first being the standard piwigo galleries location,
home-anne-Piwigo-piwigo-data-galleries, where galleries contains the album folders and the pics are in the album folders
and a second location ,,
home-anne-piwigomedia-galleries, where galleries contains the album folders and the pics are in the album folders
I can get either location to work but not oth at the same time AND when I switch locations, piwigo deletes the prior location data,, ( does not delete the actual data)
I am trying to learn, so if you would please explain the why and how of things
Thanks
Anne
RushLana
Hi,
This not something that is only applied with docker but how mounting drives on Linux works.
When you had a volume field in your compose file, your system map a directory to another inside the container.
Let's take ./piwigo-data/piwigo:/var/www/html/piwigo/ for example.
It maps /piwigo-data/piwigo in your system to the target /var/www/html/piwigo/ inside the container.
The limitation is that you cannot map to the same target; if you try to, the system will only pick the latest directory.
To show how that works with an example :
I have Piwigo installed in my home folder, /home/lana/piwigo-data
I have an external hard drive mounted at /mnt/extHDD with 2 folders inside: "Family-Photos" and "Landscapes"
I want to mount my Pictures folder and the two folders in extHDD in the galleries folder inside piwigo-data so I edit my compose file to add those folders without having the same destination folder:
(Lines with # are comments)
volumes:
- ./piwigo-data/piwigo:/var/www/html/piwigo/
- ./piwigo-data/scripts:/usr/local/bin/scripts/
# I mount my Pictures folder as a galleries folder
- /home/lana/Pictures/:/var/www/html/piwigo/galleries
# I mount the external folders as sub-folders of the galleries folder
- /mnt/extHDD/Familly-Photos/:/var/www/html/piwigo/galleries/Familly-Photos/
- /mnt/extHDD/Landscapes/:/var/www/html/piwigo/galleries/Landscapes/
Anne-FORUM-PiWigo
RushLana, --- THANK YOU !!!
I followed your example and I can use multiple locations !!!
NOW,,,, for the elephant in the room question.......
Why with basic install can piwigo find the galleries folder and the sub-folders and pictures inside the sub-folders ???
1st location -- /home/anne/Piwigo/piwigo-data/galleries/folder1/pictures-ABC.jpg
You have ,,,
volumes:
- ./piwigo-data/piwigo:/var/www/html/piwigo/
- ./piwigo-data/scripts:/usr/local/bin/scripts/
AND ------ piwigo finds and displays the data in the galleries folder.....
--- SO --- ,,,,, why when I add a 2nd location - /home/anne/Piwigo-media/:/var/www/html/piwigo/galleries
does piwigo only find the newly added 2nd location...... and deletes the data from the 1st location ????
----BUT, -- ,,,,,, if I add a 3rd location,
volumes:
- ./piwigo-data/piwigo:/var/www/html/piwigo/ 1st. the Galleries Folder, sub-folders and pictures in sub-folders
- ./piwigo-data/scripts:/usr/local/bin/scripts/
- /home/anne/Piwigo-media/:/var/www/html/piwigo/galleries ADD 2nd, ONLY this location shows,, deletes data from 1st
- /home/anne/Pictures/:/var/www/html/piwigo/galleries/Pictures/ ADD 3rd, now 2 and 3 display, 1st still does not
Having BOTH the 2nd & 3rd locations show up,,,, is GREAT !!
BUT------
the ORIGINAL location /home/anne/Piwigo/piwigo-data/galleries/folder1/pictures-ABC.jpg
still does NOT show up......
I can certainly work around the 1st original location not showing by just adding another location, and move the data from location 1, to the new location.
I hope all this description makes sense to you..... All this is because I really would like to know and understand WHY the original location 1, works great IF that location is the only location,,,, does not work when other locations are added....
THANK YOU
for all your guidance in getting this to work...
and I understand if you do not have time to "school" this old lady in docker stuff.... :-)
Anne
RushLana
Hi,
I'm not sure I get everything but I will try to explain :
When you mount a directory its content are hidden to make place for the content in the mounted directory.
For example :
I have two directories named Folder1 and Folder2 in /home/lana like this :
/home/lana/Folder1 contain a file name file.txt
/home/lana/Folder2 contain a image named img.png
If I mount Folder2 into Folder1 (/home/lana/Folder2:/home/lana/Folder1) it will "hide" the content of Folder1 and I will only be able to see img.png.
If I want to access content from Folder2 in Folder1 I should mount it in a sub-directory of Folder1 like this :
/home/lana/Folder2:/home/lana/Folder1/folder2
In your case if you want to preserve the original galleries folder and add other folders into it you should map them to sub-folders.