From 969c0d58e90ec193388552bee4368b1cef4d24be Mon Sep 17 00:00:00 2001 From: TrudeEH Date: Tue, 17 Jun 2025 10:49:30 +0100 Subject: [PATCH] Added all server files --- server/close-all-ports.sh | 4 +++ server/compose.yml | 56 +++++++++++++++++++++++++++++++++++ server/install.sh | 61 ++++++++++----------------------------- server/nextcloud | 2 ++ server/open-ports.sh | 16 ++++++---- 5 files changed, 89 insertions(+), 50 deletions(-) create mode 100644 server/close-all-ports.sh create mode 100644 server/compose.yml create mode 100755 server/nextcloud diff --git a/server/close-all-ports.sh b/server/close-all-ports.sh new file mode 100644 index 00000000..139153be --- /dev/null +++ b/server/close-all-ports.sh @@ -0,0 +1,4 @@ +#!/bin/sh +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 diff --git a/server/compose.yml b/server/compose.yml new file mode 100644 index 00000000..7c334b7d --- /dev/null +++ b/server/compose.yml @@ -0,0 +1,56 @@ +# 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.kindawork.com:85.247.208.137 + + 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. diff --git a/server/install.sh b/server/install.sh index 9129f5dc..6955b7c9 100755 --- a/server/install.sh +++ b/server/install.sh @@ -12,17 +12,9 @@ trap 'printf "${RED}install.sh interrupted.${NC}"; exit 1' INT TERM ../scripts/update -if ! command -v whiptail >/dev/null 2>&1; then - echo "${YELLOW}Installing whiptail...${NC}" - sudo apt install -y whiptail -fi - -NC_DATA=$(whiptail --title "Nextcloud Data Directory" --inputbox "Enter the directory for Nextcloud data:" 10 60 "$NC_data" 3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus -ne 0 ] || [ -z "$NC_DATA" ]; then - echo "${RED}User canceled. Exiting...${NC}" - exit 1 -fi +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 @@ -42,39 +34,18 @@ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin dock # Add user to docker group (to remove the need to use sudo) sudo usermod -aG docker $USER -echo "${YELLOW}Installing Nextcloud...${NC}" -docker run -d \ - --init \ - --sig-proxy=false \ - --name nextcloud-aio-mastercontainer \ - --restart always \ - --publish 80:80 \ - --publish 8080:8080 \ - --publish 8443:8443 \ - --env NEXTCLOUD_DATADIR="$NC_DATA" \ - --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \ - --volume /var/run/docker.sock:/var/run/docker.sock:ro \ - ghcr.io/nextcloud-releases/all-in-one:latest - -echo "${YELLOW}Installing PiHole...${NC}" -docker run -d \ - --name pihole \ - -p "53:53/tcp" \ - -p "53:53/udp" \ - -p "6000:80/tcp" \ - -p "6001:443/tcp" \ - -e "TZ=Europe/Lisbon" \ - -e "FTLCONF_dns_listeningMode=all" \ - -v "~/etc-pihole:/etc/pihole" \ - --cap-add NET_ADMIN \ - --cap-add SYS_TIME \ - --cap-add SYS_NICE \ - --restart unless-stopped \ - pihole/pihole:latest +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 "${CYAN}Nextcloud AIO @ https://$LOCAL_IP:8080${NC}" -echo "${CYAN}Nextcloud @ https://$LOCAL_IP${NC}" -echo "${CYAN}PiHole Password:" -docker logs pihole | grep "random password" -echo "PiHole @ https://$LOCAL_IP:6001/admin/login${NC}" +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}" diff --git a/server/nextcloud b/server/nextcloud new file mode 100755 index 00000000..e250487b --- /dev/null +++ b/server/nextcloud @@ -0,0 +1,2 @@ +#! /bin/sh +docker exec -u www-data -it nextcloud-aio-nextcloud php "$@" diff --git a/server/open-ports.sh b/server/open-ports.sh index 8753af29..d6f180fb 100755 --- a/server/open-ports.sh +++ b/server/open-ports.sh @@ -3,13 +3,19 @@ sudo apt install miniupnpc LOCAL_IP=$(hostname -I | awk '{print $1}') -# Nextcloud +# NGINX PROXY MANAGER upnpc -a $LOCAL_IP 80 80 tcp -upnpc -a $LOCAL_IP 8080 8080 tcp -upnpc -a $LOCAL_IP 8443 8443 tcp upnpc -a $LOCAL_IP 443 443 tcp -upnpc -a $LOCAL_IP 3478 3478 tcp -upnpc -a $LOCAL_IP 3478 3478 udp +#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