From 470f0701aeaa9125acccbb8820f5043445cf8e99 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Tue, 27 Sep 2022 04:48:08 -0500 Subject: [PATCH 1/6] Add support for Ubuntu. --- bin/install.sh | 52 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index b22ade6..0ef6a1e 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -4,19 +4,47 @@ # Original comands came from here: https://docs.docker.com/engine/install/debian/ # usage: install.sh -apt purge docker docker-engine docker.io containerd runc +## Variables ## -apt update && -apt install -y ca-certificates curl gnupg lsb-release && -mkdir -p /etc/apt/keyrings && -curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && -echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ - $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && -apt update && -apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin && -exit 0 +os=`grep ^'NAME=' /etc/os-release` +pkgmgr="" + +## Validations ## + +if [[ "$os" == *"Debian"* ]]; then + repo="debian" + pkgmgr="apt" +elif [[ "$os" == *"Ubuntu"* ]]; then + repo="ubuntu" + pkgmgr="apt" +else + echo "Distribution not yet supported." && + exit 1 +fi +echo "os=$os" +echo "repo=$repo" +echo "pkgmgr=$pkgmgr" + +## Main ## + +if [[ "$pkgmgr" == "apt" ]]; then + apt purge docker docker-engine docker.io containerd runc + + apt update && + apt install -y ca-certificates curl gnupg lsb-release && + mkdir -p /etc/apt/keyrings && + curl -fsSL https://download.docker.com/linux/$repo/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$repo \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && + apt update && + apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin && + + echo "Success!" && + exit 0 +fi + +## Error ## echo "ERROR: Installation failed!" exit 1 - From cf6948cd4463b3ba48362344486393f22bbe9072 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Fri, 30 Sep 2022 04:54:53 -0500 Subject: [PATCH 2/6] Attempt adding Arch Linux. --- bin/install.sh | 8 ++++++++ 1 file changed, 8 insertions(+) mode change 100755 => 100644 bin/install.sh diff --git a/bin/install.sh b/bin/install.sh old mode 100755 new mode 100644 index 0ef6a1e..ec33895 --- a/bin/install.sh +++ b/bin/install.sh @@ -17,6 +17,8 @@ if [[ "$os" == *"Debian"* ]]; then elif [[ "$os" == *"Ubuntu"* ]]; then repo="ubuntu" pkgmgr="apt" +elif [[ $os == "Arch Linux" ]]; then + pkgmgr="pacman" else echo "Distribution not yet supported." && exit 1 @@ -40,6 +42,12 @@ if [[ "$pkgmgr" == "apt" ]]; then apt update && apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin && + echo "Success!" && + exit 0 +elif [[ $pkgmgr == "pacman" ]]; then + pacman -Rcns --noconfirm *docker* + + pacman -Sy --noconfirm docker docker-compose && echo "Success!" && exit 0 fi From 1134bc7a1e8572050960f58a54cee115840702af Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 5 Oct 2022 02:38:03 -0500 Subject: [PATCH 3/6] Add building of any custom config. --- bin/start.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/start.sh b/bin/start.sh index 2674428..bc73f0e 100755 --- a/bin/start.sh +++ b/bin/start.sh @@ -9,6 +9,7 @@ cd $DOCKER_HOME/Config for dir in `ls`; do [ -d $dir ] && cd $dir || continue pwd + [ -e Dockerfile ] && docker compose build [ -e docker-compose.yml ] && docker compose up -d cd .. done From 32cecb92f67f781089d98c98d723536c8a601a7b Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 5 Oct 2022 02:51:52 -0500 Subject: [PATCH 4/6] First attempt at an NGINX reverse proxy skeleton. --- Config/ReverseProxy/Dockerfile | 11 +++++++ Config/ReverseProxy/config/conf.d/test.conf | 2 ++ Config/ReverseProxy/config/nginx.conf | 34 +++++++++++++++++++++ Config/ReverseProxy/docker-compose.yml | 20 ++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 Config/ReverseProxy/Dockerfile create mode 100644 Config/ReverseProxy/config/conf.d/test.conf create mode 100644 Config/ReverseProxy/config/nginx.conf create mode 100644 Config/ReverseProxy/docker-compose.yml diff --git a/Config/ReverseProxy/Dockerfile b/Config/ReverseProxy/Dockerfile new file mode 100644 index 0000000..83e0ad4 --- /dev/null +++ b/Config/ReverseProxy/Dockerfile @@ -0,0 +1,11 @@ +# 2022-10-05 Hyperling +# Move config to nginx container. +# This is because nginx image does not play well with Volumes. +# Nextcloud and MariaDB created files in their folders fine, but nginx stays empty. + +FROM nginx + +COPY ./config/nginx.conf /etc/nginx/nginx.conf + +COPY ./config/conf.d/* /etc/nginx/conf.d/ + diff --git a/Config/ReverseProxy/config/conf.d/test.conf b/Config/ReverseProxy/config/conf.d/test.conf new file mode 100644 index 0000000..4b8c2a9 --- /dev/null +++ b/Config/ReverseProxy/config/conf.d/test.conf @@ -0,0 +1,2 @@ +# 2022-10-05 Hyperling +# Just a dummy test file. diff --git a/Config/ReverseProxy/config/nginx.conf b/Config/ReverseProxy/config/nginx.conf new file mode 100644 index 0000000..c8c359b --- /dev/null +++ b/Config/ReverseProxy/config/nginx.conf @@ -0,0 +1,34 @@ +# 2022-10-05 Hyperling + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} + diff --git a/Config/ReverseProxy/docker-compose.yml b/Config/ReverseProxy/docker-compose.yml new file mode 100644 index 0000000..f5ce6e4 --- /dev/null +++ b/Config/ReverseProxy/docker-compose.yml @@ -0,0 +1,20 @@ +# 2022-10-05 Hyperling +# Reverse Proxy +# This is a revised version of the original work here: +# https://phoenixnap.com/kb/docker-nginx-reverse-proxy +# https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/ + +version: '2' + +services: + app: + image: nginx + restart: always +# Instead of using a volume, have the config files in . and COPY them to container with DockerFile +# volumes: +# - /opt/Docker/Volumes/ReverseProxy/nginx:/etc/nginx/ + build: ./ + ports: + - 8081:80 + - 8082:443 + From b9db16c37ff97e1883c24d4106a994917471be24 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 6 Oct 2022 19:59:34 -0500 Subject: [PATCH 5/6] Disable config by 'removing' yml file. --- Config/MailServer/docker-compose.yml | 37 ---------------------------- 1 file changed, 37 deletions(-) delete mode 100644 Config/MailServer/docker-compose.yml diff --git a/Config/MailServer/docker-compose.yml b/Config/MailServer/docker-compose.yml deleted file mode 100644 index 0be82a6..0000000 --- a/Config/MailServer/docker-compose.yml +++ /dev/null @@ -1,37 +0,0 @@ -# MailServer configuration. -# This is a revised version of the original work here: -# https://github.com/docker-mailserver/docker-mailserver - -services: - mailserver: - image: docker.io/mailserver/docker-mailserver:latest - container_name: mailserver - # If the FQDN for your mail-server is only two labels (eg: example.com), - # you can assign this entirely to `hostname` and remove `domainname`. - hostname: mail - domainname: hyperling.com - env_file: mailserver.env - # More information about the mail-server ports: - # https://docker-mailserver.github.io/docker-mailserver/edge/config/security/understanding-the-ports/ - # To avoid conflicts with yaml base-60 float, DO NOT remove the quotation marks. - ports: - - "25:25" # SMTP (explicit TLS => STARTTLS) - - "143:143" # IMAP4 (explicit TLS => STARTTLS) - - "465:465" # ESMTP (implicit TLS) - - "587:587" # ESMTP (explicit TLS => STARTTLS) - - "993:993" # IMAP4 (implicit TLS) - volumes: - - /opt/Docker/Volumes/MailServer/data:/var/mail/ - - /opt/Docker/Volumes/MailServer/state:/var/mail-state/ - - /opt/Docker/Volumes/MailServer/logs:/var/log/mail/ - - /opt/Docker/Volumes/MailServer/config:/tmp/docker-mailserver/ - - /etc/localtime:/etc/localtime:ro - restart: always - stop_grace_period: 1m - cap_add: - - NET_ADMIN - healthcheck: - test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1" - timeout: 3s - retries: 0 - From ab8ad7e680ac6237b7e6693a2bf00b790dc325f1 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 29 Oct 2022 10:55:34 -0500 Subject: [PATCH 6/6] Disable reverse proxy. --- .../{Dockerfile => Dockerfile.disabled} | 0 Config/ReverseProxy/docker-compose.yml | 20 ------------------- 2 files changed, 20 deletions(-) rename Config/ReverseProxy/{Dockerfile => Dockerfile.disabled} (100%) delete mode 100644 Config/ReverseProxy/docker-compose.yml diff --git a/Config/ReverseProxy/Dockerfile b/Config/ReverseProxy/Dockerfile.disabled similarity index 100% rename from Config/ReverseProxy/Dockerfile rename to Config/ReverseProxy/Dockerfile.disabled diff --git a/Config/ReverseProxy/docker-compose.yml b/Config/ReverseProxy/docker-compose.yml deleted file mode 100644 index f5ce6e4..0000000 --- a/Config/ReverseProxy/docker-compose.yml +++ /dev/null @@ -1,20 +0,0 @@ -# 2022-10-05 Hyperling -# Reverse Proxy -# This is a revised version of the original work here: -# https://phoenixnap.com/kb/docker-nginx-reverse-proxy -# https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/ - -version: '2' - -services: - app: - image: nginx - restart: always -# Instead of using a volume, have the config files in . and COPY them to container with DockerFile -# volumes: -# - /opt/Docker/Volumes/ReverseProxy/nginx:/etc/nginx/ - build: ./ - ports: - - 8081:80 - - 8082:443 -