From 57f470798fa32eab75501f1483a1969a167e7cb4 Mon Sep 17 00:00:00 2001 From: Lieuwe Leene Date: Sun, 13 Nov 2022 11:32:34 +0100 Subject: [PATCH] Cleanup env and security tokens --- .env.example | 9 ++++++ ...hura.leene.dev_location => inbox_location} | 0 docker-compose.yaml | 29 +++++++++++++------ local.env | 20 ------------- 4 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 .env.example rename config/nginx/{inbox.zathura.leene.dev_location => inbox_location} (100%) diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..97ac53c --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +# SET HOST NAME +NGINX_HOST="" + +# GOOGLE DNS API TOKEN +DNS_USERNAME="" +DNS_PASSWORD="" + +# COMMON DB PASSWORD +SQL_PSWD="" diff --git a/config/nginx/inbox.zathura.leene.dev_location b/config/nginx/inbox_location similarity index 100% rename from config/nginx/inbox.zathura.leene.dev_location rename to config/nginx/inbox_location diff --git a/docker-compose.yaml b/docker-compose.yaml index e353ea8..ac42762 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,6 @@ version: "3.8" + networks: internalnet: driver: bridge @@ -19,6 +20,7 @@ services: image: postgres:15 environment: - POSTGRES_MULTIPLE_DATABASES=gitea, roundcube + - POSTGRES_PASSWORD=${SQL_PSWD} volumes: - sql_data:/var/lib/postgresql/data/:z - ./config/pg-init-scripts:/docker-entrypoint-initdb.d:ro @@ -32,10 +34,9 @@ services: image: gitea/gitea restart: always environment: - - VIRTUAL_HOST=git.zathura.leene.dev + - VIRTUAL_HOST=git.${NGINX_HOST} - VIRTUAL_PORT=3000 - - LETSENCRYPT_HOST=git.zathura.leene.dev - - LETSENCRYPT_EMAIL=admin@zathura.leene.dev + - LETSENCRYPT_HOST=git.${NGINX_HOST} volumes: - gitea_data:/data:z - /etc/timezone:/etc/timezone:ro @@ -54,11 +55,13 @@ services: image: roundcube/roundcubemail:latest-fpm container_name: roundcubemail environment: - - ROUNDCUBEMAIL_DB_HOST=pgsqlserver - - VIRTUAL_HOST=inbox.zathura.leene.dev + - VIRTUAL_HOST=inbox.${NGINX_HOST} - VIRTUAL_PORT=9000 - - LETSENCRYPT_HOST=inbox.zathura.leene.dev - - LETSENCRYPT_EMAIL=admin@zathura.leene.dev + - LETSENCRYPT_HOST=inbox.${NGINX_HOST} + - ROUNDCUBEMAIL_DB_HOST=pgsqlserver + - ROUNDCUBEMAIL_DEFAULT_HOST=tls://${NGINX_HOST} + - ROUNDCUBEMAIL_SMTP_SERVER=tls://${NGINX_HOST} + - ROUNDCUBEMAIL_DB_PASSWORD=${SQL_PSWD} depends_on: - pgsqlserver links: @@ -75,7 +78,9 @@ services: image: mailserver/docker-mailserver:latest container_name: mailserver hostname: inbox - domainname: zathura.leene.dev + domainname: ${NGINX_HOST} + environment: + - POSTMASTER_ADDRESS=admin@${NGINX_HOST} ports: - "25:25" - "143:143" @@ -98,6 +103,8 @@ services: image: nginxproxy/nginx-proxy container_name: nginx-proxy restart: always + environment: + - DEFAULT_EMAIL=admin@${NGINX_HOST} ports: - "80:80" - "443:443" @@ -108,7 +115,7 @@ services: - nginx_vhost:/etc/nginx/vhost.d/:z - nginx_html:/usr/share/nginx/html:z - mail_html:/var/www/roundcube:z - - ./config/nginx/inbox.zathura.leene.dev_location:/etc/nginx/vhost.d/inbox.zathura.leene.dev_location:z + - ./config/nginx/inbox_location:/etc/nginx/vhost.d/inbox.${NGINX_HOST}_location:z - /var/run/docker.sock:/tmp/docker.sock:z depends_on: - ddnsgd @@ -118,6 +125,10 @@ services: container_name: "ddnsgd" image: "ghcr.io/dominickbrasileiro/ddnsgd" restart: "always" + environment: + - HOSTNAME=${NGINX_HOST} + - USERNAME=${DNS_USERNAME} + - PASSWORD=${DNS_PASSWORD} acme-companion: <<: *defaults diff --git a/local.env b/local.env index 70680d2..1d03bf8 100644 --- a/local.env +++ b/local.env @@ -1,21 +1,10 @@ -## Keys - -ROUNDCUBEMAIL_DB_PASSWORD=hear397sew -POSTGRES_PASSWORD="hear397sew" -USERNAME="JaMolgvImRt3jznO" -PASSWORD="Enl0rRgqBsZPVupA" - ## Docker Env - PERMIT_DOCKER=network ## Google Dynamic DNS - INTERVAL=900 -HOSTNAME="zathura.leene.dev" ## Mail Server Env - POSTFIX_INET_PROTOCOLS=ipv4 TZ=Europe/Berlin ENABLE_SPAMASSASSIN=1 @@ -27,29 +16,20 @@ ENABLE_POSTGREY=1 ENABLE_SASLAUTHD=0 ONE_DIR=1 TLS_LEVEL=modern -POSTMASTER_ADDRESS=admin@leene.dev ENABLE_UPDATE_CHECK=1 - SSL_TYPE=letsencrypt ## SQL Server Env - POSTGRES_USER="pgadmin" POSTGRES_INITDB_ARGS="--auth-host=scram-sha-256 --auth-local=scram-sha-256" ## Round Cube Env - ROUNDCUBEMAIL_DB_TYPE=pgsql ROUNDCUBEMAIL_DB_NAME=roundcube ROUNDCUBEMAIL_DB_USER=roundcube ROUNDCUBEMAIL_SKIN=elastic -ROUNDCUBEMAIL_DEFAULT_HOST=tls://zathura.leene.dev -ROUNDCUBEMAIL_SMTP_SERVER=tls://zathura.leene.dev ROUNDCUBEMAIL_ASPELL_DICTS=en ## NGINX Reverse Proxy - -NGINX_HOST=zathura.leene.dev NGINX_PROXY_CONTAINER=nginx-proxy LETSENCRYPT_RESTART_CONTAINER=true -DEFAULT_EMAIL=lieuwe@leene.dev