diff --git a/roles/immich/defaults/main.yml b/roles/immich/defaults/main.yml index e80195b04a..bd5e96147f 100644 --- a/roles/immich/defaults/main.yml +++ b/roles/immich/defaults/main.yml @@ -1,6 +1,7 @@ --- immich_enabled: false immich_available_externally: false +immich_install_power_tools: false # directories immich_data_directory: "{{ docker_home }}/immich" @@ -8,7 +9,9 @@ immich_upload_directory: "{{ docker_home }}/immich/upload" # network immich_port: "2283" +immich_power_tools_port: "3035" immich_hostname: "immich" +immich_power_tools_hostname: "immich-power-tools" immich_network_name: "immich" # specs @@ -20,6 +23,7 @@ immich_microservices_memory: 1g immich_machinelearning_memory: 1g immich_web_memory: 1g immich_proxy_memory: 1g +immich_power_tools_memory: 1g # docker immich_postgres_container_name: "immich_postgres" @@ -27,6 +31,7 @@ immich_redis_container_name: "immich_redis" immich_server_container_name: "immich_server" immich_microservices_container_name: "immich_microservices" immich_machinelearning_container_name: "immich_machine_learning" +immich_power_tools_container_name: "immich_power_tools" immich_postgres_image: "tensorchord/pgvecto-rs" immich_postgres_tag: "pg14-v0.2.0" @@ -38,6 +43,8 @@ immich_microservices_image: "ghcr.io/immich-app/immich-server" immich_microservices_tag: "{{ immich_version }}" immich_machinelearning_image: "ghcr.io/immich-app/immich-machine-learning" immich_machinelearning_tag: "{{ immich_version }}" +immich_power_tools_image: "ghcr.io/varun-raj/immich-power-tools" +immich_power_tools_tag: "latest" immich_user_id: "1000" immich_group_id: "1000" @@ -54,3 +61,4 @@ immich_enable_mapbox: "false" immich_mapbox_key: "" immich_upload_location: "./library" immich_public_login_page_message: "Welcome to Immich!" +immich_api_key: "" diff --git a/roles/immich/docs/immich.md b/roles/immich/docs/immich.md deleted file mode 100644 index d1088001ce..0000000000 --- a/roles/immich/docs/immich.md +++ /dev/null @@ -1,15 +0,0 @@ -# Immich - -Homepage: [https://immich.app/](https://immich.app/) - -Self-hosted photo and video backup solution directly from your mobile phone. - -## Usage - -Set `immich_enabled: true` in your `inventories//nas.yml` file. - -Set all `immich_*` variables in `inventories//group_vars/all.yml`. - -The immich web interface can be found at [http://ansible_nas_host_or_ip:2283](http://ansible_nas_host_or_ip:2283). - -Refer to [https://immich.app/docs/install/post-install](https://immich.app/docs/install/post-install) for post-install steps (Registering Admin User, adding users, etc.). diff --git a/roles/immich/molecule/default/molecule.yml b/roles/immich/molecule/default/molecule.yml index 0da6e7e2fc..0b82a4ed9b 100644 --- a/roles/immich/molecule/default/molecule.yml +++ b/roles/immich/molecule/default/molecule.yml @@ -4,3 +4,4 @@ provisioner: group_vars: all: immich_enabled: true + immich_install_power_tools: true diff --git a/roles/immich/molecule/default/side_effect.yml b/roles/immich/molecule/default/side_effect.yml index f614bc9637..1328f41cea 100644 --- a/roles/immich/molecule/default/side_effect.yml +++ b/roles/immich/molecule/default/side_effect.yml @@ -8,3 +8,4 @@ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" vars: immich_enabled: false + immich_install_power_tools: false diff --git a/roles/immich/molecule/default/verify.yml b/roles/immich/molecule/default/verify.yml index 7472bb59fe..fde90ede5a 100644 --- a/roles/immich/molecule/default/verify.yml +++ b/roles/immich/molecule/default/verify.yml @@ -32,6 +32,11 @@ name: "{{ immich_machinelearning_container_name }}" register: result_machinelearning + - name: Get Immich Power Tools container state + community.docker.docker_container_info: + name: "{{ immich_power_tools_container_name }}" + register: result_powertools + - name: Check if Immich docker containers are running ansible.builtin.assert: that: @@ -45,3 +50,5 @@ - result_microservices.container['State']['Restarting'] == false - result_machinelearning.container['State']['Status'] == "running" - result_machinelearning.container['State']['Restarting'] == false + - result_powertools.container['State']['Status'] == "running" + - result_powertools.container['State']['Restarting'] == false diff --git a/roles/immich/molecule/default/verify_stopped.yml b/roles/immich/molecule/default/verify_stopped.yml index 4314ef9c81..858c222b2d 100644 --- a/roles/immich/molecule/default/verify_stopped.yml +++ b/roles/immich/molecule/default/verify_stopped.yml @@ -37,6 +37,12 @@ state: absent register: result_machinelearning + - name: Try and stop and remove Immich Power Tools + community.docker.docker_container: + name: "{{ immich_power_tools_container_name }}" + state: absent + register: result_powertools + - name: Check if immich containers are stopped ansible.builtin.assert: that: @@ -45,3 +51,4 @@ - not result_server.changed - not result_microservices.changed - not result_machinelearning.changed + - not result_powertools.changed diff --git a/roles/immich/tasks/main.yml b/roles/immich/tasks/main.yml index 0c7b02135c..a0a4af3bc2 100644 --- a/roles/immich/tasks/main.yml +++ b/roles/immich/tasks/main.yml @@ -168,6 +168,38 @@ traefik.enable: "false" restart_policy: unless-stopped memory: "{{ immich_machinelearning_memory }}" + + - name: Install Immich Power Tools + block: + - name: Immich Power Tools + community.docker.docker_container: + name: "{{ immich_power_tools_container_name }}" + image: "{{ immich_power_tools_image }}:{{ immich_power_tools_tag }}" + pull: true + networks: + - name: "{{ immich_network_name }}" + network_mode: "{{ immich_network_name }}" + container_default_behavior: no_defaults + restart_policy: always + memory: "{{ immich_power_tools_memory }}" + ports: + - "{{ immich_power_tools_port }}:3000" + env: + IMMICH_URL: "https://{{ immich_hostname }}.{{ ansible_nas_domain }}" + IMMICH_API_KEY: "{{ immich_api_key }}" + DB_USERNAME: "{{ immich_db_username }}" + DB_PASSWORD: "{{ immich_db_password }}" + DB_HOST: "{{ immich_postgres_container_name }}" + DB_PORT: "{{ immich_db_port }}" + DB_DATABASE_NAME: "{{ immich_db_name }}" + labels: + traefik.enable: "{{ immich_available_externally | string }}" + traefik.http.routers.immich_power_tools.rule: "Host(`{{ immich_power_tools_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.immich_power_tools.tls.certresolver: "letsencrypt" + traefik.http.routers.immich_power_tools.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.immich_power_tools.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.immich_power_tools.loadbalancer.server.port: "3000" + when: immich_install_power_tools is true when: immich_enabled is true - name: Stop Immich @@ -201,4 +233,12 @@ community.docker.docker_network: name: "{{ immich_network_name }}" state: absent + + - name: Stop Immich Power Tools + block: + - name: Stop Immich Power Tools + community.docker.docker_container: + name: "{{ immich_power_tools_container_name }}" + state: absent + when: immich_install_power_tools is false when: immich_enabled is false diff --git a/website/docs/applications/other/immich.md b/website/docs/applications/other/immich.md index 1d2f38426f..753e7bdc95 100644 --- a/website/docs/applications/other/immich.md +++ b/website/docs/applications/other/immich.md @@ -12,10 +12,16 @@ Set `immich_enabled: true` in your `inventories//group_vars/nas. Set all `immich_*` variables in `inventories//group_vars/all.yml`. -The immich web interface can be found at [http://ansible_nas_host_or_ip:2283](http://ansible_nas_host_or_ip:2283). +The Immich web interface can be found at [http://ansible_nas_host_or_ip:2283](http://ansible_nas_host_or_ip:2283). Refer to [https://immich.app/docs/install/post-install](https://immich.app/docs/install/post-install) for post-install steps (Registering Admin User, adding users, etc.). +Optionally, you can install[Immich Power Tools](https://github.com/varun-raj/immich-power-tools). + +Set `immich_install_power_tools: true` and `immich_api_key` in your `inventories//group_vars/nas.yml` file and run the playbook again. + +The Immich Power Tools web interface can then be found at [http://ansible_nas_host_or_ip:3035](http://ansible_nas_host_or_ip:3035). + ## Specific Configuration Please note the need for a CPU with AVX and AVX2 instruction set to run the Machine Learning container. Check [here](https://github.com/immich-app/immich/tree/c436c57cc9a2a23ae1fbd3ea52eeb947f32261cd#tensorflow-build-issue) for details.