Merge pull request #1 from Hyperling/dev

Enhancements and Reverse Proxy Skeleton
This commit is contained in:
Hyperling 2022-10-29 11:01:55 -05:00 committed by GitHub
commit 618afc8e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 96 additions and 49 deletions

View File

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

View File

@ -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/

View File

@ -0,0 +1,2 @@
# 2022-10-05 Hyperling
# Just a dummy test file.

View File

@ -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;
}

42
bin/install.sh Executable file → Normal file
View File

@ -4,19 +4,55 @@
# Original comands came from here: https://docs.docker.com/engine/install/debian/
# usage: install.sh
## Variables ##
os=`grep ^'NAME=' /etc/os-release`
pkgmgr=""
## Validations ##
if [[ "$os" == *"Debian"* ]]; then
repo="debian"
pkgmgr="apt"
elif [[ "$os" == *"Ubuntu"* ]]; then
repo="ubuntu"
pkgmgr="apt"
elif [[ $os == "Arch Linux" ]]; then
pkgmgr="pacman"
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/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg &&
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/debian \
"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
elif [[ $pkgmgr == "pacman" ]]; then
pacman -Rcns --noconfirm *docker*
pacman -Sy --noconfirm docker docker-compose &&
echo "Success!" &&
exit 0
fi
## Error ##
echo "ERROR: Installation failed!"
exit 1

View File

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