immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
51.64k stars 2.73k forks source link

[Feature] Unraid Community / All-Inclusive Image #84

Closed alextran1502 closed 1 year ago

alextran1502 commented 2 years ago

Feature Details:

Follow the guide here for steps to create the required XML files for unraid.

bo0tzz commented 2 years ago

What is going to happen if I follow Immich guide and point it at a directory already full of existing photos and media?

Nothing, you need to give Immich an empty directory to work with and upload files via the API. There is an open issue for what you're looking for: #34. If you need to do a bulk import you can use the CLI https://github.com/immich-app/cli

MattFaz commented 2 years ago

@blaine07

So I have been using a different app on my phone to upload photos to Unraid forever. What is going to happen if I follow Immich guide and point it at a directory already full of existing photos and media?

It won't pick them up (someone please correct me if I am wrong), if you'd rather not re-upload via your mobile an alternative is to copy the images from Unraid to your PC and upload via the WebUI as shown in the image below.

image

sohail579 commented 2 years ago

not sure I got this.. you still havent said anywhere to use a file location in appdata, isnt is as simple as replacing pgdata with a location in the appdata folder?

bo0tzz commented 2 years ago

That should also work, yes.

sohail579 commented 2 years ago

That should also work, yes.

would that need to be everywhere where it says pgdata or do you just create it as a variable in the env file?

bo0tzz commented 2 years ago

Just this line, you would replace it with something like - /mnt/user/appdata/immich:/var/lib/postgresql/data.

sohail579 commented 2 years ago

what about the last 2 lins? it also makes a reference to pgdata there wouldnt that also need to be the same?

bo0tzz commented 2 years ago

The

volumes:
  pgdata:

instructs Docker to create the pgdata volume. If you're not using it, you can remove that part, but leaving it won't do any harm.

sohail579 commented 2 years ago

The

volumes:
  pgdata:

instructs Docker to create the pgdata volume. If you're not using it, you can remove that part, but leaving it won't do any harm.

got you thanks I thought it was trying to mount the volume :)

blaine07 commented 2 years ago

I'm sorry could you share your .env and .yaml files? For the life of me, I can't get it working on unraid.

I got it working the other day so quickly put a rough guide online to help others: https://mfaz.dev/posts/immich-unraid/

Pardon my idiocracy, but how do I update everything once it's setup? I do have it working but... curious?

Thanks

blaine07 commented 2 years ago

Also, with docker compose plugin installed on Unraid is it normal for it to say this at bottom of the docker tab:

Invalid argument supplied for foreach() in /usr/local/emhttp/plugins/compose.manager/php/compose_manager_main.php on line 32

blaine07 commented 2 years ago

Are those of you who have followed the Unraid Guide seeing this, below, spamming your syslogs since Immich was installed?

Screen Shot 2022-10-23 at 9 14 59 AM

blaine07 commented 2 years ago

Screen Shot 2022-10-23 at 9 31 50 AM Is it possibly because this Machine-Learning 1 is continuing to restart/bootloop?

blaine07 commented 2 years ago

I disable JUST that container and Syslog spam stops in Unraid; I just have no idea how important it is that piece runs nor how to fix just that piece? Is there anything I can do or?

alextran1502 commented 2 years ago

Screen Shot 2022-10-23 at 9 31 50 AM

Is it possibly because this Machine-Learning 1 is continuing to restart/bootloop?

Yes looks like your machine cannot run the Machine Learning container

blaine07 commented 2 years ago

Screen Shot 2022-10-23 at 9 31 50 AM Is it possibly because this Machine-Learning 1 is continuing to restart/bootloop?

Yes looks like your machine cannot run the Machine Learning container

So what can I do and how can I fix it? It's a old-ish Dell T610 server, FWIW

blaine07 commented 2 years ago

Google says my Dell T610 doesn't have AVX support; so thats probably the reason my machine learning portion won't stay running: https://github.com/immich-app/immich/discussions/300

Still not sure of the side effects of it not running or if that will cause me other issues. Also still unsure if docker compose plugin installed on Unraid if it is normal for it to say this at bottom of the docker tab:

Invalid argument supplied for foreach() in /usr/local/emhttp/plugins/compose.manager/php/compose_manager_main.php on line 32

martabal commented 2 years ago

Wouldn't it be better to use environment variables rather than using hardcoded urls ? This would allow for a single image and users to rename their containers as they wish. #647

https://github.com/immich-app/immich/blob/2c189d5c78fa35e9f235b134f47765ac1b71b8b3/server/apps/microservices/src/processors/machine-learning.processor.ts#L23

https://github.com/immich-app/immich/blob/2c189d5c78fa35e9f235b134f47765ac1b71b8b3/server/apps/microservices/src/processors/machine-learning.processor.ts#L43

https://github.com/immich-app/immich/blob/2c189d5c78fa35e9f235b134f47765ac1b71b8b3/web/src/api/api.ts#L48

https://github.com/immich-app/immich/blob/2c189d5c78fa35e9f235b134f47765ac1b71b8b3/nginx/nginx.conf#L65

https://github.com/immich-app/immich/blob/2c189d5c78fa35e9f235b134f47765ac1b71b8b3/nginx/nginx.conf#L90

blaine07 commented 2 years ago

Every single time in Unraid I "docker compose down" then "Update Stack" MORE of my Docker Image is full. How can I "clean up" after this configuration? @Mattyfaz ? Anyone?

bo0tzz commented 2 years ago

https://docs.docker.com/engine/reference/commandline/system_prune/ should do the trick.

blaine07 commented 2 years ago

https://docs.docker.com/engine/reference/commandline/system_prune/ should do the trick.

That will work in Unraid?

blaine07 commented 2 years ago

https://docs.docker.com/engine/reference/commandline/system_prune/ should do the trick.

I ran it; eventually the unraid command window wen't away. Didn't see that it did anything; docker image still larger than expected?

Did it from ssh and it deleted 284mb :scratches head:

Yep, that was a bad idea; deleted containers I had that weren't running...a few I can't seem to get recreated right. DOH LOL

MattFaz commented 2 years ago

Every single time in Unraid I "docker compose down" then "Update Stack" MORE of my Docker Image is full. How can I "clean up" after this configuration? @Mattyfaz ? Anyone?

Not sure sorry, I don’t think I have the same issue. I don’t click “docker compose down”, I just click “update stack” and it does it all for you.

sohail579 commented 2 years ago

Every single time in Unraid I "docker compose down" then "Update Stack" MORE of my Docker Image is full. How can I "clean up" after this configuration? @Mattyfaz ? Anyone?

Install user scripts and create this as a script it will remove any dangling images

!/bin/bash

remove_orphaned_images="yes" # select "yes" or "no" to remove any orphaned images remove_unconnected_volumes="yes" # select "yes" or "no" to remove any unconnected volumes

Do not make changes below this line

echo "##################################################################################" echo "Cleanup before starting (if requested in script)" echo "##################################################################################" echo if [ "$remove_orphaned_images" == "yes" ] ; then echo "Removing orphaned images..." echo docker image prune -af else echo "Not removing orphaned images (this can be set in script if you want to)" fi echo echo "---------------------------------------------------------------------------------" echo if [ "$remove_unconnected_volumes" == "yes" ] ; then echo "Removing unconnected docker volumes" echo docker volume prune -f else echo "Not removing unconnected docker volumes (this can be set in script if you want to)" fi echo echo "##################################################################################" echo "List of Image, Container and docker volume size." echo "##################################################################################" echo

docker system df

docker system df --format 'There are \t {{.TotalCount}} \t {{.Type}} \t taking up ......{{.Size}}' echo echo "##################################################################################" echo "List of containers showing size and virtual size" echo "##################################################################################" echo echo "First size is the writable layers of the container (Virtual size is writable and read only layers)" echo docker container ls -a --format '{{.Size}} \t Is being taken up by ......... {{.Image}}' echo echo "##################################################################################" echo "List of containers in size order" echo "##################################################################################" echo docker image ls --format "{{.Repository}} {{.Size}}" | \ awk '{if ($2~/GB/) print substr($2, 1, length($2)-2) *1000 "MB - " $1 ; else print $2 " - " $1 }' | \ sed '/^0/d' | \ sort -nr echo echo "##################################################################################" echo "List of docker volumes, the container which they are connected to their size" echo "##################################################################################" echo volumes=$(docker volume ls --format '{{.Name}}') for volume in $volumes do name=(docker ps -a --filter volume="$volume" --format '{{.Names}}' | sed 's/^/ /') size=(du -sh $(docker volume inspect --format '{{ .Mountpoint }}' $volume) | cut -f -1) echo "ID" "$volume" echo "This volume connected to" $name "has a size of" $size echo "" done echo echo "##################################################################################" echo echo "Done. Scroll up to view results" exit

Enlinks commented 1 year ago

Not sure if this has been discussed but there are other templates (at least 1 I know of) like TubeArchivist that require multiple dockers to work correctly that currently work with the Unraid Community Applications Plugin. Would this approach be more appropriate?

bo0tzz commented 1 year ago

It looks like TubeArchivist doesn't do anything special, they just have a template for each of their containers. At that point, docker-compose is still the better option :)

alexbelgium commented 1 year ago

I second the request, a single container for all elements would be great! I am managing Home Assistant addons, which is not compatible with stacks of several containers.

bo0tzz commented 1 year ago

There is now a single AIO image at https://github.com/martabal/docker-immich. It isn't supported by the Immich team though.

SmoochSmackers commented 1 year ago

Sorry if this is a silly question, but since you closed this issue, does this mean that there will never be an official AIO Immich image? Only the third party one you linked to?

My number one issue right now, as an extremely novice self-hoster, is the way that I have to use docker compose on my Unraid machine to use it. The three issues I have with this is that: 1.) It spins up 5 separate containers. 2.) I cannot mass update it along with the rest of my docker containers and have to keep an eye on the github page for any new releases. 3.) I think that not having a single image available in Unraid's Community App store creates an artificial hurtle that limits Immich's reach. It took quite a lot of time, and build up of frustration with other photo hosting apps, to finally push me to learn how to use docker compose. I feel there are many like me out there, but with less time on their hands, who are not ready to take the plunge. It's a matter of getting more users/supporters by lowering the bar to entry.

To be clear, I'm not writing this in anger or frustration. To the contrary! I absolutely love this software and understand the ungodly amount of work you all must have in front of you, tackling such a project! I just wanted to give my perspective as a newbie trying their darndest to rip as many of Google's tendrils from my life as possible and taking back control of my data.

Thank you all for your amazing work, I've been looking for a solid google photos replacement for years now. From my experience trying to self-host Photoview, Photoprism, etc., Immich is far and away the best one I've come across, the only one that truly has a google photos-like experience with the mobile app, and the only one that has runs rock solid with almost no issues with its core functionalites. In fact, I love this project so much that I created a github account to better follow your progress and so that I could donate.

alextran1502 commented 1 year ago

@SmoochSmackers Thank you for your very detailed thoughts and ideas. On behalf of the team, I will answer your questions.

  1. When I first started building Immich, I structure the app to be microservices and make them scalable. In order to scale with Docker, you either need Docker Swarm or a simpler and straightforward approach is to use Docker Compose. The number of containers is the number of underlying technology you need for the solution to work. If you are a Windows user, and you install software that required a database, it will install the database as well, but the services are often hidden from your eyes so you don't notice them. With self-hosting, you install every yourself and you know exactly what technologies are required to run, so it might take some time to get used to. Lastly, the point of us not building the all-in-one solution is the level of maintenance and complexity involved that we don't have the resources to spare. We rather use it to develop and maintain the core functionality of the application.
  2. Immich is still under active development, so I encourage you not to rely on an auto-updating tool but to update the Docker's containers manually after reading the Release notes in cases there are breaking changes that need user involvement to perform a successful update
  3. As you can see that the motion of self-hosting solutions is moving toward Docker and containers more and more. And it is a learning experience for us all, you start off with the convenience of running your services from a click of a button, then eventually your needs grow and you want to be able to control, configure, and understand how the underlying technology that you run the services you are most depended on work. So there is no harm in trying to learn and to know more about those information/technologies. I would encourage all self-hosters to do that for the sake of securing their data/resources. We provide information to run and set up Immich on Unraid so it takes some learning but I think it will be worthwhile for all parties involved.

Cheer!

jrasm91 commented 1 year ago

Updated the immich docs to link to the community all-in-one github repository (#1301).

https://immich.app/docs/install/all-in-one

SmoochSmackers commented 1 year ago

@alextran1502 Thank you very much for your detailed reply! In regards to the Windows comparison, I'd honestly never thought of it in terms of everything an exe is doing in the background, so it makes a lot of sense that multiple containers would be a necessity. Regardless of how you need to do it, I'm just glad you're doing it!

Just spit-balling, but maybe, way down the line when you're not in active pre-production development, you could maybe revisit this, or even somehow put all the different containers on the unraid app store, such that one is a "core" for basic photo backup, another serves as an addon for utilizing the mobile app, another serves as an addon for machine learning, etc. No idea how possible any of that is, but I just wanted to throw it out there for consideration much later down the line.

Keep up the incredible work!! Thanks again!

martabal commented 1 year ago

Hello ! Do you want that I maintain the all-in-one Dockerfile on a separate repo or do you want me to create a pull request ?

jrasm91 commented 1 year ago

I think we're good with you keeping it in a separate repo for now. We just get the occasional question about it, so now everyone will know to go ask you instead. 😁

guim31 commented 1 year ago

@martabal do you think you could provide an unraid template ? I don't really know how your image could land on Unraid's community software... maybe it should be requested idk. I know that everything could be working right know as it is, but like many other Unraid user, I use this system because of the simplicity to install Docker containers with just few clicks.

Thanks a lot for your work, and THANKS a lot @alextran1502

jagjordi commented 1 year ago

Would it be possible to migrate from the normal docker-compose setup to the all-in-one docker preserving the database and uploaded pictures?

jrasm91 commented 1 year ago

Would it be possible to migrate from the normal docker-compose setup to the all-in-one docker preserving the database and uploaded pictures?

Immich persists data to the upload folder and postgres data volumes. As long as you start up the AIO with those same two volumes it should be possible.

martabal commented 1 year ago

@guim31 Yep, I plan to do it this week. But you can already install it on unraid manually.

martabal commented 1 year ago

@jrasm91 Is it ok that my image is published on unraid community apps ?

jrasm91 commented 1 year ago

I don't have a problem with it, just as long as it's clear it's not officially supported by Immich dev team and they should ask you question if they run into issues 😁