#!/usr/bin/env bash # Copyright (c) 2024 chmistry # Author: chmistry # License: MIT # https://github.com/tteck/Proxmox/raw/main/LICENSE source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" color verb_ip6 catch_errors setting_up_container network_check update_os msg_info "Installing Dependencies" $STD apt install -y curl $STD apt install -y git $STD apt install -y python3-venv $STD apt install -y python3-dev $STD apt install -y build-essential $STD apt install -y unzip $STD apt install -y postgresql-common $STD apt install -y gnupg $STD apt install -y software-properties-common $STD apt install -y redis msg_ok "Installed Dependencies" msg_info "Adding immich user" $STD useradd -m immich #TODO: strip user login etc. (make it more a daemon user) msg_ok "User immich added" msg_info "Installing Node.js" #TODO script crashes at this point, attempt to install as immich user #$STD su immich -c "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash" #su immich -s /usr/bin/bash -c "bash <(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh)" #su immich -s /usr/bin/bash -c "source ~/.bashrc" su immich -s /usr/bin/bash </etc/systemd/system/immich-microservices.service [Unit] Description=immich microservices Documentation=https://github.com/immich-app/immich Requires=redis-server.service Requires=postgresql.service [Service] User=immich Group=immich Type=simple Restart=on-failure UMask=0077 ExecStart=/bin/bash /home/immich/app/start.sh microservices SyslogIdentifier=immich-microservices StandardOutput=append:/var/log/immich/microservices.log StandardError=append:/var/log/immich/microservices.log [Install] WantedBy=multi-user.target EOF cat </etc/systemd/system/immich-ml.service [Unit] Description=immich machine-learning Documentation=https://github.com/immich-app/immich [Service] User=immich Group=immich Type=simple Restart=on-failure UMask=0077 WorkingDirectory=/home/immich/app EnvironmentFile=/home/immich/runtime.env ExecStart=/home/immich/app/machine-learning/start.sh SyslogIdentifier=immich-machine-learning StandardOutput=append:/var/log/immich/ml.log StandardError=append:/var/log/immich/ml.log [Install] WantedBy=multi-user.target EOF cat </etc/systemd/system/immich-web.service [Unit] Description=immich web server Documentation=https://github.com/immich-app/immich Requires=redis-server.service Requires=postgresql.service Requires=immich-ml.service Requires=immich-microservices.service [Service] User=immich Group=immich Type=simple Restart=on-failure UMask=0077 ExecStart=/bin/bash /home/immich/app/start.sh immich SyslogIdentifier=immich-web StandardOutput=append:/var/log/immich/web.log StandardError=append:/var/log/immich/web.log [Install] WantedBy=multi-user.target EOF systemctl enable -q --now immich-microservices.service systemctl enable -q --now immich-ml.service systemctl enable -q --now immich-web.service msg_ok "Created Services" motd_ssh customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"