Compare commits
18 Commits
main
...
d763b06675
| Author | SHA1 | Date | |
|---|---|---|---|
| d763b06675 | |||
| 2504662bbd | |||
| f273a49cf6 | |||
| 7394deae26 | |||
| e949a1cf6e | |||
| 9f1f96500b | |||
| 3dca6ba75d | |||
| cdedfb482a | |||
| 80c45ce80b | |||
| 3a0b4da44a | |||
| 687d91d3d2 | |||
| d6fa6a497a | |||
| c8c049fa5d | |||
| fb70f490de | |||
| 857fe04865 | |||
| 07595e717a | |||
| 524355076f | |||
| 8a3ece91d0 |
@@ -13,5 +13,5 @@ The 'main' branch is my current configuration, while others serve as an archive
|
||||
|
||||
To install my current configuration, run:
|
||||
```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)
|
||||
```
|
||||
|
||||
24
install.sh
24
install.sh
@@ -82,22 +82,20 @@ if [ "$(pwd)" != "$HOME/dotfiles" ]; then
|
||||
echo "${YELLOW}Cloning dotfiles repository...${NC}"
|
||||
sudo apt update
|
||||
sudo apt install -y git
|
||||
if ! git clone https://github.com/TrudeEH/dotfiles --depth 1; then
|
||||
echo "${RED}Error cloning dotfiles repository. Exiting...${NC}"
|
||||
exit 2
|
||||
if ! git clone https://git.trude.dev/trude/dotfiles --depth 1; then
|
||||
echo "${RED}Error cloning dotfiles repository. Update skipped...${NC}"
|
||||
fi
|
||||
cd dotfiles || exit
|
||||
echo "${GREEN}dotfiles repository cloned successfully.${NC}"
|
||||
else
|
||||
echo "${YELLOW}Updating dotfiles repository...${NC}"
|
||||
pull_output=$(git pull)
|
||||
echo "$pull_output"
|
||||
if ! echo "$pull_output" | grep -q "Already up to date."; then
|
||||
echo "${YELLOW}Changes detected. Re-running script...${NC}"
|
||||
exec "$0" "$@"
|
||||
# else
|
||||
# echo "${YELLOW}Updating dotfiles repository...${NC}"
|
||||
# pull_output=$(git pull)
|
||||
# echo "$pull_output"
|
||||
# if ! echo "$pull_output" | grep -q "Already up to date."; then
|
||||
# echo "${YELLOW}Changes detected. Re-running script...${NC}"
|
||||
# exec "$0" "$@"
|
||||
# fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
mkdir -p "$HOME/dotfiles/logs"
|
||||
|
||||
@@ -216,7 +214,7 @@ if [ "$USER" = "trude" ]; then
|
||||
echo "${YELLOW}Cloning password-store...${NC}"
|
||||
chmod 700 ~/.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}"
|
||||
else
|
||||
echo "${GREEN}Password-store cloned successfully.${NC}"
|
||||
|
||||
66
scripts/disk-array
Executable file
66
scripts/disk-array
Executable 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
61
scripts/install-docker
Executable 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"
|
||||
@@ -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.'
|
||||
@@ -1,17 +1,33 @@
|
||||
#! /bin/sh
|
||||
|
||||
YELLOW="\e[33m"
|
||||
GRAY="\e[90m"
|
||||
NC="\e[0m"
|
||||
|
||||
printf "%b\n" "${YELLOW}Updating apt...${NC}"
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
sudo apt full-upgrade
|
||||
sudo apt autoremove
|
||||
sudo apt autoclean
|
||||
printf "%b\n" "${YELLOW}[+]${NC} Updating repos..."
|
||||
printf "%b" "${GRAY}"
|
||||
sudo apt-get update
|
||||
printf "%b" "${NC}"
|
||||
|
||||
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
|
||||
printf "%b\n" "${YELLOW}Updating flatpak...${NC}"
|
||||
printf "%b\n" "${YELLOW}[+]${NC} Updating flatpak packages..."
|
||||
printf "%b" "${GRAY}"
|
||||
flatpak update
|
||||
flatpak uninstall --unused --delete-data
|
||||
printf "%b" "${NC}"
|
||||
fi
|
||||
|
||||
5
server/close-all-ports.sh → scripts/upnpc-close
Normal file → Executable file
5
server/close-all-ports.sh → scripts/upnpc-close
Normal file → Executable file
@@ -1,4 +1,9 @@
|
||||
#!/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 -d "$port" "$proto"
|
||||
done
|
||||
33
server/.env
Normal file
33
server/.env
Normal 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
|
||||
@@ -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.
|
||||
@@ -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}"
|
||||
@@ -1,2 +0,0 @@
|
||||
#! /bin/sh
|
||||
docker exec -u www-data -it nextcloud-aio-nextcloud php "$@"
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user