Compare commits

..

10 Commits

Author SHA1 Message Date
5e7854b7f3 Add N8N and network changes 2025-07-23 16:53:14 +01:00
48a468088a add initial sensor configuration files 2025-07-16 17:07:57 +01:00
d2aa21b4de Use hostname instead of IP 2025-07-15 15:39:34 +01:00
5aedd3bbfc Throw logs to /tmp 2025-07-15 15:22:49 +01:00
01b8ceda76 Fix MD syntax 2025-07-15 15:14:43 +01:00
507833b7f4 Add local ip 2025-07-15 15:13:58 +01:00
e3691d643c Update domains 2025-07-15 15:12:47 +01:00
095b6d70ba Add prosody
currently broken
2025-07-15 15:02:06 +01:00
d96201f050 Add filebrowser 2025-07-15 11:38:11 +01:00
75f2b9824a Finish removing nc 2025-07-15 11:00:39 +01:00
10 changed files with 568 additions and 63 deletions

View File

@@ -83,19 +83,18 @@ if [ "$(pwd)" != "$HOME/dotfiles" ]; then
sudo apt update sudo apt update
sudo apt install -y git sudo apt install -y git
if ! git clone https://git.trude.dev/trude/dotfiles --depth 1; then if ! git clone https://git.trude.dev/trude/dotfiles --depth 1; then
echo "${RED}Error cloning dotfiles repository. Exiting...${NC}" echo "${RED}Error cloning dotfiles repository. Update skipped...${NC}"
exit 2
fi fi
cd dotfiles || exit cd dotfiles || exit
echo "${GREEN}dotfiles repository cloned successfully.${NC}" echo "${GREEN}dotfiles repository cloned successfully.${NC}"
else # else
echo "${YELLOW}Updating dotfiles repository...${NC}" # echo "${YELLOW}Updating dotfiles repository...${NC}"
pull_output=$(git pull) # pull_output=$(git pull)
echo "$pull_output" # echo "$pull_output"
if ! echo "$pull_output" | grep -q "Already up to date."; then # if ! echo "$pull_output" | grep -q "Already up to date."; then
echo "${YELLOW}Changes detected. Re-running script...${NC}" # echo "${YELLOW}Changes detected. Re-running script...${NC}"
exec "$0" "$@" # exec "$0" "$@"
fi # fi
fi fi
mkdir -p "$HOME/dotfiles/logs" mkdir -p "$HOME/dotfiles/logs"

View File

@@ -24,20 +24,20 @@ PIHOLE=/mnt/md0/pihole
FTLCONF_webserver_api_password="wX<|h(mav(;rGU}FTrz<)x<(J" 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' 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
GITEA=/mnt/md0/gitea GITEA=/mnt/md0/gitea
# FileBrowser
FILEBROWSER_DATA=/mnt/md0/files
FILEBROWSER_CONFIG=/mnt/md0/filebrowser/config
FILEBROWSER_DATABASE=/mnt/md0/filebrowser/database
# Prosody XMPP Server
PROSODY_CONFIG=/mnt/md0/prosody/config
PROSODY_LOGS=/tmp/prosody/logs
PROSODY_MODULES=/mnt/md0/prosody/modules
# N8N Automation
N8N_HOST=n8n.trude.dev
N8N_DATA=/mnt/md0/n8n/data
N8N_FILES=/mnt/md0/n8n/files

View File

@@ -18,10 +18,12 @@ services:
volumes: volumes:
- ${NGINX_DATA}:/data - ${NGINX_DATA}:/data
- ${NGINX_LETSENCRYPT}:/etc/letsencrypt - ${NGINX_LETSENCRYPT}:/etc/letsencrypt
networks:
- server-network
# --- Immich Server --- # --- Immich Server ---
immich-server: immich-server: # immich-server:2283
container_name: immich_server container_name: immich-server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
# extends: # extends:
# file: hwaccel.transcoding.yml # file: hwaccel.transcoding.yml
@@ -32,17 +34,17 @@ services:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
env_file: env_file:
- .env - .env
ports:
- "2283:2283"
depends_on: depends_on:
- redis - redis
- database - database
restart: always restart: unless-stopped
healthcheck: healthcheck:
disable: false disable: false
networks:
- server-network
immich-machine-learning: immich-machine-learning:
container_name: immich_machine_learning container_name: immich-machine-learning
# For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag. # For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag.
# Example tag: ${IMMICH_VERSION:-release}-cuda # Example tag: ${IMMICH_VERSION:-release}-cuda
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
@@ -53,19 +55,23 @@ services:
- model-cache:/cache - model-cache:/cache
env_file: env_file:
- .env - .env
restart: always restart: unless-stopped
healthcheck: healthcheck:
disable: false disable: false
networks:
- server-network
redis: redis:
container_name: immich_redis container_name: immich-redis
image: docker.io/valkey/valkey:8-bookworm@sha256:fec42f399876eb6faf9e008570597741c87ff7662a54185593e74b09ce83d177 image: docker.io/valkey/valkey:8-bookworm@sha256:fec42f399876eb6faf9e008570597741c87ff7662a54185593e74b09ce83d177
healthcheck: healthcheck:
test: redis-cli ping || exit 1 test: redis-cli ping || exit 1
restart: always restart: unless-stopped
networks:
- server-network
database: database:
container_name: immich_postgres container_name: immich-postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0 image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
environment: environment:
POSTGRES_PASSWORD: ${IMMICH_DB_PASSWORD} POSTGRES_PASSWORD: ${IMMICH_DB_PASSWORD}
@@ -77,7 +83,9 @@ services:
volumes: 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 # 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 - ${IMMICH_DB_DATA_LOCATION}:/var/lib/postgresql/data
restart: always restart: unless-stopped
networks:
- server-network
# --- Home Assistant --- # --- Home Assistant ---
homeassistant: homeassistant:
@@ -195,6 +203,23 @@ services:
# - SYS_NICE # - SYS_NICE
# restart: unless-stopped # restart: unless-stopped
# --- File Browser ---
filebrowser: # Replace with nextcloud
image: filebrowser/filebrowser:latest
container_name: filebrowser
restart: unless-stopped
ports:
- "8080:80"
volumes:
- ${FILEBROWSER_DATA}:/srv
- ${FILEBROWSER_CONFIG}:/config
- ${FILEBROWSER_DATABASE}:/database
environment:
- FB_DATABASE=/database/filebrowser.db
- FB_CONFIG=/config/filebrowser.json
env_file:
- .env
# --- Gitea --- # --- Gitea ---
gitea: gitea:
image: gitea/gitea:latest image: gitea/gitea:latest
@@ -207,7 +232,50 @@ services:
- "3001:3000" - "3001:3000"
- "22:22" - "22:22"
# --- Prosody XMPP Server ---
prosody:
image: prosody/prosody:latest
container_name: prosody
restart: unless-stopped
ports:
- "5222:5222" # XMPP client connections
- "5269:5269" # XMPP server-to-server connections
- "5280:5280" # HTTP/WebSocket connections
- "5281:5281" # HTTPS/WebSocket connections (if SSL configured)
volumes:
- ${PROSODY_CONFIG}:/etc/prosody
- ${PROSODY_LOGS}:/var/log/prosody
- ${PROSODY_MODULES}:/usr/lib/prosody-modules
env_file:
- .env
# --- N8n Automation ---
n8n:
image: n8nio/n8n:latest
restart: always
# N8n will not be directly exposed to the host, Nginx Proxy Manager will proxy to it
# Therefore, no 'ports' mapping is needed here for external access.
# It will be accessible on the Docker network by Nginx Proxy Manager.
environment:
- N8N_HOST=${N8N_HOST}
- N8N_PORT=5678
- N8N_PROTOCOL=https # Nginx Proxy Manager will handle HTTPS
- NODE_ENV=production
- WEBHOOK_URL=https://${N8N_HOST}/
- GENERIC_TIMEZONE=${TZ}
- N8N_RUNNERS_ENABLED=true
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
volumes:
- ${N8N_DATA}:/home/node/.n8n
- ${N8N_FILES}:/files
env_file:
- .env
volumes: volumes:
model-cache: model-cache:
nextcloud_aio_mastercontainer:
name: nextcloud_aio_mastercontainer # This line is not allowed to be changed. networks:
server-network:
driver: bridge
homeassistant-network:
driver: bridge

20
server/domains.md Normal file
View File

@@ -0,0 +1,20 @@
# Domains
- trude.dev (github pages site)
## External Domains
- ha.trude.dev (home assistant) (for phone tracking)
- git.trude.dev (gitea) (for public repos)
- chat.trude.dev (XMPP)
- muc.trude.dev (group chats)
- share.trude.dev (file sharing)
- proxy.trude.dev (compatibility)
- n8n.trude.dev
## Tailscale Access / Local
- server.local:81 (NGINX)
- server.local:2100 (PiHole)
- server.local:2283 (immich)
- server.local:8080 (file browser)

View File

@@ -0,0 +1,112 @@
esphome:
name: name
friendly_name: Name
# Boot sequence - start with WiFi connecting effect
on_boot:
- priority: 600
then:
- logger.log: "Device booting, starting WiFi connection"
- light.turn_on:
id: status_led
effect: "wifi_connecting"
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_AUDIO_BOARD_CUSTOM: "y"
psram:
mode: octal
speed: 80MHz
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "ZGLTCJYjvXIJA0LIP8o/k9Vp+Tia9AhHgXZ/WHCQ1gQ="
# API connection event handlers
on_client_connected:
- logger.log: "Home Assistant API connected"
- light.turn_off: status_led
on_client_disconnected:
- logger.log: "Home Assistant API disconnected"
- light.turn_on:
id: status_led
effect: "ha_connecting"
# Allow Over-The-Air updates
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# WiFi connection event handlers
on_connect:
- logger.log: "WiFi connected, attempting Home Assistant connection"
- light.turn_on:
id: status_led
effect: "ha_connecting"
on_disconnect:
- logger.log: "WiFi disconnected"
- light.turn_on:
id: status_led
effect: "wifi_connecting"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Living-Room-Sensor Hotspot"
password: !secret ota_password
# Status LED configuration
light:
- platform: esp32_rmt_led_strip
id: status_led
name: "Status LED"
pin: GPIO48
num_leds: 1
chipset: ws2812
rgb_order: GRB
effects:
# Yellow blinking during WiFi connection
- strobe:
name: "wifi_connecting"
colors:
- state: true
brightness: 80%
red: 100%
green: 100%
blue: 0%
duration: 500ms
- state: false
duration: 500ms
# Orange blinking during Home Assistant connection
- strobe:
name: "ha_connecting"
colors:
- state: true
brightness: 80%
red: 100%
green: 65%
blue: 0%
duration: 300ms
- state: false
duration: 300ms
button:
- platform: restart
name: "Restart Sensor"
id: restart_button

View File

@@ -0,0 +1,183 @@
esphome:
name: esphome-web-e28960
friendly_name: Living Room Sensor
min_version: 2025.5.0
name_add_mac_suffix: false
# Boot sequence - start with WiFi connecting effect
on_boot:
- priority: 600
then:
- logger.log: "Device booting, starting WiFi connection"
- light.turn_on:
id: status_led
effect: "wifi_connecting"
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_AUDIO_BOARD_CUSTOM: "y"
psram:
mode: octal
speed: 80MHz
# Enable logging
logger:
# UART configuration for LD2420 mmWave sensor
uart:
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 115200
parity: NONE
stop_bits: 1
# Enable Home Assistant API
api:
encryption:
key: "ZGLTCJYjvXIJA0LIP8o/k9Vp+Tia9AhHgXZ/WHCQ1gQ="
# API connection event handlers
on_client_connected:
- logger.log: "Home Assistant API connected"
- light.turn_off: status_led
on_client_disconnected:
- logger.log: "Home Assistant API disconnected"
- light.turn_on:
id: status_led
effect: "ha_connecting"
# Allow Over-The-Air updates
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# WiFi connection event handlers
on_connect:
- logger.log: "WiFi connected, attempting Home Assistant connection"
- light.turn_on:
id: status_led
effect: "ha_connecting"
on_disconnect:
- logger.log: "WiFi disconnected"
- light.turn_on:
id: status_led
effect: "wifi_connecting"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Living-Room-Sensor Hotspot"
password: !secret ota_password
# Status LED configuration
light:
- platform: esp32_rmt_led_strip
id: status_led
name: "Status LED"
pin: GPIO48
num_leds: 1
chipset: ws2812
rgb_order: GRB
effects:
# Yellow blinking during WiFi connection
- strobe:
name: "wifi_connecting"
colors:
- state: true
brightness: 80%
red: 100%
green: 100%
blue: 0%
duration: 500ms
- state: false
duration: 500ms
# Orange blinking during Home Assistant connection
- strobe:
name: "ha_connecting"
colors:
- state: true
brightness: 80%
red: 100%
green: 65%
blue: 0%
duration: 300ms
- state: false
duration: 300ms
button:
- platform: restart
name: "Restart Sensor"
id: restart_button
- platform: ld2420
apply_config:
name: Apply Config
factory_reset:
name: Factory Reset
restart_module:
name: Restart Module
revert_config:
name: Undo Edits
# DHT-22 Temperature and Humidity Sensor
sensor:
- platform: dht
pin: GPIO4
model: DHT22
temperature:
name: "Living Room Temperature"
id: living_room_temperature
humidity:
name: "Living Room Humidity"
id: living_room_humidity
update_interval: 60s
- platform: ld2420
moving_distance:
name: Moving Distance
# LD2420 Presence Sensor
ld2420:
text_sensor:
- platform: ld2420
fw_version:
name: LD2420 Firmware
binary_sensor:
- platform: ld2420
has_target:
name: Presence
select:
- platform: ld2420
operating_mode:
name: Operating Mode
number:
- platform: ld2420
presence_timeout:
name: Detection Presence Timeout
min_gate_distance:
name: Detection Gate Minimum
max_gate_distance:
name: Detection Gate Maximum
# See "Number" section below for detail
gate_select:
name: Select Gate to Set
still_threshold:
name: Set Still Threshold Value
move_threshold:
name: Set Move Threshold Value

View File

@@ -0,0 +1,144 @@
esphome:
name: office-sensor
friendly_name: Office Sensor
# Boot sequence - start with WiFi connecting effect
on_boot:
- priority: 600
then:
- logger.log: "Device booting, starting WiFi connection"
- light.turn_on:
id: status_led
effect: "wifi_connecting"
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_AUDIO_BOARD_CUSTOM: "y"
psram:
mode: octal
speed: 80MHz
# Enable logging
logger:
# I2C configuration for sensors
i2c:
sda: GPIO4
scl: GPIO5
scan: true
id: scd40_bus
# Enable Home Assistant API
api:
encryption:
key: "ZGLTCJYjvXIJA0LIP8o/k9Vp+Tia9AhHgXZ/WHCQ1gQ="
# API connection event handlers
on_client_connected:
- logger.log: "Home Assistant API connected"
- light.turn_off: status_led
on_client_disconnected:
- logger.log: "Home Assistant API disconnected"
- light.turn_on:
id: status_led
effect: "ha_connecting"
actions:
- action: calibrate_co2_value
variables:
co2_ppm: int
then:
- scd4x.perform_forced_calibration:
value: !lambda "return co2_ppm;"
id: scd40_sensor
- action: factory_reset_co2_sensor
then:
- scd4x.factory_reset: scd40_sensor
# Allow Over-The-Air updates
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# WiFi connection event handlers
on_connect:
- logger.log: "WiFi connected, attempting Home Assistant connection"
- light.turn_on:
id: status_led
effect: "ha_connecting"
on_disconnect:
- logger.log: "WiFi disconnected"
- light.turn_on:
id: status_led
effect: "wifi_connecting"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Living-Room-Sensor Hotspot"
password: !secret ota_password
# Status LED configuration
light:
- platform: esp32_rmt_led_strip
id: status_led
name: "Status LED"
pin: GPIO48
num_leds: 1
chipset: ws2812
rgb_order: GRB
effects:
# Yellow blinking during WiFi connection
- strobe:
name: "wifi_connecting"
colors:
- state: true
brightness: 80%
red: 100%
green: 100%
blue: 0%
duration: 500ms
- state: false
duration: 500ms
# Orange blinking during Home Assistant connection
- strobe:
name: "ha_connecting"
colors:
- state: true
brightness: 80%
red: 100%
green: 65%
blue: 0%
duration: 300ms
- state: false
duration: 300ms
# SCD40 CO2, Temperature, and Humidity Sensor
sensor:
- platform: scd4x
id: scd40_sensor
co2:
name: "Office CO2"
temperature:
name: "Office Temperature"
humidity:
name: "Office Humidity"
measurement_mode: low_power_periodic
update_interval: 30s
button:
- platform: restart
name: "Restart Sensor"
id: restart_button

View File

@@ -37,3 +37,7 @@ sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin d
echo "Docker installation complete!" echo "Docker installation complete!"
docker --version docker --version
echo "Allowing Docker use without sudo..."
sudo usermod -aG docker ${USER}
exec sg docker newgrp

View File

@@ -1,2 +0,0 @@
#! /bin/sh
docker exec -u www-data -it nextcloud-aio-nextcloud php "$@"

View File

@@ -1,23 +0,0 @@
#! /bin/sh
sudo apt install miniupnpc
LOCAL_IP=$(hostname -I | awk '{print $1}')
# NGINX PROXY MANAGER
upnpc -a $LOCAL_IP 80 80 tcp
upnpc -a $LOCAL_IP 443 443 tcp
#upnpc -a $LOCAL_IP 81 81 tcp # Admin UI
# NEXTCLOUD
upnpc -a $LOCAL_IP 11000 11000 tcp
#upnpc -a $LOCAL_IP 8080 8080 tcp # AIO
#upnpc -a $LOCAL_IP 3478 3478 tcp # talk
#upnpc -a $LOCAL_IP 3478 3478 udp # talk
# GIT
upnpc -a $LOCAL_IP 3001 3001 tcp
# SSH
upnpc -a $LOCAL_IP 22 22 tcp
upnpc -l