Compare commits

...

18 Commits

Author SHA1 Message Date
d763b06675 Add XMPP 2025-07-29 18:32:41 +01:00
2504662bbd Work on the compose file 2025-07-26 17:11:51 +01:00
f273a49cf6 Removed PiHole 2025-07-24 17:33:34 +01:00
7394deae26 Add immich and pihole 2025-07-23 19:35:39 +01:00
e949a1cf6e update scripts and work on server setup 2025-07-23 18:43:58 +01:00
9f1f96500b Add N8N and network changes 2025-07-23 16:53:14 +01:00
3dca6ba75d Use hostname instead of IP 2025-07-15 15:39:34 +01:00
cdedfb482a Throw logs to /tmp 2025-07-15 15:22:49 +01:00
80c45ce80b Fix MD syntax 2025-07-15 15:14:43 +01:00
3a0b4da44a Add local ip 2025-07-15 15:13:58 +01:00
687d91d3d2 Update domains 2025-07-15 15:12:47 +01:00
d6fa6a497a Add prosody
currently broken
2025-07-15 15:02:06 +01:00
c8c049fa5d Add filebrowser 2025-07-15 11:38:11 +01:00
fb70f490de Finish removing nc 2025-07-15 11:00:39 +01:00
857fe04865 Add ESPHome 2025-07-14 22:50:09 +01:00
07595e717a Set NGINX to use the default network 2025-07-05 17:03:02 +01:00
524355076f Switch from GitHub to TrudeGIT 2025-07-05 14:17:45 +01:00
8a3ece91d0 Build server setup using docker-compose 2025-07-05 12:17:16 +01:00
12 changed files with 200 additions and 167 deletions

View File

@@ -13,5 +13,5 @@ The 'main' branch is my current configuration, while others serve as an archive
To install my current configuration, run: To install my current configuration, run:
```sh ```sh
sh <(curl -s https://raw.githubusercontent.com/TrudeEH/dotfiles/refs/heads/main/install.sh) sh <(curl -s https://git.trude.dev/trude/dotfiles/raw/branch/main/install.sh)
``` ```

View File

@@ -82,22 +82,20 @@ if [ "$(pwd)" != "$HOME/dotfiles" ]; then
echo "${YELLOW}Cloning dotfiles repository...${NC}" echo "${YELLOW}Cloning dotfiles repository...${NC}"
sudo apt update sudo apt update
sudo apt install -y git sudo apt install -y git
if ! git clone https://github.com/TrudeEH/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"
@@ -216,7 +214,7 @@ if [ "$USER" = "trude" ]; then
echo "${YELLOW}Cloning password-store...${NC}" echo "${YELLOW}Cloning password-store...${NC}"
chmod 700 ~/.ssh chmod 700 ~/.ssh
chmod 600 ~/.ssh/* chmod 600 ~/.ssh/*
if ! git clone git@github.com:TrudeEH/password-store.git "$HOME/.password-store"; then if ! git clone git@git.trude.dev:trude/password-store.git "$HOME/.password-store"; then
echo "${RED}Error cloning password-store.${NC}" echo "${RED}Error cloning password-store.${NC}"
else else
echo "${GREEN}Password-store cloned successfully.${NC}" echo "${GREEN}Password-store cloned successfully.${NC}"

66
scripts/disk-array Executable file
View File

@@ -0,0 +1,66 @@
#!/bin/sh
# Variables (edit these as needed)
ARRAY_NAME="md0"
MOUNT_POINT="/mnt/md0"
MDADM_CONF="/etc/mdadm/mdadm.conf"
# Colors
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
MAGENTA="\e[35m"
CYAN="\e[36m"
BOLD="\e[1m"
NC="\e[0m"
echo "${CYAN}${BOLD}=== RAID Array Setup Script ===${NC}"
if ! sudo mdadm --help >/dev/null 2>&1; then
echo "${YELLOW}[+]${NC} Installing mdadm package..."
sudo apt install mdadm -y
echo "${GREEN}[✓]${NC} mdadm installed successfully"
else
echo "${GREEN}[✓]${NC} mdadm is already installed"
fi
# Check if array is already assembled
if [ "/dev/${ARRAY_NAME}" ]; then
echo "${GREEN}[✓]${NC} Array /dev/${ARRAY_NAME} exists."
sudo mdadm --detail "/dev/${ARRAY_NAME}"
cat /proc/mdstat
# Check if array is degraded
if sudo mdadm --detail "/dev/${ARRAY_NAME}" | grep -q "degraded"; then
echo "${RED}[!] WARNING:${NC} Array is degraded! Check which drives need to be re-added."
echo "${YELLOW}[i]${NC} You may need to run: ${CYAN}sudo mdadm --manage /dev/${ARRAY_NAME} --re-add <missing_drive>${NC}"
fi
else
echo "${YELLOW}[+]${NC} Assembling RAID array..."
sudo mdadm --assemble --scan
fi
# Optionally update mdadm.conf
if ! grep -q "/dev/${ARRAY_NAME}" "$MDADM_CONF"; then
echo "${YELLOW}[+]${NC} Updating $MDADM_CONF..."
sudo mdadm --detail --scan | sudo tee -a "$MDADM_CONF"
fi
# Mount the array
if [ ! -d "$MOUNT_POINT" ]; then
sudo mkdir -p "$MOUNT_POINT"
echo "${GREEN}[✓]${NC} Mount point created"
fi
if ! mountpoint -q "$MOUNT_POINT"; then
echo "${YELLOW}[+]${NC} Mounting /dev/${ARRAY_NAME} to $MOUNT_POINT..."
sudo mount "/dev/${ARRAY_NAME}" "$MOUNT_POINT"
echo "${GREEN}[✓]${NC} Array mounted successfully at $MOUNT_POINT"
else
echo "${GREEN}[✓]${NC} Array is already mounted at $MOUNT_POINT"
fi
echo "${CYAN}${BOLD}=== Setup Complete ===${NC}"
echo "${CYAN}[i]${NC} Array device: ${CYAN}/dev/${ARRAY_NAME}${NC}"
echo "${CYAN}[i]${NC} Mount point: ${CYAN}$MOUNT_POINT${NC}"

61
scripts/install-docker Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/sh
# Colors
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
MAGENTA="\e[35m"
CYAN="\e[36m"
GRAY="\e[90m"
BOLD="\e[1m"
NC="\e[0m"
echo "${CYAN}${BOLD}=== Docker Installation Script ===${NC}"
echo "${YELLOW}[+]${NC} Updating APT..."
echo "${GRAY}"
sudo apt-get update
echo "${NC}"
echo "${YELLOW}[+]${NC} Installing required packages..."
echo "${GRAY}"
sudo apt-get install -y ca-certificates curl gnupg lsb-release
echo "${NC}"
echo "${YELLOW}[+]${NC} Adding Docker's official GPG key..."
echo "${GRAY}"
sudo mkdir -p /etc/apt/keyrings
curl -fsSL "https://download.docker.com/linux/$(
. /etc/os-release
echo "$ID"
)/gpg" | sudo gpg --dearmor >/tmp/docker.gpg
sudo mv /tmp/docker.gpg /etc/apt/keyrings/docker.gpg
sudo chmod 644 /etc/apt/keyrings/docker.gpg
echo "${YELLOW}[+]${NC} Setting up the Docker repository..."
echo "${GRAY}"
ARCH=$(dpkg --print-architecture)
OS_ID=$(awk -F= '/^ID=/{gsub(/\"/, "", $2); print $2}' /etc/os-release)
RELEASE=$(lsb_release -cs)
echo "deb [arch=$ARCH signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$OS_ID $RELEASE stable" |
sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
echo "${YELLOW}[+]${NC} Updating APT..."
echo "${GRAY}"
sudo apt-get update
echo "${NC}"
echo "${YELLOW}[+]${NC} Installing Docker Engine..."
echo "${GRAY}"
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
echo "${GREEN}[✓]${NC} Docker installation complete!"
echo "${GRAY}"
docker --version
echo "${NC}"
echo "${YELLOW}[+]${NC} Allowing Docker use without sudo..."
echo "${GRAY}"
sudo usermod -aG docker ${USER}
exec sg docker newgrp
echo "${NC}${GREEN}[✓]${NC} User added to docker group"

View File

@@ -1,14 +0,0 @@
#! /bin/sh
# This script is a temporary solution to a GNOME bug where the cursor leaves the game window instead of being locked to the screen.
sudo apt install gamescope
flatpak install com.valvesoftware.Steam
flatpak install org.freedesktop.Platform.VulkanLayer.gamescope
echo
echo
echo 'If the cursor escapes the screen in a game, enable gamescope with the launch arguments: `gamescope -- %command%`.'
echo 'Add the `--force-grab-cursor` flag if the issue persists.'
echo 'Add the `-f` flag to launch in fullscreen.'
echo 'Add the `-h 720 -H 1440 -F fsr` flags to upscale the game (change the values accordingly).'
echo 'You can use gamescope outside of Steam as well. Replace `%command%` with the launch command for your game.'

View File

@@ -1,17 +1,33 @@
#! /bin/sh #! /bin/sh
YELLOW="\e[33m" YELLOW="\e[33m"
GRAY="\e[90m"
NC="\e[0m" NC="\e[0m"
printf "%b\n" "${YELLOW}Updating apt...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Updating repos..."
sudo apt update printf "%b" "${GRAY}"
sudo apt upgrade sudo apt-get update
sudo apt full-upgrade printf "%b" "${NC}"
sudo apt autoremove
sudo apt autoclean printf "%b\n" "${YELLOW}[+]${NC} Upgrading packages..."
printf "%b" "${GRAY}"
sudo apt-get full-upgrade
printf "%b" "${NC}"
printf "%b\n" "${YELLOW}[+]${NC} Removing orphaned dependencies..."
printf "%b" "${GRAY}"
sudo apt-get autoremove
printf "%b" "${NC}"
printf "%b\n" "${YELLOW}[+]${NC} Cleaning up..."
printf "%b" "${GRAY}"
sudo apt-get autoclean
printf "%b" "${NC}"
if command -v flatpak >/dev/null 2>&1; then if command -v flatpak >/dev/null 2>&1; then
printf "%b\n" "${YELLOW}Updating flatpak...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Updating flatpak packages..."
printf "%b" "${GRAY}"
flatpak update flatpak update
flatpak uninstall --unused --delete-data flatpak uninstall --unused --delete-data
printf "%b" "${NC}"
fi fi

5
server/close-all-ports.sh → scripts/upnpc-close Normal file → Executable file
View File

@@ -1,4 +1,9 @@
#!/bin/sh #!/bin/sh
# Close all upnpc ports
sudo apt install miniupnpc -y
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

33
server/.env Normal file
View File

@@ -0,0 +1,33 @@
TZ=Europe/Lisbon
# Nginx
NGINX_DATA=/mnt/md0/nginx/data
NGINX_LETSENCRYPT=/mnt/md0/nginx/letsencrypt
# Nextcloud
NEXTCLOUD_DATA=/mnt/md0/nextcloud/data
NEXTCLOUD_DB_DATA=/mnt/md0/nextcloud/db
NEXTCLOUD_DB_PASSWORD=K7m9P2xQ8vN3rY6sL4dF1jH5eW9zB2cX
NC_DOMAIN=nc.trude.dev
REDIS_PASSWORD=R3d1sP@ssw0rd2025SecureCache
# Gitea
GITEA=/mnt/md0/gitea
# N8N Automation
N8N_HOST=n8n.trude.dev
N8N_DATA=/mnt/md0/n8n/data
N8N_FILES=/mnt/md0/n8n/files
# Home Assistant
HA_CONFIG=/mnt/md0/ha/config
PIPER_DATA=/mnt/md0/ha/piper-data
WHISPER_DATA=/mnt/md0/ha/whisper-data
# ESPHome
ESPHOME_CONFIG=/mnt/md0/esphome/config
# Ejabberd
EJABBERD_CONF=/mnt/md0/ejabberd/conf
EJABBERD_DB_DATA=/mnt/md0/ejabberd/db
EJABBERD_DB_PASSWORD=zX7weGFvRJo8ElLun0e74hRQV6vrYN

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.

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,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