make deployment targets configurable

This commit is contained in:
Yax 2026-03-20 20:04:50 +01:00
parent b1acba76f1
commit f10a3b5012
6 changed files with 248 additions and 8 deletions

View file

@ -1,11 +1,43 @@
# deployment
DEPLOY=01-blog
#DEPLOY=00-monitor 01-blog 02-selfoss 03-shaarli 04-gitea 05-wallabag 06-heimdall 07-ntfy 08-ittools 09-bichon
#DEPLOY=07-seafile 08-immich 09-navidrome
# general
ROOT_INSTALL=/srv
TZ=Europe/Paris
DOMAIN=domain.com
PUID=1000
PGID=1000
# apps
# wallabag
WALLABAG_URL=http://localhost
# ntfy
NTFY_URL=http://localhost:8017
NTFY_BEHIND_PROXY=true
# maintenant
MAINTENANT_URL=http://localhost
# seafile
HOST_SEAFILE=seafile
SEAFILE_ADMIN_EMAIL=admin@domain.com
SEAFILE_ADMIN_PASSWORD=adminpassword
SEAFILE_DB_ROOT_PASSWORD=dbpassword
SEAFILE_DB_USER=seafile
SEAFILE_DB_PASSWORD=seafile
SEAFILE_JWT_PRIVATE_KEY=GyNUgwdu9chG4lQIvn7sy0BJz4HHNeosXJ1cms6k
SEAFILE_PHOTOS=/srv/data/seafile
# immich
IMMICH_VERSION=release
UPLOAD_LOCATION=./library
DB_DATA_LOCATION=./postgres
DB_PASSWORD=postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
# navidrome
NAVIDROME_URL=https://music.domain.com
SEAFILE_ZIC=/srv/data/seafile

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
.env
selfhosting.sublime-project
selfhosting.sublime-workspace
vm1.env
data/

View file

@ -0,0 +1,77 @@
services:
db:
image: ${SEAFILE_DB_IMAGE:-mariadb:10.11}
container_name: seafile-mysql
environment:
- MYSQL_ROOT_PASSWORD=${SEAFILE_DB_ROOT_PASSWORD}
- MYSQL_LOG_CONSOLE=true
- MARIADB_AUTO_UPGRADE=1
volumes:
- seafile_db:/var/lib/mysql
healthcheck:
test:
[
"CMD",
"/usr/local/bin/healthcheck.sh",
"--connect",
"--mariadbupgrade",
"--innodb_initialized",
]
interval: 20s
start_period: 30s
timeout: 5s
retries: 10
memcached:
image: memcached:1.6.29
container_name: seafile-memcached
entrypoint: memcached -m 256
seafile:
image: seafileltd/seafile-mc:12.0-latest
container_name: seafile
ports:
- "8017:80"
- "8080:8080"
environment:
- DB_HOST=db
- DB_PORT=3306
- DB_USER=${SEAFILE_DB_USER}
- DB_ROOT_PASSWD=${SEAFILE_DB_ROOT_PASSWORD}
- DB_PASSWORD=${SEAFILE_DB_PASSWORD}
- SEAFILE_MYSQL_DB_CCNET_DB_NAME=ccnet_db
- SEAFILE_MYSQL_DB_SEAFILE_DB_NAME=seafile_db
- SEAFILE_MYSQL_DB_SEAHUB_DB_NAME=seahub_db
- TIME_ZONE=${TZ}
- INIT_SEAFILE_ADMIN_EMAIL=${SEAFILE_ADMIN_EMAIL}
- INIT_SEAFILE_ADMIN_PASSWORD=${SEAFILE_ADMIN_PASSWORD}
- SEAFILE_SERVER_HOSTNAME=${HOST_SEAFILE}.${DOMAIN}
- SEAFILE_SERVER_PROTOCOL=https
- SITE_ROOT=${SITE_ROOT:-/}
- NON_ROOT=${NON_ROOT:-false}
- JWT_PRIVATE_KEY=${SEAFILE_JWT_PRIVATE_KEY}
- SEAFILE_LOG_TO_STDOUT=${SEAFILE_LOG_TO_STDOUT:-false}
- ENABLE_SEADOC=${ENABLE_SEADOC:-true}
- SEADOC_SERVER_URL=https://${HOST_SEAFILE}.${DOMAIN}/sdoc-server
volumes:
- seafile_data:/shared:rw
- type: bind
source: ${ROOT_INSTALL}/data/seafile
target: /seafile-fuse
bind:
propagation: rshared
privileged: true
cap_add:
- SYS_ADMIN
labels:
caddy: https://${HOST_SEAFILE}.${DOMAIN}
caddy.reverse_proxy: "{{upstreams 80}}"
depends_on:
db:
condition: service_healthy
memcached:
condition: service_started
volumes:
seafile_db:
seafile_data:

View file

@ -0,0 +1,83 @@
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
# extends:
# file: hwaccel.transcoding.yml
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
- type: bind
source: ${SEAFILE_PHOTOS}
target: /mnt/media/photos
read_only: true
bind:
propagation: rslave
privileged: true
cap_add:
- SYS_ADMIN
ports:
- '2283:2283'
depends_on:
- redis
- database
restart: always
healthcheck:
disable: false
immich-machine-learning:
container_name: immich_machine_learning
# For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
# Example tag: ${IMMICH_VERSION:-release}-cuda
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
# extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
# file: hwaccel.ml.yml
# service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
volumes:
- model-cache:/cache
restart: always
healthcheck:
disable: false
redis:
container_name: immich_redis
image: docker.io/redis:6.2-alpine@sha256:eaba718fecd1196d88533de7ba49bf903ad33664a92debb24660a922ecd9cac8
healthcheck:
test: redis-cli ping || exit 1
restart: always
database:
container_name: immich_postgres
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
volumes:
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
healthcheck:
test: >-
pg_isready --dbname="$${POSTGRES_DB}" --username="$${POSTGRES_USER}" || exit 1;
Chksum="$$(psql --dbname="$${POSTGRES_DB}" --username="$${POSTGRES_USER}" --tuples-only --no-align
--command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')";
echo "checksum failure count is $$Chksum";
[ "$$Chksum" = '0' ] || exit 1
interval: 5m
start_interval: 30s
start_period: 5m
command: >-
postgres
-c shared_preload_libraries=vectors.so
-c 'search_path="$$user", public, vectors'
-c logging_collector=on
-c max_wal_size=2GB
-c shared_buffers=512MB
-c wal_compression=on
restart: always
volumes:
model-cache:

View file

@ -0,0 +1,24 @@
services:
navidrome:
container_name: navidrome
image: deluan/navidrome:latest
ports:
- "4533:4533"
restart: unless-stopped
environment:
ND_LOGLEVEL: info
ND_BASEURL: ${NAVIDROME_URL}
volumes:
- navidrome-data:/data
- type: bind
source: ${SEAFILE_ZIC}
target: /music
read_only: true
bind:
propagation: rslave
privileged: true
cap_add:
- SYS_ADMIN
volumes:
navidrome-data:

View file

@ -16,12 +16,36 @@ fi
# Store the user-provided arguments
ARGS="$@"
# Find all directories containing a file named docker-compose*.yml
find . -type f -name 'docker-compose*.yml' | while IFS= read -r compose_file; do
CONFIG_FILE=".env"
# Run the docker compose command with user arguments
echo "Running: docker compose $compose_file"
docker compose -f "$compose_file" $ARGS
# Check if config file exists
if [ ! -f "$CONFIG_FILE" ]; then
echo "Error: Config file '$CONFIG_FILE' not found"
exit 1
fi
# Extract DEPLOY variable from .env file
DEPLOY=$(grep '^DEPLOY=' "$CONFIG_FILE" | cut -d '=' -f 2-)
if [ -z "$DEPLOY" ]; then
echo "Error: DEPLOY variable not set in $CONFIG_FILE"
exit 1
fi
# Find all directories containing docker-compose*.yml files
DIRS=$(find . -type f -name 'docker-compose*.yml' -exec dirname {} \; | sort -u)
# Iterate through the filtered directories
for dir in $DIRS; do
# Extract directory name (e.g., "01-blog" from "./01-blog")
dir_name=$(basename "$dir")
# Check if directory name is in DEPLOY list
if echo "$DEPLOY" | grep -qw "$dir_name"; then
compose_file=$(find "$dir" -maxdepth 1 -type f -name 'docker-compose*.yml' | head -1)
echo "Running: docker compose --env-file .env -f $compose_file $ARGS"
docker compose --env-file .env -f "$compose_file" $ARGS
fi
done