diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 0000000..c32b645 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1,11 @@ +# Local Compose inputs and generated private material must not be published. +.env +.env.* +# Named Compose env inputs (for example, homeassistant/*.env). +*.env +!.env.example +!.env.sample +!.env.template +acme.json +*.key +*.pem diff --git a/docker/blog/docker-compose.yml b/docker/blog/docker-compose.yml new file mode 100644 index 0000000..952044a --- /dev/null +++ b/docker/blog/docker-compose.yml @@ -0,0 +1,84 @@ +services: + blog_production: + image: vezpi-blog:latest + container_name: blog_production + environment: + - TZ=Europe/Paris + - URL=${URL_PROD} + - BRANCH=main + volumes: + - blog_production_hugo_resources:/hugo-resources + networks: + - web + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://localhost/ > /dev/null || exit 1"] + interval: 5s + timeout: 3s + retries: 30 + start_period: 5s + labels: + - traefik.enable=true + - traefik.http.routers.blog.rule=Host(`${URL_PROD}`) + - traefik.http.routers.blog.entrypoints=https + - traefik.http.routers.blog.tls.certresolver=letsencrypt + - traefik.http.services.blog.loadbalancer.server.port=80 + restart: always + + blog_staging: + image: vezpi-blog:latest + container_name: blog_staging + environment: + - TZ=Europe/Paris + - URL=${URL_STAGING} + - BRANCH=preview + volumes: + - blog_staging_hugo_resources:/hugo-resources + networks: + - web + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://localhost/ > /dev/null || exit 1"] + interval: 5s + timeout: 3s + retries: 30 + start_period: 5s + labels: + - traefik.enable=true + - traefik.http.routers.blog-staging.rule=Host(`${URL_STAGING}`) + - traefik.http.routers.blog-staging.entrypoints=https + - traefik.http.routers.blog-staging.tls.certresolver=letsencrypt + - traefik.http.services.blog-staging.loadbalancer.server.port=80 + restart: always + + blog_dev: + image: vezpi-blog:dev + container_name: blog_dev + environment: + - TZ=Europe/Paris + - URL=${URL_DEV} + - BRANCH=${BLOG_TEST_BRANCH:-preview} + volumes: + - blog_dev_hugo_resources:/hugo-resources + networks: + - web + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://localhost/ > /dev/null || exit 1"] + interval: 5s + timeout: 3s + retries: 30 + start_period: 5s + labels: + - traefik.enable=true + - traefik.http.routers.blog-dev.rule=Host(`${URL_DEV}`) + - traefik.http.routers.blog-dev.entrypoints=https + - traefik.http.routers.blog-dev.tls.certresolver=letsencrypt + - traefik.http.services.blog-dev.loadbalancer.server.port=80 + restart: always + +volumes: + blog_production_hugo_resources: + blog_staging_hugo_resources: + blog_dev_hugo_resources: + +networks: + web: + external: true diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..1e84de2 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,21 @@ +services: + NAME: + image: IMAGE + container_name: NAME + volumes: + - /appli/data/NAME/:/ + environment: + - TZ=Europe/Paris + networks: + - web + labels: + - traefik.enable=true + - traefik.http.routers.NAME.rule=Host(`${URL}`) + - traefik.http.routers.NAME.entrypoints=https + - traefik.http.routers.NAME.tls.certresolver=letsencrypt + - traefik.http.services.NAME.loadbalancer.server.port=PORT + restart: always + +networks: + web: + external: true diff --git a/docker/duplicati/docker-compose.yml b/docker/duplicati/docker-compose.yml new file mode 100644 index 0000000..904a85b --- /dev/null +++ b/docker/duplicati/docker-compose.yml @@ -0,0 +1,25 @@ +services: + duplicati: + image: duplicati/duplicati + container_name: duplicati + volumes: + - /appli/data/duplicati/data:/data + - /backups:/backups + - /restore:/restore + - /:/source:ro + hostname: ${URL} + environment: + - TZ=Europe/Paris + networks: + - web + labels: + - traefik.enable=true + - traefik.http.routers.duplicati.rule=Host(`${URL}`) + - traefik.http.routers.duplicati.entrypoints=https + - traefik.http.routers.duplicati.tls.certresolver=letsencrypt + - traefik.http.services.duplicati.loadbalancer.server.port=8200 + restart: always + +networks: + web: + external: true diff --git a/docker/gitea/docker-compose.yml b/docker/gitea/docker-compose.yml new file mode 100644 index 0000000..d473f79 --- /dev/null +++ b/docker/gitea/docker-compose.yml @@ -0,0 +1,78 @@ +services: + server: + image: gitea/gitea:1.27 + container_name: gitea_server + restart: always + volumes: + - /appli/data/gitea/data:/data + environment: + - USER_UID=1000 + - USER_GID=1000 + - TZ=Europe/Paris + - DB_TYPE=postgres + - DB_HOST=db:5432 + - DB_NAME=${DB_NAME} + - DB_USER=${DB_USER} + - DB_PASSWD=${DB_PASSWD} + - GITEA__service__DISABLE_REGISTRATION=true + networks: + - web + - backend + labels: + - traefik.enable=true + - traefik.http.routers.gitea.rule=Host(`${URL}`) + - traefik.http.routers.gitea.entrypoints=https + - traefik.http.routers.gitea.tls.certresolver=letsencrypt + - traefik.http.services.gitea.loadbalancer.server.port=3000 + depends_on: + - db + + db: + image: postgres:12-alpine + container_name: gitea_db + volumes: + - /appli/data/gitea/db:/var/lib/postgresql/data + environment: + - POSTGRES_USER=${DB_USER} + - POSTGRES_PASSWORD=${DB_PASSWD} + - POSTGRES_DB=${DB_NAME} + networks: + - backend + restart: always + + # webhook: + # image: almir/webhook + # container_name: gitea_webhook + # command: -verbose -hooks=/etc/webhook/hooks.yaml -hotreload + # volumes: + # - /appli/data/gitea/webhook/hooks:/etc/webhook + # - /appli/data/gitea/webhook/scripts:/scripts + # environment: + # - TZ=Europe/Paris + # networks: + # - backend + # restart: always + + runner: + image: gitea/act_runner:latest + container_name: gitea_runner + restart: always + environment: + - GITEA_INSTANCE_URL=https://${URL} + - GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_REGISTRATION_TOKEN} + - GITEA_RUNNER_NAME=${GITEA_RUNNER_NAME} + - GITEA_RUNNER_LABELS=${GITEA_RUNNER_LABELS} + - CONFIG_FILE=/data/config.yml + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /appli/data/gitea/runner:/data + - /appli:/appli + networks: + - backend + depends_on: + - server + +networks: + backend: + web: + external: true diff --git a/docker/homeassistant/docker-compose.yml b/docker/homeassistant/docker-compose.yml new file mode 100644 index 0000000..fb07ac1 --- /dev/null +++ b/docker/homeassistant/docker-compose.yml @@ -0,0 +1,198 @@ +services: + homeassistant: + image: homeassistant/home-assistant:2026.9 + container_name: homeassistant_core + hostname: homeassistant_core + volumes: + - /appli/data/homeassistant/core/:/config + - /etc/localtime:/etc/localtime:ro + environment: + - TZ=Europe/Paris + networks: + - lan + - web + - backend + depends_on: + - postgres + - influxdb + labels: + - traefik.enable=true + - traefik.http.routers.homeassistant.rule=Host(`${URL_HASS}`) + - traefik.http.routers.homeassistant.entrypoints=https + - traefik.http.routers.homeassistant.tls.certresolver=letsencrypt + - traefik.http.services.homeassistant.loadbalancer.server.port=8123 + restart: unless-stopped + + postgres: + image: postgres:15-alpine + container_name: homeassistant_postgres + volumes: + - /appli/data/homeassistant/postgres:/var/lib/postgresql/data + - /etc/localtime:/etc/localtime:ro + environment: + - TZ=Europe/Paris + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + networks: + - backend + restart: unless-stopped + + influxdb: + image: influxdb:2-alpine + container_name: homeassistant_influxdb + volumes: + - /appli/data/homeassistant/influxdb/data:/var/lib/influxdb2 + - /appli/data/homeassistant/influxdb/config/:/etc/influxdb2 + environment: + - TZ=Europe/Paris + ulimits: + nofile: + soft: 65536 + hard: 65536 + env_file: influxdb.env + labels: + - traefik.enable=true + - traefik.http.routers.homeassistant-influxdb.rule=Host(`${URL_INFLUXDB}`) + - traefik.http.routers.homeassistant-influxdb.entrypoints=https + - traefik.http.routers.homeassistant-influxdb.tls.certresolver=letsencrypt + - traefik.http.routers.homeassistant-influxdb.middlewares=local-only@file + - traefik.http.services.homeassistant-influxdb.loadbalancer.server.port=8086 + networks: + - backend + - web + restart: unless-stopped + +# grafana: +# image: grafana/grafana +# container_name: homeassistant_grafana +# depends_on: +# - influxdb + + mosquitto: + image: eclipse-mosquitto + container_name: homeassistant_mqtt + volumes: + - /appli/data/homeassistant/mosquitto/config:/mosquitto/config + - /appli/data/homeassistant/mosquitto/data:/mosquitto/data + - /appli/data/homeassistant/mosquitto/log:/mosquitto/log + environment: + - TZ=Europe/Paris + networks: + - backend + restart: unless-stopped + + zigbee2mqtt: + image: koenkk/zigbee2mqtt + container_name: homeassistant_zigbee + volumes: + - /appli/data/homeassistant/zigbee2mqtt:/app/data + - /run/udev:/run/udev:ro + environment: + - TZ=Europe/Paris + #devices: + #- /dev/ttyUSB0:/dev/ttyACM0 + networks: + - lan + - backend + - web + depends_on: + - mosquitto + labels: + - traefik.enable=true + - traefik.http.routers.homeassistant-zigbee2mqtt.rule=Host(`${URL_Z2M}`) + - traefik.http.routers.homeassistant-zigbee2mqtt.entrypoints=https + - traefik.http.routers.homeassistant-zigbee2mqtt.tls.certresolver=letsencrypt + - traefik.http.routers.homeassistant-zigbee2mqtt.middlewares=local-only@file + - traefik.http.services.homeassistant-zigbee2mqtt.loadbalancer.server.port=8080 + restart: always + + editor: + image: causticlab/hass-configurator-docker + container_name: homeassistant_editor + volumes: + - /appli/data/homeassistant/editor:/config + - /appli/data/homeassistant/core:/homeassistant_root + - /appli/docker/homeassistant/docker-compose.yml:/homeassistant_root/docker-compose.yml + networks: + - backend + - web + labels: + - traefik.enable=true + - traefik.http.routers.homeassistant-editor.rule=Host(`${URL_EDITOR}`) + - traefik.http.routers.homeassistant-editor.entrypoints=https + - traefik.http.routers.homeassistant-editor.tls.certresolver=letsencrypt + - traefik.http.routers.homeassistant-editor.middlewares=local-only@file + - traefik.http.services.homeassistant-editor.loadbalancer.server.port=3218 + restart: unless-stopped + +# mdns: +# image: monstrenyatko/mdns-repeater +# container_name: homeassistant_mdns +# command: mdns-repeater-app -f -d enp51s0 br-9388867fe123 + #restart: unless-stopped + #network_mode: host + + nodered: + image: nodered/node-red + container_name: homeassistant_nodered + volumes: + - /appli/data/homeassistant/nodered/data:/data + environment: + - TZ=Europe/Paris + depends_on: + - homeassistant + - mosquitto + networks: + - backend + - web + labels: + - traefik.enable=true + - traefik.http.routers.homeassistant-nodered.rule=Host(`${URL_NODERED}`) + - traefik.http.routers.homeassistant-nodered.entrypoints=https + - traefik.http.routers.homeassistant-nodered.tls.certresolver=letsencrypt + - traefik.http.routers.homeassistant-nodered.middlewares=local-only@file + - traefik.http.services.homeassistant-nodered.loadbalancer.server.port=1880 + restart: unless-stopped + + whisper: + image: rhasspy/wyoming-whisper + container_name: homeassistant_whisper + command: --model base-int8 --language fr + environment: + - TZ=Europe/Paris + volumes: + - /appli/data/homeassistant/whisper/data:/data + networks: + - backend + restart: unless-stopped + + piper: + image: rhasspy/wyoming-piper + container_name: homeassistant_piper + command: --voice fr_FR-mls-medium + environment: + - TZ=Europe/Paris + volumes: + - /appli/data/homeassistant/piper/data:/data + networks: + - backend + restart: unless-stopped + + # ollama: + # image: ollama/ollama + # container_name: homeassistant_ollama + # environment: + # - TZ=Europe/Paris + # volumes: + # - /appli/data/homeassistant/ollama/data:/root/.ollama + # networks: + # - backend + # restart: unless-stopped + +networks: + backend: + lan: + external: true + web: + external: true diff --git a/docker/immich/docker-compose.yml b/docker/immich/docker-compose.yml new file mode 100644 index 0000000..be567db --- /dev/null +++ b/docker/immich/docker-compose.yml @@ -0,0 +1,93 @@ +# +# WARNING: Make sure to use the docker-compose.yml of the current release: +# +# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml +# +# The compose file on main may not be compatible with the latest release. +# + +name: immich + +services: + server: + container_name: immich_server + image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} + extends: + file: hwaccel.transcoding.yml + service: vaapi # 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 + networks: + - backend + - web + env_file: + - .env + depends_on: + - redis + - database + labels: + - traefik.enable=true + - traefik.http.routers.immich.rule=Host(`${URL}`) + - traefik.http.routers.immich.entrypoints=https + - traefik.http.routers.immich.tls.certresolver=letsencrypt + - traefik.http.services.immich.loadbalancer.server.port=2283 + restart: always + healthcheck: + disable: false + + 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: openvino # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable + volumes: + - model-cache:/cache + networks: + - backend + env_file: + - .env + restart: always + healthcheck: + disable: false + + redis: + container_name: immich_redis + image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5 + env_file: + - .env + networks: + - backend + healthcheck: + test: redis-cli ping || exit 1 + restart: always + + database: + container_name: immich_database + image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0 + 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 + env_file: + - .env + networks: + - backend + shm_size: 128mb + restart: always + +volumes: + model-cache: + +networks: + backend: + web: + external: true diff --git a/docker/immich/hwaccel.ml.yml b/docker/immich/hwaccel.ml.yml new file mode 100644 index 0000000..d9455d2 --- /dev/null +++ b/docker/immich/hwaccel.ml.yml @@ -0,0 +1,43 @@ +# Configurations for hardware-accelerated machine learning + +# If using Unraid or another platform that doesn't allow multiple Compose files, +# you can inline the config for a backend by copying its contents +# into the immich-machine-learning service in the docker-compose.yml file. + +# See https://immich.app/docs/features/ml-hardware-acceleration for info on usage. + +services: + armnn: + devices: + - /dev/mali0:/dev/mali0 + volumes: + - /lib/firmware/mali_csffw.bin:/lib/firmware/mali_csffw.bin:ro # Mali firmware for your chipset (not always required depending on the driver) + - /usr/lib/libmali.so:/usr/lib/libmali.so:ro # Mali driver for your chipset (always required) + + cpu: {} + + cuda: + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: + - gpu + + openvino: + device_cgroup_rules: + - 'c 189:* rmw' + devices: + - /dev/dri:/dev/dri + volumes: + - /dev/bus/usb:/dev/bus/usb + + openvino-wsl: + devices: + - /dev/dri:/dev/dri + - /dev/dxg:/dev/dxg + volumes: + - /dev/bus/usb:/dev/bus/usb + - /usr/lib/wsl:/usr/lib/wsl diff --git a/docker/immich/hwaccel.transcoding.yml b/docker/immich/hwaccel.transcoding.yml new file mode 100644 index 0000000..33fb7b3 --- /dev/null +++ b/docker/immich/hwaccel.transcoding.yml @@ -0,0 +1,54 @@ +# Configurations for hardware-accelerated transcoding + +# If using Unraid or another platform that doesn't allow multiple Compose files, +# you can inline the config for a backend by copying its contents +# into the immich-microservices service in the docker-compose.yml file. + +# See https://immich.app/docs/features/hardware-transcoding for more info on using hardware transcoding. + +services: + cpu: {} + + nvenc: + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: + - gpu + - compute + - video + + quicksync: + devices: + - /dev/dri:/dev/dri + + rkmpp: + security_opt: # enables full access to /sys and /proc, still far better than privileged: true + - systempaths=unconfined + - apparmor=unconfined + group_add: + - video + devices: + - /dev/rga:/dev/rga + - /dev/dri:/dev/dri + - /dev/dma_heap:/dev/dma_heap + - /dev/mpp_service:/dev/mpp_service + #- /dev/mali0:/dev/mali0 # only required to enable OpenCL-accelerated HDR -> SDR tonemapping + volumes: + #- /etc/OpenCL:/etc/OpenCL:ro # only required to enable OpenCL-accelerated HDR -> SDR tonemapping + #- /usr/lib/aarch64-linux-gnu/libmali.so.1:/usr/lib/aarch64-linux-gnu/libmali.so.1:ro # only required to enable OpenCL-accelerated HDR -> SDR tonemapping + + vaapi: + devices: + - /dev/dri:/dev/dri + + vaapi-wsl: # use this for VAAPI if you're running Immich in WSL2 + devices: + - /dev/dri:/dev/dri + volumes: + - /usr/lib/wsl:/usr/lib/wsl + environment: + - LIBVA_DRIVER_NAME=d3d12 diff --git a/docker/jellyfin/docker-compose.yml b/docker/jellyfin/docker-compose.yml new file mode 100644 index 0000000..d78c26b --- /dev/null +++ b/docker/jellyfin/docker-compose.yml @@ -0,0 +1,27 @@ +services: + jellyfin: + image: linuxserver/jellyfin + container_name: jellyfin + volumes: + - /appli/data/jellyfin/:/config + - /data/videos/Series:/data/tvshows + - /data/videos/Films:/data/movies + devices: + - /dev/dri:/dev/dri + environment: + - TZ=Europe/Paris + - PUID=3120 + - PGID=3120 + networks: + - web + labels: + - traefik.enable=true + - traefik.http.routers.jellyfin.rule=Host(`${URL}`) + - traefik.http.routers.jellyfin.entrypoints=https + - traefik.http.routers.jellyfin.tls.certresolver=letsencrypt + - traefik.http.services.jellyfin.loadbalancer.server.port=8096 + restart: unless-stopped + +networks: + web: + external: true diff --git a/docker/nextcloud/core/Dockerfile b/docker/nextcloud/core/Dockerfile new file mode 100644 index 0000000..5add45a --- /dev/null +++ b/docker/nextcloud/core/Dockerfile @@ -0,0 +1,5 @@ +FROM nextcloud:31-fpm-alpine + +COPY healthcheck.sh /healthcheck.sh + +RUN chmod u+x /healthcheck.sh diff --git a/docker/nextcloud/core/healthcheck.sh b/docker/nextcloud/core/healthcheck.sh new file mode 100644 index 0000000..670dcaf --- /dev/null +++ b/docker/nextcloud/core/healthcheck.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +#---------------------------------------------------------------------------------------------------- +#~ Name : Script name +#~ Description : Skel script +#~ Author : Etienne Girault +#~ +#~ Usage : [-h] [-D] [-V] +#~ +#~ Options : -h, --help ; Print help +#~ Options : -V, --version ; Print version +#~ Options : -D, --debug ; Debug + +#---------------------------------------------------------------------------------------------------- +# Variables +#---------------------------------------------------------------------------------------------------- +script_name="$(grep '^#~ Name' "$0" | sed 's/^.*: //')" +script_version="$(grep '^#~ v' "$0" | tail -1 | sed -e 's/^#~ //' -e 's/ *\-.*$//')" + +FOLDERS="Documents Ebook photo video download" + +#---------------------------------------------------------------------------------------------------- +# Functions +#---------------------------------------------------------------------------------------------------- +print_script_name_version() { echo "$script_name $script_version" && sed -n '/^#~ Version/,$p' "$0" | grep '^#~' | sed 's/^#~ //'; } +print_script_description() { grep '^#~ Description' "$0" | sed 's/^.*: //'; } +print_script_usage() { grep '^#~ Usage' "$0" | sed -e 's/^.*: //' -e '1 s/^/Usage: '"${0##*/}"' /' -e '2,$ s/^/'"$(printf '%*s' "$(echo "Usage: ${0##*/}" | wc -c)")"'/'; } +print_script_options() { echo "Options" && grep '^#~ Options' "$0" | sed -e 's/^.*://' -e 's/^ --/ --/' | column -ts \;; } +print_script_help() { echo "$script_name $script_version" && print_script_description && print_script_usage && print_script_options; } + +folder_is_empty() { + if [ -n "$(ls $1)" ]; then + return 1 + fi + return 0 +} + +# Signals +trap 'exit 1' INT TERM + +#---------------------------------------------------------------------------------------------------- +# Options +#---------------------------------------------------------------------------------------------------- +while getopts ":-:hVD" OPTION; do + case $OPTION in + h) print_script_help; exit;; + V) print_script_name_version; exit;; + D) set -x;; + :) ;; + -) case $OPTARG in + help) print_script_help; exit;; + version) print_script_name_version; exit;; + debug) set -x;; + esac ;; + *) ;; + esac +done +shift $((OPTIND-1)) + +#---------------------------------------------------------------------------------------------------- +# Start +#---------------------------------------------------------------------------------------------------- + +for folder in $FOLDERS; do + if folder_is_empty /mnt/data/$folder; then + exit 1 + fi +done + +#---------------------------------------------------------------------------------------------------- +# End +#---------------------------------------------------------------------------------------------------- + +#~ Version changelog +#~ v0.1 - Script creation + + + diff --git a/docker/nextcloud/docker-compose.yml b/docker/nextcloud/docker-compose.yml new file mode 100644 index 0000000..6ebf048 --- /dev/null +++ b/docker/nextcloud/docker-compose.yml @@ -0,0 +1,92 @@ +services: + db: + image: mariadb:lts + container_name: nextcloud_db + command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW + volumes: + - /appli/data/nextcloud/db:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MARIADB_AUTO_UPGRADE=1 + networks: + - backend + restart: always + + redis: + image: redis:alpine + container_name: nextcloud_redis + networks: + - backend + restart: always + + core: + build: ./core + container_name: nextcloud_core + volumes: + - /appli/data/nextcloud/data:/var/www/html + - /data/cloud/Documents:/mnt/data/Documents + - /data/cloud/Ebook:/mnt/data/Ebook + - /data/photo:/mnt/data/photo + - /data/video:/mnt/data/video + - /data/download:/mnt/data/download + environment: + - MYSQL_HOST=db + - REDIS_HOST=redis + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + env_file: + - db.env + depends_on: + - db + - redis + networks: + - backend + healthcheck: + test: 'sh -c "/healthcheck.sh"' + interval: 1m + timeout: 5s + retries: 1 + start_period: 20s + restart: always + + web: + build: ./web + container_name: nextcloud_web + volumes: + - /appli/data/nextcloud/data:/var/www/html:ro + depends_on: + - core + networks: + - web + - backend + labels: + - traefik.enable=true + - traefik.http.routers.nextcloud.rule=Host(`${URL}`) + - traefik.http.routers.nextcloud.entrypoints=https + - traefik.http.routers.nextcloud.tls.certresolver=letsencrypt + - traefik.http.services.nextcloud.loadbalancer.server.port=80 + - traefik.http.middlewares.nextcloud.redirectregex.regex=/.well-known/(card|cal)dav + - traefik.http.middlewares.nextcloud.redirectregex.replacement=/remote.php/dav/ + restart: always + + cron: + image: nextcloud:31-fpm-alpine + container_name: nextcloud_cron + volumes: + - /appli/data/nextcloud/data:/var/www/html + entrypoint: /cron.sh + depends_on: + - db + - redis + networks: + - backend + restart: always + +networks: + backend: + web: + external: true diff --git a/docker/nextcloud/web/Dockerfile b/docker/nextcloud/web/Dockerfile new file mode 100644 index 0000000..9e620af --- /dev/null +++ b/docker/nextcloud/web/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine + +COPY nginx.conf /etc/nginx/nginx.conf diff --git a/docker/nextcloud/web/nginx.conf b/docker/nextcloud/web/nginx.conf new file mode 100644 index 0000000..d0be21a --- /dev/null +++ b/docker/nextcloud/web/nginx.conf @@ -0,0 +1,171 @@ +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + upstream php-handler { + server core:9000; + } + + server { + listen 80; + + # HSTS settings + # WARNING: Only add the preload option once you read about + # the consequences in https://hstspreload.org/. This option + # will add the domain to a hardcoded list that is shipped + # in all major browsers and getting removed from this list + # could take several months. + add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; + + # set max upload size + client_max_body_size 512M; + fastcgi_buffers 64 4K; + + # Enable gzip but do not remove ETag headers + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + # Pagespeed is not supported by Nextcloud, so if your server is built + # with the `ngx_pagespeed` module, uncomment this line to disable it. + #pagespeed off; + + # HTTP response headers borrowed from Nextcloud `.htaccess` + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Download-Options "noopen" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "none" always; + add_header X-XSS-Protection "1; mode=block" always; + + # Remove X-Powered-By, which is an information leak + fastcgi_hide_header X-Powered-By; + + # Path to the root of your installation + root /var/www/html; + + # Specify how to handle directories -- specifying `/index.php$request_uri` + # here as the fallback means that Nginx always exhibits the desired behaviour + # when a client requests a path that corresponds to a directory that exists + # on the server. In particular, if that directory contains an index.php file, + # that file is correctly served; if it doesn't, then the request is passed to + # the front-end controller. This consistent behaviour means that we don't need + # to specify custom rules for certain paths (e.g. images and other assets, + # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus + # `try_files $uri $uri/ /index.php$request_uri` + # always provides the desired behaviour. + index index.php index.html /index.php$request_uri; + + # Rule borrowed from `.htaccess` to handle Microsoft DAV clients + location = / { + if ( $http_user_agent ~ ^DavClnt ) { + return 302 /remote.php/webdav/$is_args$args; + } + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + # Make a regex exception for `/.well-known` so that clients can still + # access it despite the existence of the regex rule + # `location ~ /(\.|autotest|...)` which would otherwise handle requests + # for `/.well-known`. + location ^~ /.well-known { + # The rules in this block are an adaptation of the rules + # in `.htaccess` that concern `/.well-known`. + + location = /.well-known/carddav { return 301 /remote.php/dav/; } + location = /.well-known/caldav { return 301 /remote.php/dav/; } + + location /.well-known/acme-challenge { try_files $uri $uri/ =404; } + location /.well-known/pki-validation { try_files $uri $uri/ =404; } + + # Let Nextcloud's API for `/.well-known` URIs handle all other + # requests by passing them to the front-end controller. + return 301 /index.php$request_uri; + } + + # Rules borrowed from `.htaccess` to hide certain paths from clients + location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } + location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } + + # Ensure this block, which passes PHP files to the PHP process, is above the blocks + # which handle static assets (as seen below). If this block is not declared first, + # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php` + # to the URI, resulting in a HTTP 500 error response. + location ~ \.php(?:$|/) { + # Required for legacy support + rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri; + + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + set $path_info $fastcgi_path_info; + + try_files $fastcgi_script_name =404; + + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + #fastcgi_param HTTPS on; + + fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice + fastcgi_param front_controller_active true; # Enable pretty urls + fastcgi_pass php-handler; + + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + + location ~ \.(?:css|js|svg|gif)$ { + try_files $uri /index.php$request_uri; + expires 6M; # Cache-Control policy borrowed from `.htaccess` + access_log off; # Optional: Don't log access to assets + } + + location ~ \.woff2?$ { + try_files $uri /index.php$request_uri; + expires 7d; # Cache-Control policy borrowed from `.htaccess` + access_log off; # Optional: Don't log access to assets + } + + # Rule borrowed from `.htaccess` + location /remote { + return 301 /remote.php$request_uri; + } + + location / { + try_files $uri $uri/ /index.php$request_uri; + } + } +} + diff --git a/docker/ntfy/docker-compose.yml b/docker/ntfy/docker-compose.yml new file mode 100644 index 0000000..06c1faf --- /dev/null +++ b/docker/ntfy/docker-compose.yml @@ -0,0 +1,37 @@ +services: + ntfy: + image: binwiederhier/ntfy:v2.23 + container_name: ntfy + command: + - serve + volumes: + - /appli/data/ntfy/data:/var/cache/ntfy + environment: + - TZ=Europe/Paris + - NTFY_BASE_URL=https://${URL} + - NTFY_CACHE_FILE=/var/cache/ntfy/cache.db + - NTFY_AUTH_FILE=/var/cache/ntfy/auth.db + - NTFY_ATTACHMENT_CACHE_DIR=/var/cache/ntfy/attachments + - NTFY_AUTH_DEFAULT_ACCESS=deny-all + - NTFY_BEHIND_PROXY=true + - NTFY_ENABLE_LOGIN=true + user: 1000:1000 + networks: + - web + labels: + - traefik.enable=true + - traefik.http.routers.ntfy.rule=Host(`${URL}`) + - traefik.http.routers.ntfy.entrypoints=https + - traefik.http.routers.ntfy.tls.certresolver=letsencrypt + - traefik.http.services.ntfy.loadbalancer.server.port=80 + healthcheck: + test: ["CMD-SHELL", "wget -q --tries=1 http://ntfy:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1"] + interval: 60s + timeout: 10s + retries: 3 + start_period: 40s + restart: unless-stopped + +networks: + web: + external: true diff --git a/docker/phpipam/docker-compose.yml b/docker/phpipam/docker-compose.yml new file mode 100644 index 0000000..dbf5141 --- /dev/null +++ b/docker/phpipam/docker-compose.yml @@ -0,0 +1,62 @@ +services: + phpipam-web: + image: phpipam/phpipam-www:latest + container_name: phpipam_web + environment: + - TZ=Europe/Paris + - IPAM_DATABASE_HOST=phpipam-mariadb + - IPAM_DATABASE_PASS=${IPAM_DATABASE_PASS} + - IPAM_DATABASE_WEBHOST=% + - IPAM_TRUST_X_FORWARDED=true + volumes: + - /appli/data/phpipam/logo:/phpipam/css/images/logo + - /appli/data/phpipam/ca:/usr/local/share/ca-certificates:ro + depends_on: + - phpipam-mariadb + networks: + - web + - backend + labels: + - traefik.enable=true + - traefik.http.routers.phpipam.rule=Host(`${URL}`) + - traefik.http.routers.phpipam.entrypoints=https + - traefik.http.routers.phpipam.tls.certresolver=letsencrypt + - traefik.http.services.phpipam.loadbalancer.server.port=80 + restart: unless-stopped + + + phpipam-cron: + image: phpipam/phpipam-cron:latest + container_name: phpipam_cron + environment: + - TZ=Europe/Paris + - IPAM_DATABASE_HOST=phpipam-mariadb + - IPAM_DATABASE_PASS=${IPAM_DATABASE_PASS} + - SCAN_INTERVAL=1h + restart: unless-stopped + volumes: + - /appli/data/phpipam/ca:/usr/local/share/ca-certificates:ro + networks: + - lan + - backend + depends_on: + - phpipam-mariadb + + phpipam-mariadb: + image: mariadb:latest + container_name: phpipam_db + environment: + - TZ=Europe/Paris + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + volumes: + - /appli/data/phpipam/db:/var/lib/mysql + networks: + - backend + restart: unless-stopped + +networks: + backend: + lan: + external: true + web: + external: true diff --git a/docker/portainer/docker-compose.yml b/docker/portainer/docker-compose.yml new file mode 100644 index 0000000..6ff729c --- /dev/null +++ b/docker/portainer/docker-compose.yml @@ -0,0 +1,20 @@ +services: + portainer: + image: portainer/portainer-ce:2.40.0-alpine + container_name: portainer + volumes: + - /appli/data/portainer/data:/data + - /var/run/docker.sock:/var/run/docker.sock + networks: + - web + labels: + - traefik.enable=true + - traefik.http.routers.portainer.rule=Host(`${URL}`) + - traefik.http.routers.portainer.entrypoints=https + - traefik.http.routers.portainer.tls.certresolver=letsencrypt + - traefik.http.services.portainer.loadbalancer.server.port=9000 + restart: always + +networks: + web: + external: true diff --git a/docker/seedbox/docker-compose.yml b/docker/seedbox/docker-compose.yml new file mode 100644 index 0000000..f9a1265 --- /dev/null +++ b/docker/seedbox/docker-compose.yml @@ -0,0 +1,131 @@ +services: + + sonarr: + image: linuxserver/sonarr + container_name: sonarr + environment: + - PUID=3120 + - PGID=3120 + - TZ=Europe/Paris + volumes: + - /appli/data/seedbox/sonarr:/config + - /data/videos/Series:/tv + - /data/downloads:/downloads + networks: + - web + - backend + labels: + - traefik.enable=true + - traefik.http.routers.sonarr.rule=Host(`${URL_SONARR}`) + - traefik.http.routers.sonarr.entrypoints=https + - traefik.http.routers.sonarr.tls.certresolver=letsencrypt + - traefik.http.services.sonarr.loadbalancer.server.port=8989 + restart: unless-stopped + + radarr: + image: linuxserver/radarr + container_name: radarr + environment: + - PUID=3120 + - PGID=3120 + - TZ=Europe/Paris + volumes: + - /appli/data/seedbox/radarr:/config + - /data/videos/Films:/movies + - /data/downloads:/downloads + networks: + - backend + - web + labels: + - traefik.enable=true + - traefik.http.routers.radarr.rule=Host(`${URL_RADARR}`) + - traefik.http.routers.radarr.entrypoints=https + - traefik.http.routers.radarr.tls.certresolver=letsencrypt + - traefik.http.services.radarr.loadbalancer.server.port=7878 + restart: always + + prowlarr: + image: lscr.io/linuxserver/prowlarr:latest + container_name: prowlarr + environment: + - PUID=3120 + - PGID=3120 + - TZ=Europe/Paris + volumes: + - /appli/data/seedbox/prowlarr:/config + networks: + - backend + - web + labels: + - traefik.enable=true + - traefik.http.routers.prowlarr.rule=Host(`${URL_PROWLARR}`) + - traefik.http.routers.prowlarr.entrypoints=https + - traefik.http.routers.prowlarr.tls.certresolver=letsencrypt + - traefik.http.services.prowlarr.loadbalancer.server.port=9696 + restart: unless-stopped + + transmission: + image: linuxserver/transmission + container_name: transmission + environment: + - PUID=3120 + - PGID=3120 + - TZ=Europe/Paris + #- TRANSMISSION_WEB_HOME=/combustion-release/ #optional + - USER=${USER_TRANSMISSION} #optional + - PASS=${PASS_TRANSMISSION} #optional + volumes: + - /appli/data/seedbox/transmission:/config + - /data/downloads:/downloads + networks: + - backend + - web + ports: + - 51413:51413 + - 51413:51413/udp + labels: + - traefik.enable=true + - traefik.http.routers.transmission.rule=Host(`${URL_TRANSMISSION}`) + - traefik.http.routers.transmission.entrypoints=https + - traefik.http.routers.transmission.tls.certresolver=letsencrypt + - traefik.http.services.transmission.loadbalancer.server.port=9091 + restart: always + + flaresolverr: + #image: ghcr.io/flaresolverr/flaresolverr:pr-1282 + image: flaresolverr/flaresolverr + container_name: flaresolverr + environment: + - LOG_LEVEL=${LOG_LEVEL:-debug} + - LOG_HTML=${LOG_HTML:-false} + - CAPTCHA_SOLVER=${CAPTCHA_SOLVER:-none} + - TZ=Europe/Paris + restart: unless-stopped + networks: + - backend + + bazarr: + image: linuxserver/bazarr + container_name: bazarr + environment: + - PUID=3120 + - PGID=3120 + - TZ=Europe/Paris + volumes: + - /appli/data/seedbox/bazarr:/config + - /data/videos/Series:/tv + networks: + - backend + - web + labels: + - traefik.enable=true + - traefik.http.routers.bazarr.rule=Host(`${URL_BAZARR}`) + - traefik.http.routers.bazarr.entrypoints=https + - traefik.http.routers.bazarr.tls.certresolver=letsencrypt + - traefik.http.services.bazarr.loadbalancer.server.port=6767 + restart: unless-stopped + +networks: + backend: + web: + external: true diff --git a/docker/semaphore/docker-compose.yml b/docker/semaphore/docker-compose.yml new file mode 100644 index 0000000..fb11f1e --- /dev/null +++ b/docker/semaphore/docker-compose.yml @@ -0,0 +1,52 @@ +services: + semaphore: + image: semaphoreui/semaphore:v2.18.8 + container_name: semaphore_ui + environment: + - TZ=Europe/Paris + - SEMAPHORE_DB_USER=${POSTGRES_USER} + - SEMAPHORE_DB_PASS=${POSTGRES_PASSWORD} + - SEMAPHORE_DB_HOST=postgres + - SEMAPHORE_DB_PORT=5432 + - SEMAPHORE_DB_DIALECT=postgres + - SEMAPHORE_DB=${POSTGRES_DB} + - SEMAPHORE_PLAYBOOK_PATH=/tmp/semaphore/ + - SEMAPHORE_ADMIN_PASSWORD=${SEMAPHORE_ADMIN_PASSWORD} + - SEMAPHORE_ADMIN_NAME=${SEMAPHORE_ADMIN_NAME} + - SEMAPHORE_ADMIN_EMAIL=${SEMAPHORE_ADMIN_EMAIL} + - SEMAPHORE_ADMIN=${SEMAPHORE_ADMIN} + - SEMAPHORE_ACCESS_KEY_ENCRYPTION=${SEMAPHORE_ACCESS_KEY_ENCRYPTION} + - SEMAPHORE_LDAP_ACTIVATED='no' + volumes: + - /appli/docker/semaphore/requirements.txt:/etc/semaphore/requirements.txt + depends_on: + - postgres + networks: + - backend + - web + labels: + - traefik.enable=true + - traefik.http.routers.semaphore.rule=Host(`${URL}`) + - traefik.http.routers.semaphore.entrypoints=https + - traefik.http.routers.semaphore.tls.certresolver=letsencrypt + - traefik.http.services.semaphore.loadbalancer.server.port=3000 + restart: unless-stopped + + postgres: + image: postgres:14 + hostname: postgres + container_name: semaphore_postgres + volumes: + - /appli/data/semaphore/db:/var/lib/postgresql/data + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DB} + networks: + - backend + restart: unless-stopped + +networks: + backend: + web: + external: true diff --git a/docker/semaphore/requirements.txt b/docker/semaphore/requirements.txt new file mode 100644 index 0000000..fc3ca69 --- /dev/null +++ b/docker/semaphore/requirements.txt @@ -0,0 +1 @@ +proxmoxer>=2.3 \ No newline at end of file diff --git a/docker/stirling-pdf/docker-compose.yml b/docker/stirling-pdf/docker-compose.yml new file mode 100644 index 0000000..eb8cb57 --- /dev/null +++ b/docker/stirling-pdf/docker-compose.yml @@ -0,0 +1,22 @@ +services: + stirling-pdf: + image: stirlingtools/stirling-pdf:latest + container_name: stirling-pdf + restart: unless-stopped + volumes: + - /appli/data/stirling-pdf:/configs + environment: + - TZ=Europe/Paris + networks: + - web + labels: + - traefik.enable=true + - traefik.http.routers.stirling.rule=Host(`${URL}`) + - traefik.http.routers.stirling.entrypoints=https + - traefik.http.routers.stirling.tls=true + - traefik.http.routers.stirling.tls.certresolver=letsencrypt + - traefik.http.services.stirling.loadbalancer.server.port=8080 + +networks: + web: + external: true diff --git a/docker/traefik/docker-compose.yml b/docker/traefik/docker-compose.yml new file mode 100644 index 0000000..a40a778 --- /dev/null +++ b/docker/traefik/docker-compose.yml @@ -0,0 +1,40 @@ +services: + app: + image: traefik:3 + container_name: traefik + environment: + - TZ=Europe/Paris + ports: + - "80:80" + - "443:443" + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - /appli/data/traefik/files:/files + - /appli/data/traefik/certs/ca:/ca + - /appli/data/traefik/config/traefik.yml:/etc/traefik/traefik.yml + - /appli/data/traefik/config/users:/users + - /appli/data/traefik/acme.json:/acme.json + networks: + - web + labels: + - traefik.enable=true + # Dashboard + - traefik.http.routers.dashboard.rule=Host(`${URL}`) + - traefik.http.routers.dashboard.service=api@internal + - traefik.http.routers.dashboard.entrypoints=https + - traefik.http.routers.dashboard.tls=true + - traefik.http.routers.dashboard.tls.certresolver=letsencrypt + - traefik.http.routers.dashboard.middlewares=local-only@file + # Redirect HTTP to HTTPS + - traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`) + - traefik.http.routers.http-catchall.entrypoints=http + - traefik.http.routers.http-catchall.middlewares=redirect-to-https + - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https + # Dummy + - traefik.http.services.dummy-svc.loadbalancer.server.port=9999 + restart: always + +networks: + web: + external: true + diff --git a/docker/umami/docker-compose.yml b/docker/umami/docker-compose.yml new file mode 100644 index 0000000..ab22bad --- /dev/null +++ b/docker/umami/docker-compose.yml @@ -0,0 +1,52 @@ +services: + umami: + image: ghcr.io/umami-software/umami:3 + container_name: umami_server + environment: + - TZ=Europe/Paris + - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@umami_db:5432/${POSTGRES_DB} + - DATABASE_TYPE=postgresql + - APP_SECRET=${APP_SECRET} + - IGNORE_IP=${IGNORE_IP} + networks: + - backend + - web + labels: + - traefik.enable=true + - traefik.http.routers.umami.rule=Host(`${URL}`) + - traefik.http.routers.umami.entrypoints=https + - traefik.http.routers.umami.tls.certresolver=letsencrypt + - traefik.http.services.umami.loadbalancer.server.port=3000 + restart: on-failure + healthcheck: + test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"] + interval: 5s + timeout: 5s + retries: 5 + depends_on: + db: + condition: service_healthy + init: true + + db: + image: postgres:15-alpine + container_name: umami_db + environment: + POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + volumes: + - /appli/data/umami/:/var/lib/postgresql/data + networks: + - backend + restart: always + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 5s + timeout: 5s + retries: 5 + +networks: + backend: + web: + external: true diff --git a/docker/unifi/docker-compose.yml b/docker/unifi/docker-compose.yml new file mode 100644 index 0000000..d695548 --- /dev/null +++ b/docker/unifi/docker-compose.yml @@ -0,0 +1,68 @@ +services: + network_application: + image: lscr.io/linuxserver/unifi-network-application:10.6.101-ls143 + container_name: unifi_network_application + depends_on: + - db + environment: + - PUID=1000 + - PGID=1000 + - TZ=Europe/Paris + - MONGO_USER=${MONGO_USER} + - MONGO_PASS=${MONGO_PASS} + - MONGO_HOST=unifi_db + - MONGO_PORT=27017 + - MONGO_DBNAME=${MONGO_DBNAME} + - MONGO_AUTHSOURCE=${MONGO_AUTHSOURCE} + #- MEM_LIMIT=1024 #optional + #- MEM_STARTUP=1024 #optional + #- MONGO_TLS= #optional + volumes: + - /appli/data/unifi/config:/config + ports: + #- 443:443 + - 3478:3478/udp + - 10001:10001/udp + - 8080:8080 + - 1900:1900/udp #optional + - 8843:8843 #optional + - 8880:8880 #optional + - 6789:6789 #optional + - 5514:5514/udp #optional + networks: + - unifi + - web + - backend + labels: + - traefik.enable=true + - traefik.http.routers.unifi.rule=Host(`${URL}`) + - traefik.http.routers.unifi.entrypoints=https + - traefik.http.routers.unifi.tls.certresolver=letsencrypt + - traefik.http.services.unifi.loadbalancer.server.port=8443 + - traefik.http.services.unifi.loadbalancer.server.scheme=https + - traefik.http.services.unifi.loadbalancer.serversTransport=insecure@file + restart: unless-stopped + + db: + image: docker.io/mongo:8.0 + container_name: unifi_db + environment: + - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME} + - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD} + - MONGO_USER=${MONGO_USER} + - MONGO_PASS=${MONGO_PASS} + - MONGO_DBNAME=${MONGO_DBNAME} + - MONGO_AUTHSOURCE=${MONGO_AUTHSOURCE} + volumes: + - /appli/data/unifi/data:/data/db + - /appli/docker/unifi/init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh:ro + networks: + - backend + restart: unless-stopped + +networks: + backend: + unifi: + external: true + web: + external: true diff --git a/docker/unifi/init-mongo.sh b/docker/unifi/init-mongo.sh new file mode 100644 index 0000000..7313c61 --- /dev/null +++ b/docker/unifi/init-mongo.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if which mongosh > /dev/null 2>&1; then + mongo_init_bin='mongosh' +else + mongo_init_bin='mongo' +fi +"${mongo_init_bin}" <