#!/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 "Installing Postgresql and pgvector" $STD /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y apt install -y postgresql postgresql-16-pgvector msg_ok "Installed Postgresql and pgvector" msg_info "Setting up database" #test this: $STD su postgres -s /bin/sh -c "psql \ CREATE DATABASE immich; CREATE USER immich WITH ENCRYPTED PASSWORD 'YUaaWZAvtL@JpNgpi3z6uL4MmDMR_w'; GRANT ALL PRIVILEGES ON DATABASE immich to immich; ALTER USER immich WITH SUPERUSER; \q" #otherwise this: #su postgres </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"