Files
dropshell-templates/immich/install.sh
j 710c28aae0
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 8s
Add 26 files
2026-01-15 11:28:49 +13:00

43 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# shellcheck disable=SC1091
source "${AGENT_PATH}/common.sh"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/_volumes.sh"
_check_required_env_vars "CONTAINER_NAME" "UPLOAD_LOCATION" "DB_DATA_LOCATION" "DB_PASSWORD"
# Set defaults
IMMICH_VERSION="${IMMICH_VERSION:-release}"
ML_IMAGE_TAG="${ML_IMAGE_TAG:-release}"
WEB_PORT="${WEB_PORT:-2283}"
DB_USERNAME="${DB_USERNAME:-postgres}"
DB_DATABASE_NAME="${DB_DATABASE_NAME:-immich}"
# Export all variables for envsubst
export CONTAINER_NAME UPLOAD_LOCATION DB_DATA_LOCATION DB_PASSWORD DB_USERNAME DB_DATABASE_NAME
export WEB_PORT IMMICH_VERSION ML_IMAGE_TAG
cd "$SCRIPT_DIR" || _die "Failed to change to script directory"
# Generate docker-compose.yml from template
echo "Generating docker-compose.yml..."
envsubst < docker-compose.yml.template > docker-compose.yml \
|| _die "Failed to generate docker-compose.yml"
# Create data directories
_create_folder "${UPLOAD_LOCATION}"
_create_folder "${DB_DATA_LOCATION}"
# Pull images
echo "Pulling Immich images..."
docker compose pull || _die "Failed to pull images"
# Stop and remove existing containers
bash ./stop.sh 2>/dev/null || true
# Start services
bash ./start.sh || _die "Failed to start containers"
echo "Installation complete for ${CONTAINER_NAME}."
echo "Web UI available at http://localhost:${WEB_PORT}"