immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
51.09k stars 2.7k 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.

JamesTeague commented 2 years ago

Is there an existing Docker image on Docker Hub already or would one need to get it into a registry?

JamesTeague commented 2 years ago

Also there seems to be a dependency on Postgres running in port 5432. Did I read that right? If so, that port should probably be configurable defaulting to 5432.

alextran1502 commented 2 years ago

@JamesTeague There is no image that contains the whole application yet. I am working on the branch deployment/containerize-app-into-single-dockerfile to accomplish that goal.

It is correct that the Postgres port is 5432. You can access it on your local machine as well as throughout your local network with the VM IPV4

JamesTeague commented 2 years ago

@alextran1502 Regarding the port that is true, but there will be people running Postgres in a container not using port 5432. It's generally not a good assumption that the database will be exposed on that port. So in the case of Unraid it would help users to know that this template requires their own postées instance but it shouldn't also dictate the port they have to expose on the container. Or if for some reason they are running multiple instances of the database, 1 has to be running on a different port.

Once the container is in the registry though I wouldn't mind helping get the template set up and tested. Or trying to contribute on other things as well.

Kjeldgaard commented 2 years ago

@JamesTeague There is no image that contains the whole application yet. I am working on the branch deployment/containerize-app-into-single-dockerfile to accomplish that goal.

Isn't the immich image sufficient if using an existing database?

alextran1502 commented 2 years ago

@JamesTeague There is no image that contains the whole application yet. I am working on the branch deployment/containerize-app-into-single-dockerfile to accomplish that goal.

Isn't the immich image sufficient if using an existing database?

There is a message queue that utilizes Redis for passing the message across the background processes, so you would need Redis as well.

Now that I am adding a web interface that is using SvelteKit, which has its own built-in Nodejs server, this adds an additional complexity to the process of putting everything into a single Docker image.

Kjeldgaard commented 2 years ago

I actually already have Redis up and running, but how should that be configured? According to 'Step 1' from https://github.com/alextran1502/immich, there is only the database configuration.

JamesTeague commented 2 years ago

@JamesTeague There is no image that contains the whole application yet. I am working on the branch deployment/containerize-app-into-single-dockerfile to accomplish that goal.

Isn't the immich image sufficient if using an existing database?

I think so, most people probably want to decouple that and Redis anyway.

martabal commented 2 years ago

@JamesTeague There is no image that contains the whole application yet. I am working on the branch deployment/containerize-app-into-single-dockerfile to accomplish that goal.

The branch doesn't exist anymore. It would be very nice to have a single container to deploy. I already have postgres and redis dockers running and don't want to deploy other instances.

zackpollard commented 2 years ago

You can use environment variables to point your Immich services at your existing redis and postgres containers, check the .env file

martabal commented 2 years ago

Is it possible to get rid of the .env file and to use only the environment variables ? It would allow to run the services with docker run

bo0tzz commented 2 years ago

Sure, you can skip the .env file and pass the variables in any other way you like.

martabal commented 2 years ago

For now Immich works with Unraid with the docker-compose plugin but in my understanding to run with the docker run command, it would be easier to integrate the entrypoint in the Dockerfile. Is there any particular reason to put it outside the file?

Nonobis commented 2 years ago

yes the custom entrypoint is the main problem .. in my case, even in advanced docker mode in unraid i don't see where to put the custom entrypoint for each image.

martabal commented 2 years ago

There is the --entrypoint argument but it is for overwriting the default entrypoint of the image. But there is no entrypoint by default in the images. So it is currently impossible to run Immich images with docker run

bo0tzz commented 2 years ago

The images are built on top of the node base image, so there is a default entrypoint defined that you can override. A command like docker run --entrypoint /bin/sh altran1502/immich-server:release ./start-server.sh works just fine (it doesn't have the necessary config, but it will start the right executable). That said, I agree that having entrypoints defined in the images is nicer, and I've suggested it to the team.

martabal commented 2 years ago

For a release on Unraid, it would be a lot better to avoid arguments other than path, device, port or environment variable. Other arguments has to be passed with the extra-parameters field which is not very user-friendly. And of course to have only one image.

guim31 commented 2 years ago

Sorry for my useless message but I have to say I would really love ab easy unraid install !!!

martabal commented 2 years ago

I managed to install altran1502/immich-server:release on Unraid without docker-compose. But for now there is too many images to publish it for Unraid community. Another thing I noticed with my install is that I created a specific user on Postgres to Immich but it didn't work, I had to pass the default postgres user to work.

guim31 commented 2 years ago

Thanks @martabal for your feedback. I hope someone with some Docker skills could merge all those images in one !

martabal commented 2 years ago

No problem, I will try to merge the images next week

blaine07 commented 2 years ago

No problem, I will try to merge the images next week

You’d be a hero here. Looking forward to this! :-)

dsfsdbvxc commented 2 years ago

No problem, I will try to merge the images next week

Yea thanks, keen to give this a go :)

dhruvinsh commented 2 years ago

I managed to install altran1502/immich-server:release on Unraid without docker-compose

@martabal how did manage to override the entrypoint? unraid webpage Extra Parameters doesn't seems to help Edit: Nevermind I got it working, I needed to use "Post Argument" commnad

ark- commented 2 years ago

Would we need to install a bunch of individual "apps" (containers) one by one to get this working on unraid without docker-compose? It looks like there's 7 containers, is that right?

I'm hesitant to use compose on unraid as it doesn't play well with their Web UI and that is my primary interface to the server.

bo0tzz commented 2 years ago

Currently, yes, you would need to set up the individual containers manually. For Redis and Postgres you could use templates, and the machine-learning container is not required (but you would miss out on object detection/tagging).

ark- commented 2 years ago

I got this working by installing the unraid plugin for docker-compose. This is an OK workaround for now, but it makes a bunch of unmanaged containers in the main docker window.

  1. Install docker compose manager from the app store
  2. Add a new "stack" (find the button at the bottom of the docker tab) and call it "immich"
  3. Edit the docker compose of the immich stack pasting in the contents docker/docker-compose.yml and save changes
  4. Edit the environment of the immich stack pasting in the contents docker/.env, editing to suit your environment and save changes
  5. Click the "Docker Up" button for the stack

Enjoy

martabal commented 2 years ago

I got this working by installing the unraid plugin for docker-compose

Yeah, It works but is not ideal for many unraid users.

guim31 commented 2 years ago

Maybe we should also post here : https://discourse.linuxserver.io/t/request-immich/4482/2

Linuxserver's team would be a BIG step for Immich integration on Unraid and it would offer a really big visibility IMO.

martabal commented 2 years ago

Yeah Linuxserver's work is amazing, I hope they will create an Immich image. Btw, this issue doesn't appear in the Kanban. Hope this isn't a bad thing.

InsanePirate commented 2 years ago

I got this working by installing the unraid plugin for docker-compose. This is an OK workaround for now, but it makes a bunch of unmanaged containers in the main docker window.

1. Install docker compose manager from the app store

2. Add a new "stack" (find the button at the bottom of the docker tab) and call it "immich"

3. Edit the docker compose of the immich stack pasting in the contents `docker/docker-compose.yml` and save changes

4. Edit the environment of the immich stack pasting in the contents `docker/.env`, editing to suit your environment and save changes

5. Click the "Docker Up" button for the stack

Enjoy

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

MattFaz 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/

alextran1502 commented 2 years ago

@Mattyfaz Thank you so much for posting the guide!! Do you want to post it on Reddit or I can include the link in the next monthly update?

MattFaz commented 2 years ago

@Mattyfaz Thank you so much for posting the guide!! Do you want to post it on Reddit or I can include the link in the next monthly update?

@alextran1502 Feel free to post wherever/include in your update 😊

guim31 commented 2 years ago

Thanks a lot @Mattyfaz for your guide :+1:

I have to admit that this screenshot : image Is the reason why people hope someone would achieve to merge all the images together ! ;)

Personnaly I'll wait for this moment as I always have the feeling that it would make my unraid server a mess

EDIT : typo

dsfsdbvxc commented 2 years ago

Agreed, it would be nice to have all in one container to simplify things. However, docker folders is pretty useful to put all the current containers together, can always collapse the folder to make it look more tidy.

sohail579 commented 2 years ago

awesome write up but I also think i will wait for a unified image. is there a view on how long this will take?

alextran1502 commented 2 years ago

@sohail579 We don't have any concrete plan when to put resource into this yet. Right now it is heavily depend on the community to provide support for a single Docker image.

guim31 commented 2 years ago

Here is the answer from a LSIO moderator : https://discourse.linuxserver.io/t/request-immich/4482/5?u=guilhem

I hope the immich contributors will make it possible :)

martabal commented 2 years ago

I have successfully created an image bundling, web, machine-learning, nginx and server images. It works but I have some bugs with machine-learning. I tested it on Unraid and it works. However, this is just a draft, I don't plan to update this image frequently. You can try the container by pulling martabal/immich:latest, and you can give a look to the Dockerfile here

It uses almost 1 gb of RAM 😧 (but all official images combined use 1 gb of RAM)

bo0tzz commented 2 years ago

Nice work! It's good to have an initial approach (even if just a draft) to drive discussion further - for example, it just made me realise that doing this fully will be dependent on #647, since all the services will only be reachable on localhost.

sohail579 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/

@Mattyfaz Thankyou for this awesome write up I had it up and running in minuets. I have a question though. I endered my location for the media upload folder but normally on unraid i would expect to see a folder in the appdata with all of the appdata.. where is this all now? where are all the thumbnails saved? am i just filling up my docker image now?

bo0tzz commented 2 years ago

Thumbnails and such are saved in your library folder. The database data is (by default) stored in a docker volume, which probably is ending up in your docker img right now. That shouldn't be that much data though.

sohail579 commented 2 years ago

Thumbnails and such are saved in your library folder. The database data is (by default) stored in a docker volume, which probably is ending up in your docker img right now. That shouldn't be that much data though.

@bo0tzz your are everywhere :) and your advise and help is appreciated and awesome.. should my database in that case not be in my app data so that i am never going to loose it? or wlll the database rebuild itself from the media folder if needed ever?

martabal commented 2 years ago

Quick update, the container runs very well, finally no bug observed. It uses between 800 and 900 mb of RAM. I pushed a version for arm64 for everyone using a raspberry pi. I will do my best to keep them up to date.

image

@bo0tzz In the long term do you plan to merge images or keep them sperated?

MattFaz commented 2 years ago

@sohail579

where is this all now? where are all the thumbnails saved? am i just filling up my docker image now?

In your upload location - If you followed my guide you can see I set the upload location as mnt/user/images/immich.

Within that directory you can see a folder with a uuid, and inside that is 3 folders: encoded-video, original, and thumb. :)

image

sohail579 commented 2 years ago

@sohail579

where is this all now? where are all the thumbnails saved? am i just filling up my docker image now?

In your upload location - If you followed my guide you can see I set the upload location as mnt/user/images/immich.

Within that directory you can see a folder with a uuid, and inside that is 3 folders: encoded-video, original, and thumb. :)

image

thanks @Mattyfaz - on the other note I ubderstand that the database is stored in the docker image. shouldn't this be in the app data?

MattFaz commented 2 years ago

@sohail579

I ubderstand that the database is stored in the docker image. shouldn't this be in the app data?

Ideally - I've just tried and managed to get it working with an existing Postgres container separate from Immich so all data will be in my appdata now. Here is what I did.

.Env File Update the database values to match your postgres container.

# DB_HOSTNAME=immich_postgres
DB_HOSTNAME=192.168.0.25
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich

# Optional Database settings:
DB_PORT=5432

Compose file: You'll need to comment out all reference of database in this file. Comment out the whole database service:

#  database:
#    container_name: immich_postgres
#    image: postgres:14
#    env_file:
#      - .env
#    environment:
#      POSTGRES_PASSWORD: ${DB_PASSWORD}
#      POSTGRES_USER: ${DB_USERNAME}
#      POSTGRES_DB: ${DB_DATABASE_NAME}
#      PG_DATA: /var/lib/postgresql/data
#    volumes:
#      - pgdata:/var/lib/postgresql/data
#    restart: always

Then for each other service remove the dependency on databse:

depends_on:
  - redis
# - database

Finally remove the volume at the bottom:

# volumes:
#   pgdata: 

Doing this I've successfully got it running. image

bo0tzz commented 2 years ago

@bo0tzz In the long term do you plan to merge images or keep them sperated?

We had some discussions with the contributor team and did a few experiments ourselves with merging images. For now, we have decided not to build an all-in-one image.

Running multiple services inside one docker image is an unusual way of doing things, and would come with some issues (especially if including the Redis and Postgres dependencies). Merging the current images into one would also take time and energy away from developing other Immich features, as would providing support for the resulting mega-image.

In addition, the current images work just fine, also on Unraid (especially with @Mattyfaz's great guide). At the moment, the only reason for creating an all-in-one image would be to have it work with Unraid's Docker templates, but docker-compose fills a similar role to those already.

blaine07 commented 2 years ago

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?