Build server setup using docker-compose

This commit is contained in:
2025-07-05 12:17:16 +01:00
parent c07b827d9e
commit ab933fad27
5 changed files with 254 additions and 107 deletions

42
server/.env Normal file
View File

@@ -0,0 +1,42 @@
# Nginx
NGINX_DATA=/mnt/md0/nginx/data
NGINX_LETSENCRYPT=/mnt/md0/nginx/letsencrypt
# Immich
TZ=Europe/Lisbon
IMMICH_UPLOAD_LOCATION=/mnt/md0/immich/uploads
IMMICH_DB_DATA_LOCATION=/mnt/md0/immich/db
IMMICH_VERSION=release
IMMICH_DB_PASSWORD=postgres
IMMICH_DB_USERNAME=postgres # Do not change
IMMICH_DB_DATABASE_NAME=immich # Do not change
# Home Assistant
HA_CONFIG=/mnt/md0/ha/config
OWW_CUSTOM_MODEL_DIR=/mnt/md0/ha/openwakeword-model
OWW_DATA=/mnt/md0/ha/openwakeword-data
PIPER_DATA=/mnt/md0/ha/piper-data
WHISPER_DATA=/mnt/md0/ha/whisper-data
# Pi-hole
PIHOLE=/mnt/md0/pihole
FTLCONF_webserver_api_password="wX<|h(mav(;rGU}FTrz<)x<(J"
FTLCONF_dns_listeningMode=all # If using Docker's default `bridge` network setting the dns listening mode should be set to 'all'
# Nextcloud
NEXTCLOUD_DATADIR=/mnt/md0/nextcloud # Do not set or adjust this value after the initial Nextcloud installation is done!
# AIO_COMMUNITY_CONTAINERS="local-ai memories" # Community containers https://github.com/nextcloud/all-in-one/tree/main/community-containers
APACHE_PORT=11000 # Use this port in Nginx Proxy Manager
# NC_TRUSTED_PROXIES=172.18.0.3 # this is the NPM proxy ip address in the docker network !
FULLTEXTSEARCH_JAVA_OPTIONS="-Xms512M -Xmx512M"
# NEXTCLOUD_MOUNT=/mnt/ # Allows the Nextcloud container to access the chosen directory on the host.
NEXTCLOUD_UPLOAD_LIMIT=2000G
NEXTCLOUD_MAX_TIME=7200
NEXTCLOUD_MEMORY_LIMIT=2052M
NEXTCLOUD_ENABLE_DRI_DEVICE=true # Intel QuickSync
SKIP_DOMAIN_VALIDATION=false # This should only be set to true if things are correctly configured.
TALK_PORT=3478 # This allows to adjust the port that the talk container is using which is exposed on the host. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-talk-port
# extra_hosts=cloud.example.com:8.8.8.8 # Uncomment and edit if your domain is not resolving correctly.
# Gitea
GITEA=/mnt/md0/gitea

View File

@@ -1,56 +0,0 @@
# docker compose down --volumes
# docker compose up -d --remove-orphans
services:
nginx-proxy-manager:
image: "docker.io/jc21/nginx-proxy-manager:2.12.3"
restart: unless-stopped
container_name: nginx-proxy-manager
network_mode: host
environment: # Uncomment this if IPv6 is not enabled on your host
- DISABLE_IPV6=true # Uncomment this if IPv6 is not enabled on your host
volumes:
- ./npm/data:/data
- ./npm/letsencrypt:/etc/letsencrypt
nextcloud-aio-mastercontainer:
image: ghcr.io/nextcloud-releases/all-in-one:latest
init: true
restart: always
container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed.
network_mode: bridge
volumes:
- nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed.
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- 8080:8080
environment:
#AIO_COMMUNITY_CONTAINERS: "local-ai memories" # Community containers https://github.com/nextcloud/all-in-one/tree/main/community-containers
APACHE_PORT: 11000 # Use this port in Nginx Proxy Manager
# NC_TRUSTED_PROXIES: 172.18.0.3 # this is the NPM proxy ip address in the docker network !
FULLTEXTSEARCH_JAVA_OPTIONS: "-Xms1024M -Xmx1024M"
NEXTCLOUD_DATADIR: /server/ncdata # ⚠️ Warning: do not set or adjust this value after the initial Nextcloud installation is done!
# NEXTCLOUD_MOUNT: /mnt/ # Allows the Nextcloud container to access the chosen directory on the host.
NEXTCLOUD_UPLOAD_LIMIT: 2000G
NEXTCLOUD_MAX_TIME: 7200
NEXTCLOUD_MEMORY_LIMIT: 2052M
NEXTCLOUD_ENABLE_DRI_DEVICE: true # Intel QuickSync
SKIP_DOMAIN_VALIDATION: false # This should only be set to true if things are correctly configured.
TALK_PORT: 3478 # This allows to adjust the port that the talk container is using which is exposed on the host. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-talk-port
#extra_hosts:
# - cloud.example.com:8.8.8.8 # Uncomment and edit if your domain is not resolving correctly.
gitea:
image: gitea/gitea:latest
restart: unless-stopped
volumes:
- /opt/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3001:3000"
- "3022:22"
volumes:
nextcloud_aio_mastercontainer:
name: nextcloud_aio_mastercontainer # This line is not allowed to be changed.

209
server/docker-compose.yml Normal file
View File

@@ -0,0 +1,209 @@
# docker compose down --volumes
# docker compose up -d --remove-orphans
name: server
services:
# --- NGINX Proxy Manager ---
nginx-proxy-manager:
image: "docker.io/jc21/nginx-proxy-manager:latest"
restart: unless-stopped
container_name: nginx-proxy-manager
network_mode: host
environment: # Uncomment this if IPv6 is not enabled on your host
- DISABLE_IPV6=true # Uncomment this if IPv6 is not enabled on your host
volumes:
- ${NGINX_DATA}:/data
- ${NGINX_LETSENCRYPT}:/etc/letsencrypt
# --- Immich Server ---
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
- ${IMMICH_UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
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, rocm, openvino, rknn] 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, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
volumes:
- model-cache:/cache
env_file:
- .env
restart: always
healthcheck:
disable: false
redis:
container_name: immich_redis
image: docker.io/valkey/valkey:8-bookworm@sha256:fec42f399876eb6faf9e008570597741c87ff7662a54185593e74b09ce83d177
healthcheck:
test: redis-cli ping || exit 1
restart: always
database:
container_name: immich_postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
environment:
POSTGRES_PASSWORD: ${IMMICH_DB_PASSWORD}
POSTGRES_USER: ${IMMICH_DB_USERNAME}
POSTGRES_DB: ${IMMICH_DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: "--data-checksums"
# Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs
B_STORAGE_TYPE: "HDD"
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
- ${IMMICH_DB_DATA_LOCATION}:/var/lib/postgresql/data
restart: always
# --- Home Assistant ---
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
env_file:
- .env
volumes:
- ${HA_CONFIG}:/config
- /etc/localtime:/etc/localtime:ro
- /run/dbus:/run/dbus:ro
restart: unless-stopped
# devices:
# - /dev/ttyUSB0:/dev/ttyUSB0
privileged: true
#network_mode: host
ports:
- "8123:8123"
# openwakeword:
# image: homeassistant/amd64-addon-openwakeword:latest
# container_name: openwakeword
# entrypoint: python3
# command: >
# -m wyoming_openwakeword
# --uri 'tcp://0.0.0.0:10400'
# --preload-model 'ok_nabu'
# --custom-model-dir /share/openwakeword
# env_file:
# - .env
# ports:
# - 10400:10400
# volumes:
# - ${OWW_DATA}:/data
# - ${OWW_CUSTOM_MODEL_DIR}:/share/openwakeword
# restart: unless-stopped
piper:
image: homeassistant/amd64-addon-piper:latest
container_name: piper
entrypoint: python3
command: >
-m wyoming_piper
--piper '/usr/share/piper/piper'
--uri 'tcp://0.0.0.0:10200'
--length-scale "1"
--noise-scale "0.667"
--speaker "0"
--voice "en_US-lessac-medium"
--max-piper-procs "1"
--data-dir /data
--data-dir /share/piper
--download-dir /data
ports:
- "10200:10200"
volumes:
- ${PIPER_DATA}:/data
restart: unless-stopped
whisper:
image: homeassistant/amd64-addon-whisper:latest
container_name: whisper
entrypoint: python3
command: >
-m wyoming_faster_whisper
--uri tcp://0.0.0.0:10300
--model small-int8
--beam-size 1
--language en
--data-dir /data
--download-dir /data
ports:
- "10300:10300"
env_file:
- .env
volumes:
- ${WHISPER_DATA}:/data
restart: unless-stopped
# --- Pi-hole ---
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
# DNS Ports
- "53:53/tcp"
- "53:53/udp"
# Default HTTP Port
- "2100:80/tcp"
- "2101:443/tcp"
env_file:
- .env
volumes:
- "${PIHOLE}:/etc/pihole"
cap_add:
# Optional, if Pi-hole should get some more processing time
- SYS_NICE
restart: unless-stopped
# --- Nextcloud ---
nextcloud-aio-mastercontainer:
image: ghcr.io/nextcloud-releases/all-in-one:latest
init: true
restart: unless-stopped
container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed.
network_mode: bridge
volumes:
- nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed.
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- 8080:8080
env_file:
- .env
# --- Gitea ---
gitea:
image: gitea/gitea:latest
restart: unless-stopped
volumes:
- ${GITEA}:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3001:3000"
- "3022:22"
volumes:
model-cache:
nextcloud_aio_mastercontainer:
name: nextcloud_aio_mastercontainer # This line is not allowed to be changed.

View File

@@ -1,51 +0,0 @@
#! /bin/sh
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
MAGENTA="\e[35m"
CYAN="\e[36m"
BOLD="\e[1m"
NC="\e[0m"
trap 'printf "${RED}install.sh interrupted.${NC}"; exit 1' INT TERM
../scripts/update
echo "${YELLOW}Before starting the script, mount your storage device for the server @ /server, then press ENTER to continue. If you wish to use the /root drive, skip this step.${NC}"
SRV_DATA="/server" # Change on the compose file as well!
read
echo "${YELLOW}Installing Docker...${NC}"
# Add Docker's official GPG key
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" |
sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Add user to docker group (to remove the need to use sudo)
sudo usermod -aG docker $USER
echo "${YELLOW}Running compose...${NC}"
sudo mkdir $SRV_DATA
cd $SRV_DATA
sudo chown -R 1000:1000 $SRV_DATA
mkdir ncdata
docker compose up -d --remove-orphans
LOCAL_IP=$(hostname -I | awk '{print $1}')
echo
echo "${CYAN}Ports:"
echo "Nextcloud: http://$LOCAL_IP:11000"
echo "Nextcloud AIO: https://$LOCAL_IP:8080"
echo "Gitea: http://$LOCAL_IP:3001"
echo "Nginx Proxy Manager: https://$LOCAL_IP:81"
echo "${NC}"

View File

@@ -1,4 +1,7 @@
#!/bin/sh #!/bin/sh
# Close all upnpc ports
upnpc -l | sed -n 's/^[[:space:]]*[0-9]\+\s\+\(TCP\|UDP\)\s\+\([0-9]\+\).*/\1 \2/p' | while read proto port; do upnpc -l | sed -n 's/^[[:space:]]*[0-9]\+\s\+\(TCP\|UDP\)\s\+\([0-9]\+\).*/\1 \2/p' | while read proto port; do
upnpc -d "$port" "$proto" upnpc -d "$port" "$proto"
done done