From 9bf0974f68f33b4dc48ba4583a8a7d6861ed959b Mon Sep 17 00:00:00 2001 From: nicolailang Date: Fri, 30 Nov 2018 18:59:48 +0100 Subject: [PATCH 001/158] Support for running on Synology DSM Nas and configureable ports for docker host (#110) * Added support for configuring listener port on docker host and instructions for running on Synology DSM Nas --- .env.sample | 8 ++++++++ Docs/HOWTO-Synlogy.md | 27 +++++++++++++++++++++++++++ docker-compose-multiple-networks.yml | 6 +++--- docker-compose.yml | 4 ++-- 4 files changed, 40 insertions(+), 5 deletions(-) create mode 100755 Docs/HOWTO-Synlogy.md diff --git a/.env.sample b/.env.sample index aa68c748..015ac489 100644 --- a/.env.sample +++ b/.env.sample @@ -85,3 +85,11 @@ NGINX_FILES_PATH=./nginx-data #NGINX_LETSENCRYPT_LOG_DRIVER=json-file #NGINX_LETSENCRYPT_LOG_MAX_SIZE=2m #NGINX_LETSENCRYPT_LOG_MAX_FILE=10 + +# +# Set the local exposed ports for http and https on the Host +# +# NOTE: The default values are 80 and 443, only change this options if you really know what you are doing +# +#DOCKER_HTTP=80 +#DOCKER_HTTPS=443 diff --git a/Docs/HOWTO-Synlogy.md b/Docs/HOWTO-Synlogy.md new file mode 100755 index 00000000..4c456f81 --- /dev/null +++ b/Docs/HOWTO-Synlogy.md @@ -0,0 +1,27 @@ +## Port mapping +Synology default installs a web server on port 80 blocking certificate generation. + +To circumvent this - if you do not need external access to the default web server (and you should not expose it anyway) configure your .env to use alternative ports and your router to forward the external official port to the alternative internal ports: + +# +# Set the local exposed ports for http and https - this will allow you to run with a legacy web +# server already installed for local use +# +# NOTE: For this to function your internet router must forward the official ports to the mapped ports - +# in this example external port 80 to docker host 81 and external port 443 to docker host 444 +# +DOCKER_HTTP=81 +DOCKER_HTTPS=444 + +## File permissions +To setup the needed configuration directoties and proper permissions run the below commands (assuming default ./data is where you have your catalog for persistent files) + +mkdir -p data/certs +mkdir data/htpasswd +mkdir data/conf.d +mkdir data/vhost.d +mkdir data/html +chgrp -R 101 data +chmod -R g+rwx data + +Contributed by https://github.com/nicolailang/ diff --git a/docker-compose-multiple-networks.yml b/docker-compose-multiple-networks.yml index 09141f2c..2d4440ea 100644 --- a/docker-compose-multiple-networks.yml +++ b/docker-compose-multiple-networks.yml @@ -7,9 +7,9 @@ services: container_name: ${NGINX_WEB:-nginx-web} restart: always ports: - - "${IP:-0.0.0.0}:80:80" - - "${IP:-0.0.0.0}:443:443" - volumes: + - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80" + - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" + volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html diff --git a/docker-compose.yml b/docker-compose.yml index 230146ee..377a0008 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,8 @@ services: container_name: ${NGINX_WEB:-nginx-web} restart: always ports: - - "${IP:-0.0.0.0}:80:80" - - "${IP:-0.0.0.0}:443:443" + - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80" + - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d From e019610f08d4eaaa3dca048ecc1c2e04689e8512 Mon Sep 17 00:00:00 2001 From: Evert Date: Fri, 30 Nov 2018 16:01:26 -0200 Subject: [PATCH 002/158] update folder name --- {Docs => docs}/HOWTO-Synlogy.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {Docs => docs}/HOWTO-Synlogy.md (100%) diff --git a/Docs/HOWTO-Synlogy.md b/docs/HOWTO-Synlogy.md similarity index 100% rename from Docs/HOWTO-Synlogy.md rename to docs/HOWTO-Synlogy.md From 8580e789e966d3ea3d1008fcc06c968b81aea888 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 30 Nov 2018 16:04:46 -0200 Subject: [PATCH 003/158] Update README.md --- .github/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/README.md b/.github/README.md index 96c91a5e..8d7633cd 100644 --- a/.github/README.md +++ b/.github/README.md @@ -230,6 +230,11 @@ Or simply run: docker stop test-web && docker rm test-web ``` +## Running this Proxy on a Synology NAS + +Please checkout this [howto](https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/blob/master/docs/HOWTO-Synlogy.md). + + ## Production Environment using Web Proxy and Wordpress 1. [docker-wordpress-letsencrypt](https://github.com/evertramos/docker-wordpress-letsencrypt) From e15e6ef94262ed921681ba60306cfa88d182e8f2 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 15 Jan 2019 12:42:37 -0200 Subject: [PATCH 004/158] update realip address with private intranets options --- conf.d/realip.conf | 57 ++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/conf.d/realip.conf b/conf.d/realip.conf index 04d8ae33..5dfb8a0a 100644 --- a/conf.d/realip.conf +++ b/conf.d/realip.conf @@ -15,9 +15,9 @@ # # The option 'set_real_ip_from' # must correspont to your docker network address -set_real_ip_from 172.18.0.0/32; -real_ip_header X-Real-IP; -real_ip_recursive on; +set_real_ip_from 172.16.0.0/12; +set_real_ip_from 10.0.0.0/8; +set_real_ip_from 192.168.0.0/16; # # CloudFlare settings @@ -26,25 +26,32 @@ real_ip_recursive on; # user's real IP to your app services you # must uncomment all lines below and be sure # to comment the lines of the "Basic settings" -#set_real_ip_from 103.21.244.0/22; -#set_real_ip_from 103.22.200.0/22; -#set_real_ip_from 103.31.4.0/22; -#set_real_ip_from 104.16.0.0/12; -#set_real_ip_from 108.162.192.0/18; -#set_real_ip_from 131.0.72.0/22; -#set_real_ip_from 141.101.64.0/18; -#set_real_ip_from 162.158.0.0/15; -#set_real_ip_from 172.64.0.0/13; -#set_real_ip_from 173.245.48.0/20; -#set_real_ip_from 188.114.96.0/20; -#set_real_ip_from 190.93.240.0/20; -#set_real_ip_from 197.234.240.0/22; -#set_real_ip_from 198.41.128.0/17; -#set_real_ip_from 2400:cb00::/32; -#set_real_ip_from 2606:4700::/32; -#set_real_ip_from 2803:f800::/32; -#set_real_ip_from 2405:b500::/32; -#set_real_ip_from 2405:8100::/32; -#set_real_ip_from 2c0f:f248::/32; -#set_real_ip_from 2a06:98c0::/29; -#real_ip_header X-Forwarded-For; +set_real_ip_from 103.21.244.0/22; +set_real_ip_from 103.22.200.0/22; +set_real_ip_from 103.31.4.0/22; +set_real_ip_from 104.16.0.0/12; +set_real_ip_from 108.162.192.0/18; +set_real_ip_from 131.0.72.0/22; +set_real_ip_from 141.101.64.0/18; +set_real_ip_from 162.158.0.0/15; +set_real_ip_from 172.64.0.0/13; +set_real_ip_from 173.245.48.0/20; +set_real_ip_from 188.114.96.0/20; +set_real_ip_from 190.93.240.0/20; +set_real_ip_from 197.234.240.0/22; +set_real_ip_from 198.41.128.0/17; +set_real_ip_from 2400:cb00::/32; +set_real_ip_from 2606:4700::/32; +set_real_ip_from 2803:f800::/32; +set_real_ip_from 2405:b500::/32; +set_real_ip_from 2405:8100::/32; +set_real_ip_from 2c0f:f248::/32; +set_real_ip_from 2a06:98c0::/29; + +# +# Header for Real IP Address +# +real_ip_header X-Forwarded-For; +#real_ip_header X-Real-IP; +real_ip_recursive on; + From 5961d414c9c2cfbbdb702a37f3db8ea7a6a8fa9b Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 17 Jan 2019 14:43:33 +0100 Subject: [PATCH 005/158] Fix issue #113 (#124) --- docker-compose-multiple-networks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose-multiple-networks.yml b/docker-compose-multiple-networks.yml index 2d4440ea..4a469eb3 100644 --- a/docker-compose-multiple-networks.yml +++ b/docker-compose-multiple-networks.yml @@ -9,7 +9,7 @@ services: ports: - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80" - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" - volumes: + volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html From 6b323fddbf741ae3103cebd7c9fa51170f723b2a Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 26 Feb 2019 19:22:22 -0500 Subject: [PATCH 006/158] update nginx.tmpl file --- nginx.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index d861050a..a9fc4796 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -19,7 +19,7 @@ server 127.0.0.1 down; {{ end }} {{ end }} - + {{ end }} # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the @@ -262,7 +262,7 @@ server { ssl_trusted_certificate {{ printf "/etc/nginx/certs/%s.chain.pem" $cert }}; {{ end }} - {{ if (and (ne $https_method "noredirect") (ne $hsts "off")) }} + {{ if (not (or (eq $https_method "noredirect") (eq $hsts "off"))) }} add_header Strict-Transport-Security "{{ trim $hsts }}" always; {{ end }} From 621798e92235b6eb75e0d34d3b6209dfee96ff7d Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 29 Apr 2019 08:37:53 -0300 Subject: [PATCH 007/158] Reload Instructions Add reload instructions to further options --- .github/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/README.md b/.github/README.md index 8d7633cd..d6bb8674 100644 --- a/.github/README.md +++ b/.github/README.md @@ -202,6 +202,17 @@ Or as of below: docker run [...] -e VIRTUAL_PORT=8545 [...] ``` +4. Restarting proxy container + +In some cases you will need to restart the proxy in order to read, as an example, the Basic Auth, if you set it after your service container is already up and running. So, the way I use to restart the proxy (NGINX) is as following, which has no downtime: + +```bash +docker exec -it ${NGINX_WEB} nginx -s reload +``` + +Where *${NGINX_WEB}* is your proxy container name, which in the original `.env` file is set as *nginx-web*. + + ## Testing your proxy with scripts preconfigured 1. Run the script `test.sh` informing your domain already configured in your DNS to point out to your server as follow: From 9bbb345ad25687c6dbd4e1e965c417093829cc49 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 25 Sep 2019 10:47:53 -0300 Subject: [PATCH 008/158] Add Beerpay's badge --- .github/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/README.md b/.github/README.md index d6bb8674..00b98610 100644 --- a/.github/README.md +++ b/.github/README.md @@ -270,3 +270,8 @@ Credits goes to: - [@buchdag](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion/pull/226#event-1145800062) - [@fracz](https://github.com/fracz) - Many contributions! + +## Support on Beerpay +Hey dude! Help me out for a couple of :beers:! + +[![Beerpay](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/badge.svg?style=beer-square)](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion) [![Beerpay](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/make-wish.svg?style=flat-square)](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion?focus=wish) \ No newline at end of file From 4dec6c0f3964e69f91d978bb8c7dd8e293a3e3f8 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 13 Nov 2019 09:29:10 -0300 Subject: [PATCH 009/158] Update README.md --- .github/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 00b98610..5b4d0eeb 100644 --- a/.github/README.md +++ b/.github/README.md @@ -251,6 +251,7 @@ Please checkout this [howto](https://github.com/evertramos/docker-compose-letsen 1. [docker-wordpress-letsencrypt](https://github.com/evertramos/docker-wordpress-letsencrypt) 2. [docker-portainer-letsencrypt](https://github.com/evertramos/docker-portainer-letsencrypt) 3. [docker-nextcloud-letsencrypt](https://github.com/evertramos/docker-nextcloud-letsencrypt) +4. [docker-registry-letsencrypt](https://github.com/evertramos/docker-registry-letsencrypt) In this repo you will find a docker-compose file to start a production environment for a new wordpress site. @@ -274,4 +275,4 @@ Credits goes to: ## Support on Beerpay Hey dude! Help me out for a couple of :beers:! -[![Beerpay](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/badge.svg?style=beer-square)](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion) [![Beerpay](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/make-wish.svg?style=flat-square)](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion?focus=wish) \ No newline at end of file +[![Beerpay](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/badge.svg?style=beer-square)](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion) [![Beerpay](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/make-wish.svg?style=flat-square)](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion?focus=wish) From d0cefadade6447942e04e0cb38b61478ab2f29be Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 15 Nov 2019 11:16:15 -0300 Subject: [PATCH 010/158] update nginx.template --- nginx.tmpl | 86 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index a9fc4796..c1383c68 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -22,6 +22,49 @@ {{ end }} +{{ define "ssl_policy" }} + {{ if eq .ssl_policy "Mozilla-Modern" }} + ssl_protocols TLSv1.3; + {{/* nginx currently lacks ability to choose ciphers in TLS 1.3 in configuration, see https://trac.nginx.org/nginx/ticket/1529 /*}} + {{/* a possible workaround can be modify /etc/ssl/openssl.cnf to change it globally (see https://trac.nginx.org/nginx/ticket/1529#comment:12 ) /*}} + {{/* explicitly set ngnix default value in order to allow single servers to override the global http value */}} + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers off; + {{ else if eq .ssl_policy "Mozilla-Intermediate" }} + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384'; + ssl_prefer_server_ciphers off; + {{ else if eq .ssl_policy "Mozilla-Old" }} + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA'; + ssl_prefer_server_ciphers on; + {{ else if eq .ssl_policy "AWS-TLS-1-2-2017-01" }} + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES128-SHA256:AES256-GCM-SHA384:AES256-SHA256'; + ssl_prefer_server_ciphers on; + {{ else if eq .ssl_policy "AWS-TLS-1-1-2017-01" }} + ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA'; + ssl_prefer_server_ciphers on; + {{ else if eq .ssl_policy "AWS-2016-08" }} + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA'; + ssl_prefer_server_ciphers on; + {{ else if eq .ssl_policy "AWS-2015-05" }} + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DES-CBC3-SHA'; + ssl_prefer_server_ciphers on; + {{ else if eq .ssl_policy "AWS-2015-03" }} + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DHE-DSS-AES128-SHA:DES-CBC3-SHA'; + ssl_prefer_server_ciphers on; + {{ else if eq .ssl_policy "AWS-2015-02" }} + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; + ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DHE-DSS-AES128-SHA'; + ssl_prefer_server_ciphers on; + {{ end }} +{{ end }} + # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the # scheme used to connect to this server map $http_x_forwarded_proto $proxy_x_forwarded_proto { @@ -65,6 +108,10 @@ log_format vhost '$host $remote_addr - $remote_user [$time_local] ' access_log off; +{{/* Get the SSL_POLICY defined by this container, falling back to "Mozilla-Intermediate" */}} +{{ $ssl_policy := or ($.Env.SSL_POLICY) "Mozilla-Intermediate" }} +{{ template "ssl_policy" (dict "ssl_policy" $ssl_policy) }} + {{ if $.Env.RESOLVERS }} resolver {{ $.Env.RESOLVERS }}; {{ end }} @@ -109,6 +156,7 @@ server { access_log /var/log/nginx/access.log vhost; return 503; + ssl_session_cache shared:SSL:50m; ssl_session_tickets off; ssl_certificate /etc/nginx/certs/default.crt; ssl_certificate_key /etc/nginx/certs/default.key; @@ -163,8 +211,8 @@ upstream {{ $upstream_name }} { {{/* Get the HTTPS_METHOD defined by containers w/ the same vhost, falling back to "redirect" */}} {{ $https_method := or (first (groupByKeys $containers "Env.HTTPS_METHOD")) "redirect" }} -{{/* Get the SSL_POLICY defined by containers w/ the same vhost, falling back to "Mozilla-Intermediate" */}} -{{ $ssl_policy := or (first (groupByKeys $containers "Env.SSL_POLICY")) "Mozilla-Intermediate" }} +{{/* Get the SSL_POLICY defined by containers w/ the same vhost, falling back to empty string (use default) */}} +{{ $ssl_policy := or (first (groupByKeys $containers "Env.SSL_POLICY")) "" }} {{/* Get the HSTS defined by containers w/ the same vhost, falling back to "max-age=31536000" */}} {{ $hsts := or (first (groupByKeys $containers "Env.HSTS")) "max-age=31536000" }} @@ -215,36 +263,8 @@ server { include /etc/nginx/network_internal.conf; {{ end }} - {{ if eq $ssl_policy "Mozilla-Modern" }} - ssl_protocols TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; - {{ else if eq $ssl_policy "Mozilla-Intermediate" }} - ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:!DSS'; - {{ else if eq $ssl_policy "Mozilla-Old" }} - ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:DES-CBC3-SHA:HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP'; - {{ else if eq $ssl_policy "AWS-TLS-1-2-2017-01" }} - ssl_protocols TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:AES128-GCM-SHA256:AES128-SHA256:AES256-GCM-SHA384:AES256-SHA256'; - {{ else if eq $ssl_policy "AWS-TLS-1-1-2017-01" }} - ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA'; - {{ else if eq $ssl_policy "AWS-2016-08" }} - ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA'; - {{ else if eq $ssl_policy "AWS-2015-05" }} - ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DES-CBC3-SHA'; - {{ else if eq $ssl_policy "AWS-2015-03" }} - ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DHE-DSS-AES128-SHA:DES-CBC3-SHA'; - {{ else if eq $ssl_policy "AWS-2015-02" }} - ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; - ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DHE-DSS-AES128-SHA'; - {{ end }} + {{ template "ssl_policy" (dict "ssl_policy" $ssl_policy) }} - ssl_prefer_server_ciphers on; ssl_session_timeout 5m; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; @@ -278,7 +298,7 @@ server { uwsgi_pass {{ trim $proto }}://{{ trim $upstream_name }}; {{ else if eq $proto "fastcgi" }} root {{ trim $vhost_root }}; - include fastcgi.conf; + include fastcgi_params; fastcgi_pass {{ trim $upstream_name }}; {{ else }} proxy_pass {{ trim $proto }}://{{ trim $upstream_name }}; @@ -325,7 +345,7 @@ server { uwsgi_pass {{ trim $proto }}://{{ trim $upstream_name }}; {{ else if eq $proto "fastcgi" }} root {{ trim $vhost_root }}; - include fastcgi.conf; + include fastcgi_params; fastcgi_pass {{ trim $upstream_name }}; {{ else }} proxy_pass {{ trim $proto }}://{{ trim $upstream_name }}; From 06bdaf7f400e023d328f53c96e80200bd9fca48c Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 29 Nov 2019 19:36:42 -0300 Subject: [PATCH 011/158] Get start script to create .env file for new users - automatically create .env file --- start.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index b1fc35df..bf044384 100755 --- a/start.sh +++ b/start.sh @@ -9,8 +9,9 @@ if [ -e .env ]; then source .env else - echo "Please set up your .env file before starting your environment." - exit 1 + echo "It seems you didnΒ΄t create your .env file, so we will create one for you." + cp .env.sample .env + # exit 1 fi # 2. Create docker network From cf65b9c69f2c8bc7c8d94d94a9ed822a16cbe68f Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 29 Nov 2019 19:39:16 -0300 Subject: [PATCH 012/158] update error message --- start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index bf044384..96a1ce9f 100755 --- a/start.sh +++ b/start.sh @@ -50,8 +50,8 @@ if [ ! -z ${USE_NGINX_CONF_FILES+X} ] && [ "$USE_NGINX_CONF_FILES" = true ]; the echo "#######################################################" echo echo "There was an error trying to copy the nginx conf files." - echo "The webproxy will still work, your custom configuration" - echo "will not be loaded." + echo "The proxy will still work with default options, but" + echo "the custom settings your have made could not be loaded." echo echo "#######################################################" fi From f772669c089657fadb07621cff1f85345d43b056 Mon Sep 17 00:00:00 2001 From: Steeve Payraudeau Date: Mon, 16 Dec 2019 14:00:16 +0100 Subject: [PATCH 013/158] Update README.md (#178) --- .github/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/README.md b/.github/README.md index 5b4d0eeb..cd3444b2 100644 --- a/.github/README.md +++ b/.github/README.md @@ -252,6 +252,7 @@ Please checkout this [howto](https://github.com/evertramos/docker-compose-letsen 2. [docker-portainer-letsencrypt](https://github.com/evertramos/docker-portainer-letsencrypt) 3. [docker-nextcloud-letsencrypt](https://github.com/evertramos/docker-nextcloud-letsencrypt) 4. [docker-registry-letsencrypt](https://github.com/evertramos/docker-registry-letsencrypt) +5. [gitlab-docker-letsencrypt](https://github.com/steevepay/gitlab-docker-letsencrypt) In this repo you will find a docker-compose file to start a production environment for a new wordpress site. From 01f3f2d09c4485b6223b65e57b832a42bd1c4ddf Mon Sep 17 00:00:00 2001 From: Pascal Loth Date: Mon, 10 Feb 2020 18:32:38 +0100 Subject: [PATCH 014/158] Update .env.sample (#188) --- .env.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index 015ac489..22b8409f 100644 --- a/.env.sample +++ b/.env.sample @@ -4,7 +4,7 @@ # A Web Proxy using docker with NGINX and Let's Encrypt # Using the great community docker-gen, nginx-proxy and docker-letsencrypt-nginx-proxy-companion # -# This is the .env file to set up your webproxy enviornment +# This is the .env file to set up your webproxy environment # # Your local containers NAME From 8ce5d7f0c03c32e424d4423cf6a749355306f3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Fr=C4=85cz?= Date: Tue, 11 Feb 2020 01:31:33 +0100 Subject: [PATCH 015/158] Ability to change the SSL_POLICY (#170) * Ability to set SSL_POLICY * SSL_POLICY for docker-compose-multiple-networks.yml --- .env.sample | 7 +++++++ docker-compose-multiple-networks.yml | 2 ++ docker-compose.yml | 2 ++ 3 files changed, 11 insertions(+) diff --git a/.env.sample b/.env.sample index 22b8409f..35014f86 100644 --- a/.env.sample +++ b/.env.sample @@ -93,3 +93,10 @@ NGINX_FILES_PATH=./nginx-data # #DOCKER_HTTP=80 #DOCKER_HTTPS=443 + + +# +# Set the SSL policy (defaults to Mozilla-Intermediate). +# See available options here: https://github.com/jwilder/nginx-proxy#how-ssl-support-works +# +#SSL_POLICY=Mozilla-Modern diff --git a/docker-compose-multiple-networks.yml b/docker-compose-multiple-networks.yml index 4a469eb3..a9406a90 100644 --- a/docker-compose-multiple-networks.yml +++ b/docker-compose-multiple-networks.yml @@ -29,6 +29,8 @@ services: command: -notify-sighup ${NGINX_WEB:-nginx-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf container_name: ${DOCKER_GEN:-nginx-gen} restart: always + environment: + SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d diff --git a/docker-compose.yml b/docker-compose.yml index 377a0008..d8bd8148 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,8 @@ services: command: -notify-sighup ${NGINX_WEB:-nginx-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf container_name: ${DOCKER_GEN:-nginx-gen} restart: always + environment: + SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d From 1bc57b15e535471b6ab323c1ee9c626076535eff Mon Sep 17 00:00:00 2001 From: Alexander Kutsan Date: Tue, 11 Feb 2020 02:57:21 +0200 Subject: [PATCH 016/158] Update start.sh (#177) Update bash init script --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 96a1ce9f..6364531b 100755 --- a/start.sh +++ b/start.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file should be used to prepare and run your WebProxy after set up your .env file From be49ec7cd48c5c03f29c4bbff49a3a083668a9d6 Mon Sep 17 00:00:00 2001 From: Marco Stroppel Date: Mon, 14 Sep 2020 12:04:13 +0200 Subject: [PATCH 017/158] Add link to webtrees container and text fixes (#200) * Added link to webtrees --- .github/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/README.md b/.github/README.md index cd3444b2..d8882540 100644 --- a/.github/README.md +++ b/.github/README.md @@ -238,23 +238,23 @@ To stop and remove your test container run our `stop_test.sh` script: Or simply run: ```bash -docker stop test-web && docker rm test-web +docker stop test-web && docker rm test-web ``` ## Running this Proxy on a Synology NAS Please checkout this [howto](https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/blob/master/docs/HOWTO-Synlogy.md). +## Production Environment using Web Proxy -## Production Environment using Web Proxy and Wordpress +Following are links to docker containers using this web proxy: 1. [docker-wordpress-letsencrypt](https://github.com/evertramos/docker-wordpress-letsencrypt) 2. [docker-portainer-letsencrypt](https://github.com/evertramos/docker-portainer-letsencrypt) 3. [docker-nextcloud-letsencrypt](https://github.com/evertramos/docker-nextcloud-letsencrypt) 4. [docker-registry-letsencrypt](https://github.com/evertramos/docker-registry-letsencrypt) 5. [gitlab-docker-letsencrypt](https://github.com/steevepay/gitlab-docker-letsencrypt) - -In this repo you will find a docker-compose file to start a production environment for a new wordpress site. +6. [docker-webtrees-letsencrypt](https://github.com/mstroppel/docker-webtrees-letsencrypt) ## Credits @@ -265,7 +265,6 @@ Credits goes to: - docker-gen [@jwilder](https://github.com/jwilder/docker-gen) - docker-letsencrypt-nginx-proxy-companion [@JrCs](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) - ### Special thanks to: - [@j7an](https://github.com/j7an) - Many contributions and the ipv6 branch! From 4eceee9061b1a3084ae850c540a374ea02a002bd Mon Sep 17 00:00:00 2001 From: Alexander Bleissem Date: Mon, 14 Sep 2020 12:05:45 +0200 Subject: [PATCH 018/158] use stable docker images (#203) --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d8bd8148..6fcab021 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: nginx-web: - image: nginx + image: nginx:stable-alpine labels: com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" container_name: ${NGINX_WEB:-nginx-web} @@ -43,7 +43,7 @@ services: max-file: ${NGINX_GEN_LOG_MAX_FILE:-10} nginx-letsencrypt: - image: jrcs/letsencrypt-nginx-proxy-companion + image: jrcs/letsencrypt-nginx-proxy-companion:stable container_name: ${LETS_ENCRYPT:-nginx-letsencrypt} restart: always volumes: From f6ffeb9018ad93ff9ffdf87d0d9e5b671c07663b Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 28 Jan 2021 09:01:44 -0300 Subject: [PATCH 019/158] remove beer pay --- .github/README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/README.md b/.github/README.md index d8882540..52684477 100644 --- a/.github/README.md +++ b/.github/README.md @@ -271,8 +271,3 @@ Credits goes to: - [@buchdag](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion/pull/226#event-1145800062) - [@fracz](https://github.com/fracz) - Many contributions! - -## Support on Beerpay -Hey dude! Help me out for a couple of :beers:! - -[![Beerpay](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/badge.svg?style=beer-square)](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion) [![Beerpay](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/make-wish.svg?style=flat-square)](https://beerpay.io/evertramos/docker-compose-letsencrypt-nginx-proxy-companion?focus=wish) From 6b0e1cbecaa52064233db12a83889f335a398ce1 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 21 Feb 2021 14:11:10 -0300 Subject: [PATCH 020/158] Add free open base scripts for nginx-proxy --- basescript-free/check/check-base-env-file.sh | 47 ++++++++ basescript-free/check/check-docker.sh | 49 ++++++++ basescript-free/check/check-running-script.sh | 33 ++++++ basescript-free/messages/message-echoout.sh | 108 ++++++++++++++++++ basescript-free/starts/color.sh | 43 +++++++ .../starts/starts-initial-check.sh | 44 +++++++ 6 files changed, 324 insertions(+) create mode 100755 basescript-free/check/check-base-env-file.sh create mode 100755 basescript-free/check/check-docker.sh create mode 100755 basescript-free/check/check-running-script.sh create mode 100755 basescript-free/messages/message-echoout.sh create mode 100755 basescript-free/starts/color.sh create mode 100755 basescript-free/starts/starts-initial-check.sh diff --git a/basescript-free/check/check-base-env-file.sh b/basescript-free/check/check-base-env-file.sh new file mode 100755 index 00000000..4c756776 --- /dev/null +++ b/basescript-free/check/check-base-env-file.sh @@ -0,0 +1,47 @@ +#----------------------------------------------------------------------- +# +# Basescript function +# +# The basescript functions were designed to work as abstract function, +# so it could be used in many different contexts executing specific job +# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be carefull when editing this file, it is part of a bigger script! +# +# Basescript - https://github.com/evertramos/basescript +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This function has one main objective: +# 1. Check if the .env file exists in the base folder +# +# You must/might inform the parameters below: +# 1. n/a +# 2. [optional] (default: ) n/a +# +#----------------------------------------------------------------------- + +checkbaseenvfile() +{ + if [[ "$DEBUG" == true ]]; then + echo "Check if base folder '.env' file is set." + fi + + cd $SCRIPT_PATH"/../" + + if [[ -e .env ]]; then + source .env + cd - > /dev/null 2>&1 + else + MESSAGE="'.env' file not found at the base folder. Please check! \n\n path: $(pwd)" + return 1 + fi +} diff --git a/basescript-free/check/check-docker.sh b/basescript-free/check/check-docker.sh new file mode 100755 index 00000000..1b427fe3 --- /dev/null +++ b/basescript-free/check/check-docker.sh @@ -0,0 +1,49 @@ +#----------------------------------------------------------------------- +# +# Basescript function +# +# The basescript functions were designed to work as abstract function, +# so it could be used in many different contexts executing specific job +# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be carefull when editing this file, it is part of a bigger script! +# +# Basescript - https://github.com/evertramos/basescript +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This function has one main objective: +# 1. Script to check if docker is running +# +# You must/might inform the parameters below: +# 1. n/a +# 2. [optional] (default: ) n/a +# +#----------------------------------------------------------------------- + +DOCKER_COMMAND="docker" + +# Check if Docker is installed in the System +checkdocker() +{ + if [[ "$DEBUG" == true ]]; then + echo "Check if '$DOCKER_COMMAND' is installed and running." + fi + if [[ ! -x "$(command -v "$DOCKER_COMMAND")" ]]; then + MESSAGE="'docker' is not installed!" + return 1 + fi + + if [[ ! "$(systemctl is-active "$DOCKER_COMMAND")" == "active" ]]; then + MESSAGE="'docker' is not running..." + return 1 + fi +} diff --git a/basescript-free/check/check-running-script.sh b/basescript-free/check/check-running-script.sh new file mode 100755 index 00000000..9b71bfd4 --- /dev/null +++ b/basescript-free/check/check-running-script.sh @@ -0,0 +1,33 @@ +# This file is part of a bigger script! +# +# Be carefull when editing it + +# ---------------------------------------------------------------------- +# +# Script devoloped to BM Digital +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos with usage right granted to BM Digital +# +# ---------------------------------------------------------------------- + +# Script to check if there is another instance of the script running +check_running_script() +{ + local LOCAL_PID_FILE + + LOCAL_PID_FILE=${1:-$PID_FILE} + + [[ "$DEBUG" == true ]] && echo "Check if there is another instance of the script running..." + + PID=$SCRIPT_PATH/$LOCAL_PID_FILE + + [[ "$DEBUG" = true ]] && echo "pid: "$PID + + if [[ -e "$PID" ]]; then + MESSAGE="Script already running." + return 1 + fi +} diff --git a/basescript-free/messages/message-echoout.sh b/basescript-free/messages/message-echoout.sh new file mode 100755 index 00000000..30a3cd1a --- /dev/null +++ b/basescript-free/messages/message-echoout.sh @@ -0,0 +1,108 @@ +#----------------------------------------------------------------------- +# +# Basescript function +# +# The basescript functions were designed to work as abstract function, +# so it could be used in many different contexts executing specific job +# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be carefull when editing this file, it is part of a bigger scripts! +# +# Basescript - https://github.com/evertramos/basescript +# +#----------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# This function has one main objective: +# 1. Show output messages +# +# You must inform the parameters below: +# 1. Message that should be outputed +# 2. [optional] Stopping execution on messaging (default: 'depends') +# +# ---------------------------------------------------------------------- + +# Error message +echoerr() +{ + local LOCAL_STOP_EXECUTION_ON_ERROR + + LOCAL_STOP_EXECUTION_ON_ERROR=${2:-true} + + # Check $SILENT mode + if [[ "$SILENT" == true ]]; then + echo $1 + else + echo "${red}[ERROR]---------------------------------------------------------------${reset}" + printf "${red}${1//\\n/\\n}${reset}" 1>&2; + echo + echo "${red}----------------------------------------------------------------------${reset}" + echo + fi + + [[ "$LOCAL_STOP_EXECUTION_ON_ERROR" == true ]] && exit 1 +} + +# Warning message +echowarning() +{ + local LOCAL_STOP_EXECUTION_ON_ERROR + + LOCAL_STOP_EXECUTION_ON_ERROR=${2:-false} + + # Check $SILENT mode + if [[ "$SILENT" != true ]]; then + echo "${yellow}[WARNING]-------------------------------------------------------------${reset}" + printf "${yellow}${1//\\n/\\n}${reset}" 1>&2; + echo + echo "${yellow}----------------------------------------------------------------------${reset}" + echo + fi + + [[ "$LOCAL_STOP_EXECUTION_ON_ERROR" == true ]] && exit 1 +} + +# Success message +echosuccess() +{ + local LOCAL_STOP_EXECUTION_ON_ERROR + + LOCAL_STOP_EXECUTION_ON_ERROR=${2:-false} + + # Check $SILENT mode + if [[ "$SILENT" != true ]]; then + echo "${green}[SUCCESS]-------------------------------------------------------------${reset}" + printf "${green}${1//\\n/\\n}${reset}" 1>&2; + echo + echo "${green}----------------------------------------------------------------------${reset}" + echo + fi + + [[ "$LOCAL_STOP_EXECUTION_ON_ERROR" == true ]] && exit 1 +} + +# Regular line message +echoline() +{ + local LOCAL_STOP_EXECUTION_ON_ERROR + + LOCAL_STOP_EXECUTION_ON_ERROR=${2:-false} + + # Check $SILENT mode + if [[ "$SILENT" != true ]]; then + echo "----------------------------------------------------------------------" + printf " ${1//\\n/\\n}" 1>&2; + echo + echo "----------------------------------------------------------------------" + echo + fi + + [[ "$LOCAL_STOP_EXECUTION_ON_ERROR" == true ]] && exit 1 +} diff --git a/basescript-free/starts/color.sh b/basescript-free/starts/color.sh new file mode 100755 index 00000000..b55e0389 --- /dev/null +++ b/basescript-free/starts/color.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +#----------------------------------------------------------------------- +# +# Basescript function +# +# The basescript functions were designed to work as abstract function, +# so it could be used in many different contexts executing specific job +# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be carefull when editing this file, it is part of a bigger scripts! +# +# Basescript - https://github.com/evertramos/basescript +# +#----------------------------------------------------------------------- +# +# source: https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux +# +# ---------------------------------------------------------------------- +# This script has one main objective: +# 1. Set colors for output messages +# +# ---------------------------------------------------------------------- + +# Colors on output +black=`tput setaf 0` +red=`tput setaf 1` +green=`tput setaf 2` +yellow=`tput setaf 3` +blue=`tput setaf 4` +magenta=`tput setaf 5` +cyan=`tput setaf 6` +white=`tput setaf 7` + +reset=`tput sgr0` + diff --git a/basescript-free/starts/starts-initial-check.sh b/basescript-free/starts/starts-initial-check.sh new file mode 100755 index 00000000..3a77c8d5 --- /dev/null +++ b/basescript-free/starts/starts-initial-check.sh @@ -0,0 +1,44 @@ +#----------------------------------------------------------------------- +# +# Basescript functions +# +# The basescript functions were designed to work as abstract function, +# so it could be used in many different contexts executing specific job +# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be carefull when editing this file, it is part of a bigger scripts! +# +# Basescript - https://github.com/evertramos/basescript +# +#----------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# This function has one main objective: +# 1. Check initial setup +# +# You must inform the parameters below: +# 1. [optional] Pid file name (default: ) +# +# ---------------------------------------------------------------------- +starts_initial_check() +{ + local LOCAL_PID_FILE + + LOCAL_PID_FILE=${1:-$PID_FILE} + + # Check if docker is installed + run_function checkdocker + + # Check if there is an .env file in base folder + run_function checkbaseenvfile + + # Check if you are already running an instance of this Script + run_function check_running_script $LOCAL_PID_FILE +} From 5ea8f6af21e6705592cff9ca17be4f08f6a2d699 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 21 Feb 2021 14:16:21 -0300 Subject: [PATCH 021/158] Add basescripts for nginx-proxy --- basescript-free/README.md | 35 ++++++++++ basescript-free/bootstrap.sh | 62 +++++++++++++++++ basescript-free/system/run-function.sh | 95 ++++++++++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 basescript-free/README.md create mode 100755 basescript-free/bootstrap.sh create mode 100755 basescript-free/system/run-function.sh diff --git a/basescript-free/README.md b/basescript-free/README.md new file mode 100644 index 00000000..e24bae91 --- /dev/null +++ b/basescript-free/README.md @@ -0,0 +1,35 @@ +This is an open (free) version of basescript! + +# Base Scripts + +Some handy scripts to make your life easier. + +## Thoughts + +The scripts was designed thinking of a few baselines: + +- Simplicity +- Reusability +- Meaningful reading + +and the Unix concept of DOTADIW: +- Do One Thing And Do It Well + +## Versioning + +Every change should be non breakable, if it worked for you in some *main version* it should continue to work in all corrections and new functions. + +Versioning: v**X.Y** + +'X': main version + +'Y': corrections / new functions + +## Documentation + +There will be a specific page for documentation and samples of every function in this repo. + +Please check + +[Docs](https://github.com/evertramos/basescript/blob/master/docs/README.md) + diff --git a/basescript-free/bootstrap.sh b/basescript-free/bootstrap.sh new file mode 100755 index 00000000..5e44c1d2 --- /dev/null +++ b/basescript-free/bootstrap.sh @@ -0,0 +1,62 @@ +#----------------------------------------------------------------------- +# +# Basescript function +# +# The basescript functions were designed to work as abstract function, +# so it could be used in many different contexts executing specific job +# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be carefull when editing this file, it is part of a bigger script! +# +# Basescript - https://github.com/evertramos/basescript +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This script has one main objective: +# 1. Load all functions in local folder and subfolders +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Fill out local variables +#----------------------------------------------------------------------- +# Get Current directory +LOCAL_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Bootstrap file name +BOOTSTRAP_FILE_NAME="bootstrap.sh" + +#----------------------------------------------------------------------- +# Debug message +#----------------------------------------------------------------------- +[[ "$DEBUG" == true ]] && "Reading base script files... [bootstrap.sh]" + +#----------------------------------------------------------------------- +# Read files with extension '.sh' +#----------------------------------------------------------------------- +# Loop the base folder and source all files in root folder +for file in $LOCAL_PATH/*.sh +do + [[ $file != $LOCAL_PATH/$BOOTSTRAP_FILE_NAME ]] && source $file +done + +# Loop through all folders in the base folder and source all files inside +for dir in $LOCAL_PATH/*/ +do + local_dir=${dir%*/} + + for file in $local_dir/*.sh + do + [[ $file != $LOCAL_PATH/$BOOTSTRAP_FILE_NAME ]] && source $file + done +done + +return 0 diff --git a/basescript-free/system/run-function.sh b/basescript-free/system/run-function.sh new file mode 100755 index 00000000..fbd3b301 --- /dev/null +++ b/basescript-free/system/run-function.sh @@ -0,0 +1,95 @@ +#----------------------------------------------------------------------- +# +# Basescript function +# +# The basescript functions were designed to work as abstract function, +# so it could be used in many different contexts executing specific job +# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be carefull when editing this file, it is part of a bigger script! +# +# Basescript - https://github.com/evertramos/basescript +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This function has one main objective: +# 1. Call other functions in the environment passing parameter through +# +# You must/might inform the parameters below: +# 1. Function name +# 2. [optional] (default: null) you can pass up to 4 parameters ] +# +#----------------------------------------------------------------------- + +run_function() { + + [[ $1 == "" ]] && echoerr "You must inform an argument to the function '${FUNCNAME[0]}', \nplease check the docs." + + # Check $SILENT mode + if [[ "$SILENT" == true ]]; then + if [[ ! -z $5 ]]; then + $1 "$2" "$3" "$4" "$5" + elif [[ ! -z $4 ]]; then + $1 "$2" "$3" "$4" + elif [[ ! -z $3 ]]; then + $1 "$2" "$3" + elif [[ ! -z $2 ]]; then + $1 "$2" + else + $1 + fi + else + echo "${yellow}[start]---------------------------------------------------------------${reset}" + + # Call the specified function + if [[ -n "$(type -t "$1")" ]] && [[ "$(type -t "$1")" = function ]]; then + echo "${cyan}...running function \"${1}\":${reset}" + if [[ ! -z $5 ]]; then + $1 "$2" "$3" "$4" "$5" + elif [[ ! -z $4 ]]; then + $1 "$2" "$3" "$4" + elif [[ ! -z $3 ]]; then + $1 "$2" "$3" + elif [[ ! -z $2 ]]; then + $1 "$2" + else + $1 + fi + else + echo "${red}----------------------------------------------------------------------${reset}" + echo "${red}|${reset}" + echo "${red}| [ERROR] Function \"$1\" not found!${reset}" + echo "${red}|${reset}" + echo "${red}----------------------------------------------------------------------${reset}" + echo "${yellow}[ended with ${red}[ERROR]${yellow}]--------------------------------------------------${reset}" + exit 1 + fi + + # Show result from the function execution + if [[ $? -ne 0 ]]; then + echo "${red}----------------------------------------------------------------------${reset}" + echo "${red}|${reset}" + echo "${red}| Ups! Something went wrong...${reset}" + echo "${red}|${reset}" + printf "${red}| ${MESSAGE//\\n/\\n|}${reset}" + echo + echo "${red}|${reset}" + echo "${red}----------------------------------------------------------------------${reset}" + echo "${yellow}[ended with ${red}ERROR${yellow}/WARNING ($?)-----------------------------------------${reset}" + exit 1 + else + echo "${green}>>> Success!${reset}" + fi + + echo "${yellow}[end]-----------------------------------------------------------------${reset}" + echo + fi +} From 3e65ff5f44f92ae237c1865fb8d24703e90a0092 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 21 Feb 2021 14:18:43 -0300 Subject: [PATCH 022/158] Update basescript folder name --- {basescript-free => basescript}/README.md | 4 +++- {basescript-free => basescript}/bootstrap.sh | 0 {basescript-free => basescript}/check/check-base-env-file.sh | 0 {basescript-free => basescript}/check/check-docker.sh | 0 {basescript-free => basescript}/check/check-running-script.sh | 0 {basescript-free => basescript}/messages/message-echoout.sh | 0 {basescript-free => basescript}/starts/color.sh | 0 .../starts/starts-initial-check.sh | 0 {basescript-free => basescript}/system/run-function.sh | 0 9 files changed, 3 insertions(+), 1 deletion(-) rename {basescript-free => basescript}/README.md (92%) rename {basescript-free => basescript}/bootstrap.sh (100%) rename {basescript-free => basescript}/check/check-base-env-file.sh (100%) rename {basescript-free => basescript}/check/check-docker.sh (100%) rename {basescript-free => basescript}/check/check-running-script.sh (100%) rename {basescript-free => basescript}/messages/message-echoout.sh (100%) rename {basescript-free => basescript}/starts/color.sh (100%) rename {basescript-free => basescript}/starts/starts-initial-check.sh (100%) rename {basescript-free => basescript}/system/run-function.sh (100%) diff --git a/basescript-free/README.md b/basescript/README.md similarity index 92% rename from basescript-free/README.md rename to basescript/README.md index e24bae91..d6f09879 100644 --- a/basescript-free/README.md +++ b/basescript/README.md @@ -1,4 +1,6 @@ -This is an open (free) version of basescript! +# This is an open (free) version of basescript! + +--- # Base Scripts diff --git a/basescript-free/bootstrap.sh b/basescript/bootstrap.sh similarity index 100% rename from basescript-free/bootstrap.sh rename to basescript/bootstrap.sh diff --git a/basescript-free/check/check-base-env-file.sh b/basescript/check/check-base-env-file.sh similarity index 100% rename from basescript-free/check/check-base-env-file.sh rename to basescript/check/check-base-env-file.sh diff --git a/basescript-free/check/check-docker.sh b/basescript/check/check-docker.sh similarity index 100% rename from basescript-free/check/check-docker.sh rename to basescript/check/check-docker.sh diff --git a/basescript-free/check/check-running-script.sh b/basescript/check/check-running-script.sh similarity index 100% rename from basescript-free/check/check-running-script.sh rename to basescript/check/check-running-script.sh diff --git a/basescript-free/messages/message-echoout.sh b/basescript/messages/message-echoout.sh similarity index 100% rename from basescript-free/messages/message-echoout.sh rename to basescript/messages/message-echoout.sh diff --git a/basescript-free/starts/color.sh b/basescript/starts/color.sh similarity index 100% rename from basescript-free/starts/color.sh rename to basescript/starts/color.sh diff --git a/basescript-free/starts/starts-initial-check.sh b/basescript/starts/starts-initial-check.sh similarity index 100% rename from basescript-free/starts/starts-initial-check.sh rename to basescript/starts/starts-initial-check.sh diff --git a/basescript-free/system/run-function.sh b/basescript/system/run-function.sh similarity index 100% rename from basescript-free/system/run-function.sh rename to basescript/system/run-function.sh From db7f94072a81dc62b0e9efaffce0a29bcb396694 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 21 Feb 2021 14:19:37 -0300 Subject: [PATCH 023/158] Update readme with repo path --- basescript/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript/README.md b/basescript/README.md index d6f09879..55bf7483 100644 --- a/basescript/README.md +++ b/basescript/README.md @@ -1,4 +1,4 @@ -# This is an open (free) version of basescript! +# This is an open (free) version of [basescript](https://github.com/evertramos/basescript)! --- From 42e9213d7b908e9a1bbcc996732fae7232208e73 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 21 Feb 2021 17:44:05 -0300 Subject: [PATCH 024/158] Delete basescript directory this will be a submodule --- basescript/README.md | 37 -------- basescript/bootstrap.sh | 62 ------------- basescript/check/check-base-env-file.sh | 47 ---------- basescript/check/check-docker.sh | 49 ---------- basescript/check/check-running-script.sh | 33 ------- basescript/messages/message-echoout.sh | 108 ---------------------- basescript/starts/color.sh | 43 --------- basescript/starts/starts-initial-check.sh | 44 --------- basescript/system/run-function.sh | 95 ------------------- 9 files changed, 518 deletions(-) delete mode 100644 basescript/README.md delete mode 100755 basescript/bootstrap.sh delete mode 100755 basescript/check/check-base-env-file.sh delete mode 100755 basescript/check/check-docker.sh delete mode 100755 basescript/check/check-running-script.sh delete mode 100755 basescript/messages/message-echoout.sh delete mode 100755 basescript/starts/color.sh delete mode 100755 basescript/starts/starts-initial-check.sh delete mode 100755 basescript/system/run-function.sh diff --git a/basescript/README.md b/basescript/README.md deleted file mode 100644 index 55bf7483..00000000 --- a/basescript/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# This is an open (free) version of [basescript](https://github.com/evertramos/basescript)! - ---- - -# Base Scripts - -Some handy scripts to make your life easier. - -## Thoughts - -The scripts was designed thinking of a few baselines: - -- Simplicity -- Reusability -- Meaningful reading - -and the Unix concept of DOTADIW: -- Do One Thing And Do It Well - -## Versioning - -Every change should be non breakable, if it worked for you in some *main version* it should continue to work in all corrections and new functions. - -Versioning: v**X.Y** - -'X': main version - -'Y': corrections / new functions - -## Documentation - -There will be a specific page for documentation and samples of every function in this repo. - -Please check - -[Docs](https://github.com/evertramos/basescript/blob/master/docs/README.md) - diff --git a/basescript/bootstrap.sh b/basescript/bootstrap.sh deleted file mode 100755 index 5e44c1d2..00000000 --- a/basescript/bootstrap.sh +++ /dev/null @@ -1,62 +0,0 @@ -#----------------------------------------------------------------------- -# -# Basescript function -# -# The basescript functions were designed to work as abstract function, -# so it could be used in many different contexts executing specific job -# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" -# -# Developed by -# Evert Ramos -# -# Copyright Evert Ramos -# -#----------------------------------------------------------------------- -# -# Be carefull when editing this file, it is part of a bigger script! -# -# Basescript - https://github.com/evertramos/basescript -# -#----------------------------------------------------------------------- - -#----------------------------------------------------------------------- -# This script has one main objective: -# 1. Load all functions in local folder and subfolders -# -#----------------------------------------------------------------------- - -#----------------------------------------------------------------------- -# Fill out local variables -#----------------------------------------------------------------------- -# Get Current directory -LOCAL_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" - -# Bootstrap file name -BOOTSTRAP_FILE_NAME="bootstrap.sh" - -#----------------------------------------------------------------------- -# Debug message -#----------------------------------------------------------------------- -[[ "$DEBUG" == true ]] && "Reading base script files... [bootstrap.sh]" - -#----------------------------------------------------------------------- -# Read files with extension '.sh' -#----------------------------------------------------------------------- -# Loop the base folder and source all files in root folder -for file in $LOCAL_PATH/*.sh -do - [[ $file != $LOCAL_PATH/$BOOTSTRAP_FILE_NAME ]] && source $file -done - -# Loop through all folders in the base folder and source all files inside -for dir in $LOCAL_PATH/*/ -do - local_dir=${dir%*/} - - for file in $local_dir/*.sh - do - [[ $file != $LOCAL_PATH/$BOOTSTRAP_FILE_NAME ]] && source $file - done -done - -return 0 diff --git a/basescript/check/check-base-env-file.sh b/basescript/check/check-base-env-file.sh deleted file mode 100755 index 4c756776..00000000 --- a/basescript/check/check-base-env-file.sh +++ /dev/null @@ -1,47 +0,0 @@ -#----------------------------------------------------------------------- -# -# Basescript function -# -# The basescript functions were designed to work as abstract function, -# so it could be used in many different contexts executing specific job -# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" -# -# Developed by -# Evert Ramos -# -# Copyright Evert Ramos -# -#----------------------------------------------------------------------- -# -# Be carefull when editing this file, it is part of a bigger script! -# -# Basescript - https://github.com/evertramos/basescript -# -#----------------------------------------------------------------------- - -#----------------------------------------------------------------------- -# This function has one main objective: -# 1. Check if the .env file exists in the base folder -# -# You must/might inform the parameters below: -# 1. n/a -# 2. [optional] (default: ) n/a -# -#----------------------------------------------------------------------- - -checkbaseenvfile() -{ - if [[ "$DEBUG" == true ]]; then - echo "Check if base folder '.env' file is set." - fi - - cd $SCRIPT_PATH"/../" - - if [[ -e .env ]]; then - source .env - cd - > /dev/null 2>&1 - else - MESSAGE="'.env' file not found at the base folder. Please check! \n\n path: $(pwd)" - return 1 - fi -} diff --git a/basescript/check/check-docker.sh b/basescript/check/check-docker.sh deleted file mode 100755 index 1b427fe3..00000000 --- a/basescript/check/check-docker.sh +++ /dev/null @@ -1,49 +0,0 @@ -#----------------------------------------------------------------------- -# -# Basescript function -# -# The basescript functions were designed to work as abstract function, -# so it could be used in many different contexts executing specific job -# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" -# -# Developed by -# Evert Ramos -# -# Copyright Evert Ramos -# -#----------------------------------------------------------------------- -# -# Be carefull when editing this file, it is part of a bigger script! -# -# Basescript - https://github.com/evertramos/basescript -# -#----------------------------------------------------------------------- - -#----------------------------------------------------------------------- -# This function has one main objective: -# 1. Script to check if docker is running -# -# You must/might inform the parameters below: -# 1. n/a -# 2. [optional] (default: ) n/a -# -#----------------------------------------------------------------------- - -DOCKER_COMMAND="docker" - -# Check if Docker is installed in the System -checkdocker() -{ - if [[ "$DEBUG" == true ]]; then - echo "Check if '$DOCKER_COMMAND' is installed and running." - fi - if [[ ! -x "$(command -v "$DOCKER_COMMAND")" ]]; then - MESSAGE="'docker' is not installed!" - return 1 - fi - - if [[ ! "$(systemctl is-active "$DOCKER_COMMAND")" == "active" ]]; then - MESSAGE="'docker' is not running..." - return 1 - fi -} diff --git a/basescript/check/check-running-script.sh b/basescript/check/check-running-script.sh deleted file mode 100755 index 9b71bfd4..00000000 --- a/basescript/check/check-running-script.sh +++ /dev/null @@ -1,33 +0,0 @@ -# This file is part of a bigger script! -# -# Be carefull when editing it - -# ---------------------------------------------------------------------- -# -# Script devoloped to BM Digital -# -# Developed by -# Evert Ramos -# -# Copyright Evert Ramos with usage right granted to BM Digital -# -# ---------------------------------------------------------------------- - -# Script to check if there is another instance of the script running -check_running_script() -{ - local LOCAL_PID_FILE - - LOCAL_PID_FILE=${1:-$PID_FILE} - - [[ "$DEBUG" == true ]] && echo "Check if there is another instance of the script running..." - - PID=$SCRIPT_PATH/$LOCAL_PID_FILE - - [[ "$DEBUG" = true ]] && echo "pid: "$PID - - if [[ -e "$PID" ]]; then - MESSAGE="Script already running." - return 1 - fi -} diff --git a/basescript/messages/message-echoout.sh b/basescript/messages/message-echoout.sh deleted file mode 100755 index 30a3cd1a..00000000 --- a/basescript/messages/message-echoout.sh +++ /dev/null @@ -1,108 +0,0 @@ -#----------------------------------------------------------------------- -# -# Basescript function -# -# The basescript functions were designed to work as abstract function, -# so it could be used in many different contexts executing specific job -# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" -# -# Developed by -# Evert Ramos -# -# Copyright Evert Ramos -# -#----------------------------------------------------------------------- -# -# Be carefull when editing this file, it is part of a bigger scripts! -# -# Basescript - https://github.com/evertramos/basescript -# -#----------------------------------------------------------------------- - -# ---------------------------------------------------------------------- -# This function has one main objective: -# 1. Show output messages -# -# You must inform the parameters below: -# 1. Message that should be outputed -# 2. [optional] Stopping execution on messaging (default: 'depends') -# -# ---------------------------------------------------------------------- - -# Error message -echoerr() -{ - local LOCAL_STOP_EXECUTION_ON_ERROR - - LOCAL_STOP_EXECUTION_ON_ERROR=${2:-true} - - # Check $SILENT mode - if [[ "$SILENT" == true ]]; then - echo $1 - else - echo "${red}[ERROR]---------------------------------------------------------------${reset}" - printf "${red}${1//\\n/\\n}${reset}" 1>&2; - echo - echo "${red}----------------------------------------------------------------------${reset}" - echo - fi - - [[ "$LOCAL_STOP_EXECUTION_ON_ERROR" == true ]] && exit 1 -} - -# Warning message -echowarning() -{ - local LOCAL_STOP_EXECUTION_ON_ERROR - - LOCAL_STOP_EXECUTION_ON_ERROR=${2:-false} - - # Check $SILENT mode - if [[ "$SILENT" != true ]]; then - echo "${yellow}[WARNING]-------------------------------------------------------------${reset}" - printf "${yellow}${1//\\n/\\n}${reset}" 1>&2; - echo - echo "${yellow}----------------------------------------------------------------------${reset}" - echo - fi - - [[ "$LOCAL_STOP_EXECUTION_ON_ERROR" == true ]] && exit 1 -} - -# Success message -echosuccess() -{ - local LOCAL_STOP_EXECUTION_ON_ERROR - - LOCAL_STOP_EXECUTION_ON_ERROR=${2:-false} - - # Check $SILENT mode - if [[ "$SILENT" != true ]]; then - echo "${green}[SUCCESS]-------------------------------------------------------------${reset}" - printf "${green}${1//\\n/\\n}${reset}" 1>&2; - echo - echo "${green}----------------------------------------------------------------------${reset}" - echo - fi - - [[ "$LOCAL_STOP_EXECUTION_ON_ERROR" == true ]] && exit 1 -} - -# Regular line message -echoline() -{ - local LOCAL_STOP_EXECUTION_ON_ERROR - - LOCAL_STOP_EXECUTION_ON_ERROR=${2:-false} - - # Check $SILENT mode - if [[ "$SILENT" != true ]]; then - echo "----------------------------------------------------------------------" - printf " ${1//\\n/\\n}" 1>&2; - echo - echo "----------------------------------------------------------------------" - echo - fi - - [[ "$LOCAL_STOP_EXECUTION_ON_ERROR" == true ]] && exit 1 -} diff --git a/basescript/starts/color.sh b/basescript/starts/color.sh deleted file mode 100755 index b55e0389..00000000 --- a/basescript/starts/color.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -#----------------------------------------------------------------------- -# -# Basescript function -# -# The basescript functions were designed to work as abstract function, -# so it could be used in many different contexts executing specific job -# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" -# -# Developed by -# Evert Ramos -# -# Copyright Evert Ramos -# -#----------------------------------------------------------------------- -# -# Be carefull when editing this file, it is part of a bigger scripts! -# -# Basescript - https://github.com/evertramos/basescript -# -#----------------------------------------------------------------------- -# -# source: https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux -# -# ---------------------------------------------------------------------- -# This script has one main objective: -# 1. Set colors for output messages -# -# ---------------------------------------------------------------------- - -# Colors on output -black=`tput setaf 0` -red=`tput setaf 1` -green=`tput setaf 2` -yellow=`tput setaf 3` -blue=`tput setaf 4` -magenta=`tput setaf 5` -cyan=`tput setaf 6` -white=`tput setaf 7` - -reset=`tput sgr0` - diff --git a/basescript/starts/starts-initial-check.sh b/basescript/starts/starts-initial-check.sh deleted file mode 100755 index 3a77c8d5..00000000 --- a/basescript/starts/starts-initial-check.sh +++ /dev/null @@ -1,44 +0,0 @@ -#----------------------------------------------------------------------- -# -# Basescript functions -# -# The basescript functions were designed to work as abstract function, -# so it could be used in many different contexts executing specific job -# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" -# -# Developed by -# Evert Ramos -# -# Copyright Evert Ramos -# -#----------------------------------------------------------------------- -# -# Be carefull when editing this file, it is part of a bigger scripts! -# -# Basescript - https://github.com/evertramos/basescript -# -#----------------------------------------------------------------------- - -# ---------------------------------------------------------------------- -# This function has one main objective: -# 1. Check initial setup -# -# You must inform the parameters below: -# 1. [optional] Pid file name (default: ) -# -# ---------------------------------------------------------------------- -starts_initial_check() -{ - local LOCAL_PID_FILE - - LOCAL_PID_FILE=${1:-$PID_FILE} - - # Check if docker is installed - run_function checkdocker - - # Check if there is an .env file in base folder - run_function checkbaseenvfile - - # Check if you are already running an instance of this Script - run_function check_running_script $LOCAL_PID_FILE -} diff --git a/basescript/system/run-function.sh b/basescript/system/run-function.sh deleted file mode 100755 index fbd3b301..00000000 --- a/basescript/system/run-function.sh +++ /dev/null @@ -1,95 +0,0 @@ -#----------------------------------------------------------------------- -# -# Basescript function -# -# The basescript functions were designed to work as abstract function, -# so it could be used in many different contexts executing specific job -# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" -# -# Developed by -# Evert Ramos -# -# Copyright Evert Ramos -# -#----------------------------------------------------------------------- -# -# Be carefull when editing this file, it is part of a bigger script! -# -# Basescript - https://github.com/evertramos/basescript -# -#----------------------------------------------------------------------- - -#----------------------------------------------------------------------- -# This function has one main objective: -# 1. Call other functions in the environment passing parameter through -# -# You must/might inform the parameters below: -# 1. Function name -# 2. [optional] (default: null) you can pass up to 4 parameters ] -# -#----------------------------------------------------------------------- - -run_function() { - - [[ $1 == "" ]] && echoerr "You must inform an argument to the function '${FUNCNAME[0]}', \nplease check the docs." - - # Check $SILENT mode - if [[ "$SILENT" == true ]]; then - if [[ ! -z $5 ]]; then - $1 "$2" "$3" "$4" "$5" - elif [[ ! -z $4 ]]; then - $1 "$2" "$3" "$4" - elif [[ ! -z $3 ]]; then - $1 "$2" "$3" - elif [[ ! -z $2 ]]; then - $1 "$2" - else - $1 - fi - else - echo "${yellow}[start]---------------------------------------------------------------${reset}" - - # Call the specified function - if [[ -n "$(type -t "$1")" ]] && [[ "$(type -t "$1")" = function ]]; then - echo "${cyan}...running function \"${1}\":${reset}" - if [[ ! -z $5 ]]; then - $1 "$2" "$3" "$4" "$5" - elif [[ ! -z $4 ]]; then - $1 "$2" "$3" "$4" - elif [[ ! -z $3 ]]; then - $1 "$2" "$3" - elif [[ ! -z $2 ]]; then - $1 "$2" - else - $1 - fi - else - echo "${red}----------------------------------------------------------------------${reset}" - echo "${red}|${reset}" - echo "${red}| [ERROR] Function \"$1\" not found!${reset}" - echo "${red}|${reset}" - echo "${red}----------------------------------------------------------------------${reset}" - echo "${yellow}[ended with ${red}[ERROR]${yellow}]--------------------------------------------------${reset}" - exit 1 - fi - - # Show result from the function execution - if [[ $? -ne 0 ]]; then - echo "${red}----------------------------------------------------------------------${reset}" - echo "${red}|${reset}" - echo "${red}| Ups! Something went wrong...${reset}" - echo "${red}|${reset}" - printf "${red}| ${MESSAGE//\\n/\\n|}${reset}" - echo - echo "${red}|${reset}" - echo "${red}----------------------------------------------------------------------${reset}" - echo "${yellow}[ended with ${red}ERROR${yellow}/WARNING ($?)-----------------------------------------${reset}" - exit 1 - else - echo "${green}>>> Success!${reset}" - fi - - echo "${yellow}[end]-----------------------------------------------------------------${reset}" - echo - fi -} From dd09a4f1dd917b266cf8ce3abb549f5c97718bf2 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 10 Mar 2021 19:24:20 -0300 Subject: [PATCH 025/158] Update README.md --- .github/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/README.md b/.github/README.md index 52684477..faf767f0 100644 --- a/.github/README.md +++ b/.github/README.md @@ -271,3 +271,5 @@ Credits goes to: - [@buchdag](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion/pull/226#event-1145800062) - [@fracz](https://github.com/fracz) - Many contributions! +# Support this project at [Patreon](https://www.patreon.com/evertramos) +[https://www.patreon.com/evertramos](https://www.patreon.com/evertramos) From bc9a623fd3fc60ba839a529bbfdabd2e29e030af Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 10 Mar 2021 20:50:16 -0300 Subject: [PATCH 026/158] Update README.md --- .github/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/README.md b/.github/README.md index faf767f0..0a206f9e 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,3 +1,5 @@ +# Updating to v2 branch - please consider testing! Thanks + # Web Proxy using Docker, NGINX and Let's Encrypt With this repo you will be able to set up your server with multiple sites using a single NGINX proxy to manage your connections, automating your apps container (port 80 and 443) to auto renew your ssl certificates with LetΒ΄s Encrypt. From 4a9cf79c576445d932388601e64d76ec5ade4509 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 10 Mar 2021 20:50:54 -0300 Subject: [PATCH 027/158] Update README.md --- .github/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 0a206f9e..4d887802 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,4 +1,6 @@ -# Updating to v2 branch - please consider testing! Thanks +# Updating to v2 branch + +# Please consider testing! Thanks # Web Proxy using Docker, NGINX and Let's Encrypt From c79bc5da9cd798c6688f723e8c5d85f0dc1a3a85 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 10 Mar 2021 21:12:35 -0300 Subject: [PATCH 028/158] Create FUNDING.yml --- .github/FUNDING.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..f546c600 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +patreon: https://www.patreon.com/evertramos From c0d0ce511cae49b01e6b4ab9536e5aa7bd0afe22 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 10 Mar 2021 21:14:14 -0300 Subject: [PATCH 029/158] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index f546c600..2783f12a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,3 @@ # These are supported funding model platforms -patreon: https://www.patreon.com/evertramos +patreon: evertramos From b478147bef4a34bdfafb8a2c63e2a8a6a9eeda2e Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 11 Mar 2021 23:21:08 -0300 Subject: [PATCH 030/158] Set version 2 to master (#250) * Testing version 2.0 nginx-proxy-companion * Start migrating to compantion v2.0 with acme.sh * Update docker-compose and .env file with new variables * Update nginx template to the latest version * Update nginx template to the latest version * Add default email variable * Add IPv6 support * update basescript to master * Update the response to strandard funcion name without check string * Update the response to strandard funcion name without check string * Comment out ipv6 * Update basescript to latest version * Fresh start script automation initial commit * Remove old scripts * Add fresh start usage * Add update nginx.tmpl with the latest version * Fix curl download file * Update usage with most common options * Set conf.d options into proxy * Comment out the default location to use the script base ./data folder * Update basescript to master * Start documenting v2 * Update README.md * Update repository name --- .env.sample | 144 +- .github/README.md | 185 +-- .gitignore | 1 + .gitmodules | 3 + LICENSE | 2 +- basescript | 1 + bin/.env | 60 + bin/fresh-start.sh | 1262 +++++++++++++++++ bin/localscript/bootstrap.sh | 44 + ...-docker-nginx-proxy-automation-env-file.sh | 29 + bin/localscript/check-local-env-file.sh | 31 + bin/localscript/update-docker-compose-file.sh | 47 + .../update-env-new-site-variables.sh | 79 ++ bin/localscript/usage-fresh-start.sh | 132 ++ docker-compose-multiple-networks.yml | 79 -- docker-compose.yml | 35 +- nginx.tmpl | 61 +- scripts/update.sh | 2 +- start.sh | 69 - test_start.sh | 22 - test_start_ssl.sh | 25 - test_stop.sh | 6 - 22 files changed, 1892 insertions(+), 427 deletions(-) create mode 100644 .gitmodules create mode 160000 basescript create mode 100644 bin/.env create mode 100755 bin/fresh-start.sh create mode 100755 bin/localscript/bootstrap.sh create mode 100755 bin/localscript/check-docker-nginx-proxy-automation-env-file.sh create mode 100755 bin/localscript/check-local-env-file.sh create mode 100755 bin/localscript/update-docker-compose-file.sh create mode 100755 bin/localscript/update-env-new-site-variables.sh create mode 100755 bin/localscript/usage-fresh-start.sh delete mode 100644 docker-compose-multiple-networks.yml delete mode 100755 start.sh delete mode 100755 test_start.sh delete mode 100755 test_start_ssl.sh delete mode 100755 test_stop.sh diff --git a/.env.sample b/.env.sample index 35014f86..cd543189 100644 --- a/.env.sample +++ b/.env.sample @@ -1,102 +1,112 @@ +#----------------------------------------------------------------------- # -# docker-compose-letsencrypt-nginx-proxy-companion +# https://github.com/evertramos/nginx-proxy-automation # -# A Web Proxy using docker with NGINX and Let's Encrypt -# Using the great community docker-gen, nginx-proxy and docker-letsencrypt-nginx-proxy-companion +# NGINX Proxy automation # -# This is the .env file to set up your webproxy environment - -# -# Your local containers NAME +# This is the .env file to set up nginx-proxy in your environment # -NGINX_WEB=nginx-web -DOCKER_GEN=nginx-gen -LETS_ENCRYPT=nginx-letsencrypt +#----------------------------------------------------------------------- +#----------------------------------------------------------------------- # -# Set the IP address of the external access Interface -# -IP=0.0.0.0 - +# NGINX-Proxy containers/service # -# Default Network +# The variables below is used to set the containers name for the nginx-proxy +# and the image version for each service, please note that if you use our script +# we will replace the service name in docker-compose file with the container name # -NETWORK=webproxy +NGINX_WEB=proxy-web +NGINX_IMAGE_VERSION=stable-alpine -# If you want to customize the created network, use the following variable -#NETWORK_OPTIONS="--opt encrypted=true" +DOCKER_GEN=docker-gen +DOCKER_GEN_IMAGE_VERSION=latest +LETS_ENCRYPT=letsencrypt-companion +NGINX_PROXY_COMPANION_IMAGE_VERSION=2.0 + +#----------------------------------------------------------------------- # -# Service Network (Optional) -# -# In case you decide to add a new network to your services containers you can set this -# network as a SERVICE_NETWORK +# IP address of the external interface # -# [WARNING] This setting was built to use our `start.sh` script or in that special case -# you could use the docker-composer with our multiple network option, as of: -# `docker-compose -f docker-compose-multiple-networks.yml up -d` +# The IP address below is used to bind your local services to the internet +# please make sure you use the correct address otherwise your proxy will not +# work properly, '0.0.0.0' will work, but we recommend to update this variable # -#SERVICE_NETWORK=webservices - -# If you want to customize the created network, use the following variable -#SERVICE_NETWORK_OPTIONS="--opt encrypted=true" +IP=0.0.0.0 +IPv6=::1 +#----------------------------------------------------------------------- # -## NGINX file path (mount into the host) -# Here you can configure the path where nginx stores all the configurations and certificates. -# With the value ./nginx-data it creates a new sub-folder into your current path. - -NGINX_FILES_PATH=./nginx-data - +# Default network name # -# NGINX use special conf files +# The network name set below is used by the proxy to forward internet requests +# to the correct containers in your environment, so please make sure to add this +# network in all docker containers, otherwise it will break the proxy redirection # -# In case you want to add some special configuration to your NGINX Web Proxy you could -# add your files to ./conf.d/ folder as of sample file 'uploadsize.conf' +NETWORK=proxy + +#----------------------------------------------------------------------- # -# [WARNING] This setting was built to use our `start.sh`. +# Data path for the nginx-proxy files # -# [WARNING] Once you set this options to true all your files will be copied to data -# folder (./data/conf.d). If you decide to remove this special configuration -# you must delete your files from data folder ./data/conf.d. +# The variable below will be used to place all files used by the nginx-proxy +# please consider including this folder to your backup services, once all config +# files, settings and certificates will be placed here in case you need to recover # -#USE_NGINX_CONF_FILES=true +NGINX_FILES_PATH=./data +#----------------------------------------------------------------------- # -# Docker Logging Config +# Docker logging settings # -# This section offers two options max-size and max-file, which follow the docker documentation -# as follow: +# Logs! Very important, right? But if you do not clean it up, it might causes you +# issues on disk space over time, so keep in mind to set this log options making sure +# you will have the least to audit, any further information on that please check the docs # -# logging: -# driver: "json-file" -# options: -# max-size: "200k" -# max-file: "10" +# https://docs.docker.com/config/containers/logging/configure/ # -#NGINX_WEB_LOG_DRIVER=json-file -#NGINX_WEB_LOG_MAX_SIZE=4m -#NGINX_WEB_LOG_MAX_FILE=10 +NGINX_WEB_LOG_DRIVER=json-file +NGINX_WEB_LOG_MAX_SIZE=4m +NGINX_WEB_LOG_MAX_FILE=10 -#NGINX_GEN_LOG_DRIVER=json-file -#NGINX_GEN_LOG_MAX_SIZE=2m -#NGINX_GEN_LOG_MAX_FILE=10 +NGINX_GEN_LOG_DRIVER=json-file +NGINX_GEN_LOG_MAX_SIZE=2m +NGINX_GEN_LOG_MAX_FILE=10 -#NGINX_LETSENCRYPT_LOG_DRIVER=json-file -#NGINX_LETSENCRYPT_LOG_MAX_SIZE=2m -#NGINX_LETSENCRYPT_LOG_MAX_FILE=10 +NGINX_LETSENCRYPT_LOG_DRIVER=json-file +NGINX_LETSENCRYPT_LOG_MAX_SIZE=2m +NGINX_LETSENCRYPT_LOG_MAX_FILE=10 +#----------------------------------------------------------------------- # -# Set the local exposed ports for http and https on the Host +# Docker ports that should be binded by the proxy # -# NOTE: The default values are 80 and 443, only change this options if you really know what you are doing +# This option were added by a contributor long ago, so might be a very specific case +# where you might need to change http and https port number, keep in mind that changes +# on that setting might will break the auto renewing Let's Encrypt certificate services # -#DOCKER_HTTP=80 -#DOCKER_HTTPS=443 - +DOCKER_HTTP=80 +DOCKER_HTTPS=443 +#----------------------------------------------------------------------- +# +# SSL policy (defaults to Mozilla-Intermediate) +# +# This also was added by a contributor which sets the default cipher configuration +# to the nginx-proxy container, which has the 'Mozilla-Intermediate' as default value +# plase make sure you take a good look at options in the url below before messing around # -# Set the SSL policy (defaults to Mozilla-Intermediate). -# See available options here: https://github.com/jwilder/nginx-proxy#how-ssl-support-works +# https://github.com/nginx-proxy/nginx-proxy#how-ssl-support-works # #SSL_POLICY=Mozilla-Modern + +#----------------------------------------------------------------------- +# +# Let's Encrypt default email +# +# You might want to inform a default email to Let's Encrypt certificate once it is +# a required parameter in order to issue the new certificate. This information will be +# replaced by the LETSENCRYPT_EMAIL environment varibale present in your docker container +# +DEFAULT_EMAIL=mail@yourdomain.tld diff --git a/.github/README.md b/.github/README.md index 4d887802..3369fb91 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,182 +1,123 @@ -# Updating to v2 branch -# Please consider testing! Thanks +# NGINX Proxy Automation -# Web Proxy using Docker, NGINX and Let's Encrypt +This project automates the [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy). +We strongly recommend you (:pray: please do!) to read all documentation. -With this repo you will be able to set up your server with multiple sites using a single NGINX proxy to manage your connections, automating your apps container (port 80 and 443) to auto renew your ssl certificates with LetΒ΄s Encrypt. +> To access the previous version of this project please access [version 0.4](https://github.com/evertramos/nginx-proxy-automation/tree/v0.4). + + +## What this project does + +This script will set up your server with the *nginx-proxy*, which will enable you to host multiple sites, +auto renewing LetΒ΄s Encrypt certificates. Something like: ![Web Proxy environment](https://github.com/evertramos/images/raw/master/webproxy.jpg) -## Why use it? +## Prerequisites -Using this set up you will be able start a production environment in a few seconds. For each new web project simply start the containers with the option `-e VIRTUAL_HOST=your.domain.com` and you will be ready to go. If you want to use SSL (Let's Encrypt) just add the tag `-e LETSENCRYPT_HOST=your.domain.com`. Done! +1. Linux! 🐧 (just in case...) -Easy and trustworthy! +> Please check all requirements at [requirements](/docs/requirements.md). +In order to use this compose file (docker-compose.yml) you must have: -## Prerequisites +2. Docker installed (https://docs.docker.com/engine/installation/) -In order to use this compose file (docker-compose.yml) you must have: +3. Docker-compose installed (https://docs.docker.com/compose/install/) -1. docker (https://docs.docker.com/engine/installation/) -2. docker-compose (https://docs.docker.com/compose/install/) +> I have an [easy-server](https://github.com/evertramos/easy-server) for myself which I use to install +> docker and docker-compose in new servers and some aliases and other stuff. Feel free to use it, **but** +> it is not related to this repo and maintainance it's for my own use only. Check './install/docker' folder. +Also, you will need to make sure you have: + +4. Port 80 and 443 available for binding - which means apache/nginx or other web services should not be + running in your server + +5. Server must be accessible by a public IP address ## How to use it 1. Clone this repository: ```bash -git clone https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion.git +$ git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-automation.git proxy ``` -2. Make a copy of our `.env.sample` and rename it to `.env`: +> Make sure you use the option '--recurse-submodules' once we use an external module in this project, please check +> [basescript](https://github.com/evertramos/basescript) -Update this file with your preferences. +> Please note we use 'proxy' as folder at the end. But you can change it to whatever fits you better -``` -# -# docker-compose-letsencrypt-nginx-proxy-companion -# -# A Web Proxy using docker with NGINX and Let's Encrypt -# Using the great community docker-gen, nginx-proxy and docker-letsencrypt-nginx-proxy-companion -# -# This is the .env file to set up your webproxy enviornment - -# -# Your local containers NAME -# -NGINX_WEB=nginx-web -DOCKER_GEN=nginx-gen -LETS_ENCRYPT=nginx-letsencrypt - -# -# Set the IP address of the external access Interface -# -IP=0.0.0.0 - -# -# Default Network -# -NETWORK=webproxy - -# If you want to customize the created network, use the following variable -#NETWORK_OPTIONS="--opt encrypted=true" - -# -# Service Network (Optional) -# -# In case you decide to add a new network to your services containers you can set this -# network as a SERVICE_NETWORK -# -# [WARNING] This setting was built to use our `start.sh` script or in that special case -# you could use the docker-composer with our multiple network option, as of: -# `docker-compose -f docker-compose-multiple-networks.yml up -d` -# -#SERVICE_NETWORK=webservices - -# If you want to customize the created network, use the following variable -#SERVICE_NETWORK_OPTIONS="--opt encrypted=true" - -# -## NGINX file path (mount into the host) -# Here you can configure the path where nginx stores all the configurations and certificates. -# With the value ./nginx-data it creates a new sub-folder into your current path. - -NGINX_FILES_PATH=./nginx-data - -# -# NGINX use special conf files -# -# In case you want to add some special configuration to your NGINX Web Proxy you could -# add your files to ./conf.d/ folder as of sample file 'uploadsize.conf' -# -# [WARNING] This setting was built to use our `start.sh`. -# -# [WARNING] Once you set this options to true all your files will be copied to data -# folder (./data/conf.d). If you decide to remove this special configuration -# you must delete your files from data folder ./data/conf.d. -# -#USE_NGINX_CONF_FILES=true - -# -# Docker Logging Config -# -# This section offers two options max-size and max-file, which follow the docker documentation -# as follow: -# -# logging: -# driver: "json-file" -# options: -# max-size: "200k" -# max-file: "10" -# -#NGINX_WEB_LOG_DRIVER=json-file -#NGINX_WEB_LOG_MAX_SIZE=4m -#NGINX_WEB_LOG_MAX_FILE=10 - -#NGINX_GEN_LOG_DRIVER=json-file -#NGINX_GEN_LOG_MAX_SIZE=2m -#NGINX_GEN_LOG_MAX_FILE=10 - -#NGINX_LETSENCRYPT_LOG_DRIVER=json-file -#NGINX_LETSENCRYPT_LOG_MAX_SIZE=2m -#NGINX_LETSENCRYPT_LOG_MAX_FILE=10 +2. Run the script 'fresh_start.sh' + +```bash +$ cd proxy/bin +$ ./fresh-start.sh ``` -3. Run our start script +This script will walk you through all config process. -```bash -./start.sh -``` +When it finishes you are good to go! :checkered_flag: + +> You can check all available options to run the script `$ ./fresh-start.sh --help` -Your proxy is ready to go! +3. Fire your new site with the following options: -## Starting your web containers +```yaml + VIRTUAL_HOST=your.domain.com + LETSENCRYPT_HOST=your.domain.com + LETSENCRYPT_EMAIL=your.email@your.domain.com + NETWORK=proxy +``` -After following the steps above you can start new web containers with port 80 open and add the option `-e VIRTUAL_HOST=your.domain.com` so proxy will automatically generate the reverse script in NGINX Proxy to forward new connections to your web/app container, as of: +The fresh start script asked you for the proxy network name if you changed set a name differente from +the default please update the option *'NETWORK'* in the examples below before running it. +- Simple site without Let's Encrypt certificate ```bash -docker run -d -e VIRTUAL_HOST=your.domain.com \ - --network=webproxy \ +$ docker run -d -e VIRTUAL_HOST=your.domain.com \ + --network=proxy \ --name my_app \ httpd:alpine ``` -To have SSL in your web/app you just add the option `-e LETSENCRYPT_HOST=your.domain.com`, as follow: +- To have SSL in your web/app you must add the option `-e LETSENCRYPT_HOST=your.domain.com`, as follow: ```bash -docker run -d -e VIRTUAL_HOST=your.domain.com \ +$ docker run -d -e VIRTUAL_HOST=your.domain.com \ -e LETSENCRYPT_HOST=your.domain.com \ -e LETSENCRYPT_EMAIL=your.email@your.domain.com \ - --network=webproxy \ + --network=proxy \ --name my_app \ httpd:alpine ``` -> You donΒ΄t need to open port *443* in your container, the certificate validation is managed by the web proxy. +> You donΒ΄t need to open port *443* in your container, the certificate validation is managed by the web proxy +> Please note that when running a new container to generate certificates with Let's Encrypt +> (`-e LETSENCRYPT_HOST=your.domain.com`), it may take a few minutes -> Please note that when running a new container to generate certificates with LetsEncrypt (`-e LETSENCRYPT_HOST=your.domain.com`), it may take a few minutes, depending on multiples circumstances. ## Further Options 1. Basic Authentication Support -In order to be able to secure your virtual host with basic authentication, you must create a htpasswd file within `${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}` via: +In order to be able to secure your virtual host with basic authentication, you must create a htpasswd file +within `${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}` via: ```bash -sudo sh -c "echo -n '[username]:' >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" -sudo sh -c "openssl passwd -apr1 >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" +$ sudo sh -c "echo -n '[username]:' >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" +$ sudo sh -c "openssl passwd -apr1 >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" ``` -> Please substitute the `${NGINX_FILES_PATH}` with your path information, replace `[username]` with your username and `${VIRTUAL_HOST}` with your host's domain. You will be prompted for a password. +> Please replace the `${NGINX_FILES_PATH}` with real path to information, replace `[username]` with your username and `${VIRTUAL_HOST}` with your host's domain. You will be prompted for a password. -2. Using multiple networks +2. Using different networks If you want to use more than one network to better organize your environment you could set the option `SERVICE_NETWORK` in our `.env.sample` or you can just create your own network and attach all your containers as of: @@ -247,7 +188,7 @@ docker stop test-web && docker rm test-web ## Running this Proxy on a Synology NAS -Please checkout this [howto](https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion/blob/master/docs/HOWTO-Synlogy.md). +Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/HOWTO-Synlogy.md). ## Production Environment using Web Proxy diff --git a/.gitignore b/.gitignore index 9b5908d6..6a749cb5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ data .env* !.env.sample .DS_Store +.idea/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..715c8063 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "basescript"] + path = basescript + url = git@github.com:evertramos/basescript.git diff --git a/LICENSE b/LICENSE index 54376ba9..5248c724 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Evert Ramos +Copyright (c) Evert Ramos Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/basescript b/basescript new file mode 160000 index 00000000..02a8c210 --- /dev/null +++ b/basescript @@ -0,0 +1 @@ +Subproject commit 02a8c2107bbb57fb86aa648f7d3dfd445c0ebfdb diff --git a/bin/.env b/bin/.env new file mode 100644 index 00000000..25e523a0 --- /dev/null +++ b/bin/.env @@ -0,0 +1,60 @@ +#----------------------------------------------------------------------- +# +# https://github.com/evertramos/nginx-proxy-automation +# +# NGINX Proxy automation +# +# This is the .env file with default values for the nginx-proxy-automation script +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# +# NGINX-Proxy default image, version and service name +# +DEFAULT_NGINX_PROXY_SERVICE_NAME=proxy-web +DEFAULT_NGINX_PROXY_IMAGE_NAME="nginx" +DEFAULT_NGINX_PROXY_IMAGE_VERSION="stable-alpine" + +#----------------------------------------------------------------------- +# +# Docker-gen default image, version and service name +# +DEFAULT_DOCKER_GEN_SERVICE_NAME=docker-gen +DEFAULT_LETSENCRYPT_IMAGE_NAME="jrcs/letsencrypt-nginx-proxy-companion" +DEFAULT_LETSENCRYPT_IMAGE_VERSION="2.0" + +#----------------------------------------------------------------------- +# +# Letsencrypt-nginx-proxy-companion default image, version and service name +# +DEFAULT_LETSENCRYPT_SERVICE_NAME=letsencrypt-companion +DEFAULT_DOCKER_GEN_IMAGE_NAME="jwilder/docker-gen" +DEFAULT_DOCKER_GEN_IMAGE_VERSION="0.7.3" + +#----------------------------------------------------------------------- +# +# Network default name for the nginx-proxy +# +DEFAULT_DOCKER_NETWORK_NAME=proxy + +#----------------------------------------------------------------------- +# +# Data path for the nginx-proxy files +# +#DEFAULT_DATA_LOCATION="./data" + +#----------------------------------------------------------------------- +# +# Default servies name in docker-compose.yml +# +REPLACE_NGINX_PROXY_SERVICE_NAME="nginx-proxy-automation-web" +REPLACE_DOCKER_GEN_SERVICE_NAME="nginx-proxy-automation-gen" +REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" + +#----------------------------------------------------------------------- +# +# md5 checksum for .env and docker-compose.yml files +# +MD5_SUM_DOCKER_COMPOSE=5a9db4ac1b6fb25d683b8ed9929a7c42 +MD5_SUM_ENV_SAMPLE=2d6a35dc9d0ac8d31a3aa62b17e6e497 diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh new file mode 100755 index 00000000..e2e17e24 --- /dev/null +++ b/bin/fresh-start.sh @@ -0,0 +1,1262 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# +# Fresh Start script - set up nginx-proxy in a fresh installed server +# +# https://github.com/evertramos/docker-nginx-proxy-automation +# +# Script developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- + +# Bash settings (do not mess with it) +shopt -s nullglob globstar + +# Get the script name and its file real path +SCRIPT_PATH="$(dirname "$(readlink -f "$0")")" +SCRIPT_NAME="${0##*/}" + +# Source basescript functions +source $SCRIPT_PATH"/../basescript/bootstrap.sh" + +# Source localscripts +source $SCRIPT_PATH"/localscript/bootstrap.sh" + +#----------------------------------------------------------------------- +# Process arguments +#----------------------------------------------------------------------- +while [[ $# -gt 0 ]]; do + case "$1" in + -d) + ARG_DATA_LOCATION="${2}" + if [[ $ARG_DATA_LOCATION == "" ]]; then + echoerr "Invalid option for -d" + break + fi + shift 2 + ;; + --data-files-location=*) + ARG_DATA_LOCATION="${1#*=}" + if [[ $ARG_DATA_LOCATION == "" ]]; then + echoerr "Invalid option for --data-files-location=''" + break + fi + shift 1 + ;; + -e) + ARG_DEFAULT_EMAIL="${2}" + if [[ $ARG_DEFAULT_EMAIL == "" ]]; then + echoerr "Invalid option for -e" + break + fi + shift 2 + ;; + --default-email=*) + ARG_DEFAULT_EMAIL="${1#*=}" + if [[ $ARG_DEFAULT_EMAIL == "" ]]; then + echoerr "Invalid option for --default-email=''" + break + fi + shift 1 + ;; + -pn) + ARG_NGINX_PROXY_SERVICE_NAME="${2}" + if [[ $ARG_NGINX_PROXY_SERVICE_NAME == "" ]]; then + echoerr "Invalid option for -pn" + break + fi + shift 2 + ;; + --proxy-name=*) + ARG_NGINX_PROXY_SERVICE_NAME="${1#*=}" + if [[ $ARG_NGINX_PROXY_SERVICE_NAME == "" ]]; then + echoerr "Invalid option for --proxy-name=''" + break + fi + shift 1 + ;; + -ln) + ARG_LETSENCRYPT_SERVICE_NAME="${2}" + if [[ $ARG_LETSENCRYPT_SERVICE_NAME == "" ]]; then + echoerr "Invalid option for -ln" + break + fi + shift 2 + ;; + --letsencrypt-name=*) + ARG_LETSENCRYPT_SERVICE_NAME="${1#*=}" + if [[ $ARG_LETSENCRYPT_SERVICE_NAME == "" ]]; then + echoerr "Invalid option for --letsencrypt-name=''" + break + fi + shift 1 + ;; + -gn) + ARG_DOCKER_GEN_SERVICE_NAME="${2}" + if [[ $ARG_DOCKER_GEN_SERVICE_NAME == "" ]]; then + echoerr "Invalid option for -gn" + break + fi + shift 2 + ;; + --docker-gen-name=*) + ARG_DOCKER_GEN_SERVICE_NAME="${1#*=}" + if [[ $ARG_DOCKER_GEN_SERVICE_NAME == "" ]]; then + echoerr "Invalid option for --docker-gen-name=''" + break + fi + shift 1 + ;; + -piv) + ARG_NGINX_PROXY_IMAGE_VERSION="${2}" + if [[ $ARG_NGINX_PROXY_IMAGE_VERSION == "" ]]; then + echoerr "Invalid option for -pversion" + break + fi + shift 2 + ;; + --proxy-image-version=*) + ARG_NGINX_PROXY_IMAGE_VERSION="${1#*=}" + if [[ $ARG_NGINX_PROXY_IMAGE_VERSION == "" ]]; then + echoerr "Invalid option for --proxy-image-version=''" + break + fi + shift 1 + ;; + -liv) + ARG_LETSENCRYPT_IMAGE_VERSION="${2}" + if [[ $ARG_LETSENCRYPT_IMAGE_VERSION == "" ]]; then + echoerr "Invalid option for -liv" + break + fi + shift 2 + ;; + --letsencrypt-image-version=*) + ARG_LETSENCRYPT_IMAGE_VERSION="${1#*=}" + if [[ $ARG_LETSENCRYPT_IMAGE_VERSION == "" ]]; then + echoerr "Invalid option for --letsencrypt-image-version=''" + break + fi + shift 1 + ;; + -giv) + ARG_DOCKER_GEN_IMAGE_VERSION="${2}" + if [[ $ARG_DOCKER_GEN_IMAGE_VERSION == "" ]]; then + echoerr "Invalid option for -giv" + break + fi + shift 2 + ;; + --docker-gen-image-version=*) + ARG_DOCKER_GEN_IMAGE_VERSION="${1#*=}" + if [[ $ARG_DOCKER_GEN_IMAGE_VERSION == "" ]]; then + echoerr "Invalid option for --docker-gen-image-version=''" + break + fi + shift 1 + ;; + + # Network options + -ip) + ARG_IP_ADDRESS="${2}" + if [[ ARG_IP_ADDRESS == "" ]]; then + echoerr "Invalid option for -ip" + break + fi + shift 2 + ;; + --ip-address=*) + ARG_IP_ADDRESS="${1#*=}" + if [[ ARG_IP_ADDRESS == "" ]]; then + echoerr "Invalid option for --ip-address" + break + fi + shift 1 + ;; + -ipv6) + ARG_IPv6_ADDRESS="${2}" + if [[ ARG_IPv6_ADDRESS == "" ]]; then + echoerr "Invalid option for -ipv6" + break + fi + shift 2 + ;; + --ipv6-address=*) + ARG_IPv6_ADDRESS="${1#*=}" + if [[ ARG_IPv6_ADDRESS == "" ]]; then + echoerr "Invalid option for --ipv6-address" + break + fi + shift 1 + ;; + -net) + ARG_NETWORK_NAME="${2}" + if [[ ARG_NETWORK_NAME == "" ]]; then + echoerr "Invalid option for -net" + break + fi + shift 2 + ;; + --network-name=*) + ARG_NETWORK_NAME="${1#*=}" + if [[ ARG_NETWORK_NAME == "" ]]; then + echoerr "Invalid option for --network-name" + break + fi + shift 1 + ;; + -netopt) + NETWORK_OPTION="${2}" + if [[ NETWORK_OPTION == "" ]]; then + echoerr "Invalid option for -netopt" + break + fi + shift 2 + ;; + --network-option=*) + NETWORK_OPTION="${1#*=}" + if [[ NETWORK_OPTION == "" ]]; then + echoerr "Invalid option for --network-option" + break + fi + shift 1 + ;; + + # Log settings + -lpd) + ARG_NGINX_PROXY_LOG_DRIVER="${2}" + if [[ ARG_NGINX_PROXY_LOG_DRIVER == "" ]]; then + echoerr "Invalid option for -lpd" + break + fi + shift 2 + ;; + --log-nginx-proxy-driver=*) + ARG_NGINX_PROXY_LOG_DRIVER="${1#*=}" + if [[ ARG_NGINX_PROXY_LOG_DRIVER == "" ]]; then + echoerr "Invalid option for --log-nginx-proxy-driver" + break + fi + shift 1 + ;; + -lpms) + ARG_NGINX_PROXY_LOG_MAX_SIZE="${2}" + if [[ ARG_NGINX_PROXY_LOG_MAX_SIZE == "" ]]; then + echoerr "Invalid option for -lpms" + break + fi + shift 2 + ;; + --log-nginx-proxy-max_size=*) + ARG_NGINX_PROXY_LOG_MAX_SIZE="${1#*=}" + if [[ ARG_NGINX_PROXY_LOG_MAX_SIZE == "" ]]; then + echoerr "Invalid option for --log-nginx-proxy-max_size" + break + fi + shift 1 + ;; + -lpmf) + ARG_NGINX_PROXY_LOG_MAX_FILE="${2}" + if [[ ARG_NGINX_PROXY_LOG_MAX_FILE == "" ]]; then + echoerr "Invalid option for -lpmf" + break + fi + shift 2 + ;; + --log-nginx-proxy-max_file=*) + ARG_NGINX_PROXY_LOG_MAX_FILE="${1#*=}" + if [[ ARG_NGINX_PROXY_LOG_MAX_FILE == "" ]]; then + echoerr "Invalid option for --log-nginx-proxy-max_file" + break + fi + shift 1 + ;; + -lgd) + ARG_DOCKER_GEN_LOG_DRIVER="${2}" + if [[ ARG_DOCKER_GEN_LOG_DRIVER == "" ]]; then + echoerr "Invalid option for -lgd" + break + fi + shift 2 + ;; + --log-docker-gen-driver=*) + ARG_DOCKER_GEN_LOG_DRIVER="${1#*=}" + if [[ ARG_DOCKER_GEN_LOG_DRIVER == "" ]]; then + echoerr "Invalid option for --log-docker-gen-driver" + break + fi + shift 1 + ;; + -lgms) + ARG_DOCKER_GEN_LOG_MAX_SIZE="${2}" + if [[ ARG_DOCKER_GEN_LOG_MAX_SIZE == "" ]]; then + echoerr "Invalid option for -lgms" + break + fi + shift 2 + ;; + --log-docker-gen-max_size=*) + ARG_DOCKER_GEN_LOG_MAX_SIZE="${1#*=}" + if [[ ARG_DOCKER_GEN_LOG_MAX_SIZE == "" ]]; then + echoerr "Invalid option for --log-docker-gen-max_size" + break + fi + shift 1 + ;; + -lgmf) + ARG_DOCKER_GEN_LOG_MAX_FILE="${2}" + if [[ ARG_DOCKER_GEN_LOG_MAX_FILE == "" ]]; then + echoerr "Invalid option for -lgmf" + break + fi + shift 2 + ;; + --log-docker-gen-max_file=*) + ARG_DOCKER_GEN_LOG_MAX_FILE="${1#*=}" + if [[ ARG_DOCKER_GEN_LOG_MAX_FILE == "" ]]; then + echoerr "Invalid option for --log-docker-gen-max_file" + break + fi + shift 1 + ;; + -lld) + ARG_LETSENCRYPT_LOG_DRIVER="${2}" + if [[ ARG_LETSENCRYPT_LOG_DRIVER == "" ]]; then + echoerr "Invalid option for -lld" + break + fi + shift 2 + ;; + --log-letsencrypt-driver=*) + ARG_LETSENCRYPT_LOG_DRIVER="${1#*=}" + if [[ ARG_LETSENCRYPT_LOG_DRIVER == "" ]]; then + echoerr "Invalid option for --log-letsencrypt-driver" + break + fi + shift 1 + ;; + -llms) + ARG_LETSENCRYPT_LOG_MAX_SIZE="${2}" + if [[ ARG_LETSENCRYPT_LOG_MAX_SIZE == "" ]]; then + echoerr "Invalid option for -llms" + break + fi + shift 2 + ;; + --log-letsencrypt-max_size=*) + ARG_LETSENCRYPT_LOG_MAX_SIZE="${1#*=}" + if [[ ARG_LETSENCRYPT_LOG_MAX_SIZE == "" ]]; then + echoerr "Invalid option for --log-letsencrypt-max_size" + break + fi + shift 1 + ;; + -llmf) + ARG_LETSENCRYPT_LOG_MAX_FILE="${2}" + if [[ ARG_LETSENCRYPT_LOG_MAX_FILE == "" ]]; then + echoerr "Invalid option for -llmf" + break + fi + shift 2 + ;; + --log-letsencrypt-max_file=*) + ARG_LETSENCRYPT_LOG_MAX_FILE="${1#*=}" + if [[ ARG_LETSENCRYPT_LOG_MAX_FILE == "" ]]; then + echoerr "Invalid option for --log-letsencrypt-max_file" + break + fi + shift 1 + ;; + + # Port binginds + -phttp) + ARG_DOCKER_HTTP="${2}" + if [[ ARG_DOCKER_HTTP == "" ]]; then + echoerr "Invalid option for -phttp" + break + fi + shift 2 + ;; + --port-http=*) + ARG_DOCKER_HTTP="${1#*=}" + if [[ ARG_DOCKER_HTTP == "" ]]; then + echoerr "Invalid option for --port-http" + break + fi + shift 1 + ;; + -phttps) + ARG_DOCKER_HTTPS="${2}" + if [[ ARG_DOCKER_HTTPS == "" ]]; then + echoerr "Invalid option for -phttps" + break + fi + shift 2 + ;; + --port-https=*) + ARG_DOCKER_HTTPS="${1#*=}" + if [[ ARG_DOCKER_HTTPS == "" ]]; then + echoerr "Invalid option for --port-https" + break + fi + shift 1 + ;; + + # SSL Policy + -sp) + ARG_SSL_POLICY="${2}" + if [[ ARG_SSL_POLICY == "" ]]; then + echoerr "Invalid option for -sp" + break + fi + shift 2 + ;; + --ssl-policy=*) + ARG_SSL_POLICY="${1#*=}" + if [[ ARG_SSL_POLICY == "" ]]; then + echoerr "Invalid option for --ssl-policy" + break + fi + shift 1 + ;; + + # IPv6 options + --ipv6-subnet=*) + ARG_IPv6_SUBNET="${1#*=}" + if [[ ARG_IPv6_SUBNET == "" ]]; then + echoerr "Invalid option for --ipv6-subnet" + break + fi + shift 1 + ;; + --activate-ipv6) + ACTIVATE_IPV6=true + shift 1 + ;; + + --update-nginx-template) + UPDATE_NGINX_TEMPLATE=true + shift 1 + ;; + --skip-docker-image-check) + SKIP_DOCKER_IMAGE_CHECK=true + shift 1 + ;; + --use-nginx-conf-files) + USE_NGINX_CONF_FILES=true + shift 1 + ;; + --yes) + REPLY_YES=true + shift 1 + ;; + --debug) + DEBUG=true + shift 1 + ;; + --silent) + SILENT=true + shift 1 + ;; + -h | --help) + usage + exit 0 + ;; + *) + echoerr "Unknown argument: $1" false + usage + exit 0 + ;; + esac +done + +#----------------------------------------------------------------------- +# Initial check - DO NOT CHANGE SETTINGS BELOW +#----------------------------------------------------------------------- + +# Check if there is an .env file in local folder +run_function check_local_env_file + +# Specific PID File if needs to run multiple scripts +NEW_PID_FILE=${PID_FILE_FRESH_INSTALL:-".fresh_start"} + +# Run initial check function +run_function starts_initial_check $NEW_PID_FILE true + +# Save PID +system_save_pid $NEW_PID_FILE + +# DO NOT CHANGE ANY OPTIONS ABOVE THIS LINE! + +#----------------------------------------------------------------------- +# [function] Undo script actions +#----------------------------------------------------------------------- +local_undo_restore() { + local LOCAL_KEEP_RESTORE_FILES + + LOCAL_KEEP_RESTORE_FILES=${1:-$KEEP_RESTORE_FILES} + + echoerr \ + "It seems something went wrong running '${FUNCNAME[0]}' \ + \nwe will try to UNDO all actions done by this script. \ + \nPlease make sure everything was put it back in place." false + + # If docker network was created + if [[ "$ACTION_DOCKER_NETWORK_CREATED" == true ]]; then + [[ "$SILENT" != true ]] && echowarning "[undo] Deleting created docker network '$DOCKER_NETWORK_NAME'." + run_function docker_network_remove $DOCKER_NETWORK_NAME + ACTION_DOCKER_NETWORK_CREATED=false + fi + + # If docker-compose file was renamed (backup) + if [[ "$ACTION_DOCKER_COMPOSE_FILE_RENAMED" == true ]]; then + [[ "$SILENT" != true ]] && echowarning "[undo] Renaming docker-compose.yml file '$LOCAL_BACKUP_DOCKER_COMPOSE_FILE'." + mv $LOCAL_BACKUP_DOCKER_COMPOSE_FILE "$SCRIPT_PATH/../docker-compose.yml" + ACTION_DOCKER_COMPOSE_FILE_RENAMED=false + fi + + # If .env file was renamed (backup) + if [[ "$ACTION_ENV_FILE_RENAMED" == true ]]; then + [[ "$SILENT" != true ]] && echowarning "[undo] Renaming .env file '$LOCAL_BACKUP_ENV_FILE'." + mv $LOCAL_BACKUP_ENV_FILE "$SCRIPT_PATH/../.env" + ACTION_ENV_FILE_RENAMED=false + fi + + # If docker-compose file was renamed (backup) + if [[ "$ACTION_DOCKER_COMPOSE_FILE_RENAMED" == true ]]; then + [[ "$SILENT" != true ]] && echowarning "[undo] Renaming docker-compose file '$LOCAL_BACKUP_DOCKER_COMPOSE_FILE'." + mv $LOCAL_BACKUP_DOCKER_COMPOSE_FILE "$SCRIPT_PATH/../docker-compose.yml" + ACTION_DOCKER_COMPOSE_FILE_RENAMED=false + fi + + # If the service was stopped try to restart it + if [[ "$ACTION_DOCKER_COMPOSE_STOPPED" == true ]]; then + [[ "$SILENT" != true ]] && echowarning "[undo] Stopping docker-compose service '$SCRIPT_PATH/../'." + run_function docker_compose_start "$SCRIPT_PATH/../" + ACTION_DOCKER_COMPOSE_STOPPED=false + fi + + # If site folder was created + # if [[ "$ACTION_SITE_PATH_CREATED" == true ]]; then + # [[ "$SILENT" != true ]] && echowarning "[undo] Creating site folder '$LOCAL_SITE_FULL_PATH'." + # # Remove folder + # run_function system_safe_delete_folder $LOCAL_SITE _FULL_PATH true + # ACTION_SITE_PATH_CREATED=false + # fi + + # If site domain was created + # if [[ "$ACTION_SITE_URL_CREATED" == true ]]; then + # [[ "$SILENT" != true ]] && echowarning "[undo] Creating site domain '$LOCAL_NEW_URL'." + # run_function domain_delete_domain_dns $LOCAL_NEW_URL + # ACTION_SITE_URL_CREATED=false + # if [[ "$WITH_WWW" == true ]]; then + # run_function domain_delete_domain_dns "www.$LOCAL_NEW_URL" + # fi + # fi + # + exit 0 +} + +#----------------------------------------------------------------------- +# [function] Docker images and version check +#----------------------------------------------------------------------- +local_check_docker_hub_image_version() { + local LOCAL_DOCKER_IMAGE_NAME LOCAL_DOCKER_IMAGE_VERSION + + LOCAL_DOCKER_IMAGE_NAME=${1:-null} + LOCAL_DOCKER_IMAGE_VERSION=${2:-null} + + # Check image exists + run_function dockerhub_check_image_exists $LOCAL_DOCKER_IMAGE_NAME + + if [[ "$DOCKERHUB_IMAGE_EXISTS" != true ]]; then + echoerr "It seems the image '$LOCAL_DOCKER_IMAGE_NAME' does not exist in docker hub (https://hub.docker.com) or the site is down. Wait a few minutes and try again." false + local_undo_restore + fi + + # Check if image and version exists in docker hub + run_function dockerhub_check_image_exists $LOCAL_DOCKER_IMAGE_NAME $LOCAL_DOCKER_IMAGE_VERSION + + if [[ "$DOCKERHUB_IMAGE_EXISTS" != true ]]; then + echoerr "It seems the image '$LOCAL_DOCKER_IMAGE_NAME:$LOCAL_DOCKER_IMAGE_VERSION' does not exist in docker hub (https://hub.docker.com) or the site is down. Wait a few minutes and try again." false + local_undo_restore + fi +} + +#----------------------------------------------------------------------- +# Check if the docker-compose is already running +#----------------------------------------------------------------------- +LOCAL_DOCKER_COMPOSE_FILE_FULL_PATH="$SCRIPT_PATH/../ " +run_function docker_compose_check_service_exists $LOCAL_DOCKER_COMPOSE_FILE_FULL_PATH + +if [[ "$DOCKER_COMPOSE_SERVICE_EXISTS" == true ]]; then + [[ "$SILENT" != true ]] && echowarning \ + "The services in the docker compose file below is already running: \ + \n'$LOCAL_DOCKER_COMPOSE_FILE_FULL_PATH' \ + \nIf you continue, the services will be stopped and all settings replaced \ + \nif you are uncertain, check your current files settings before continue." + + if [[ "$REPLY_YES" == true ]]; then + LOCAL_STOP_CURRENT_NGINX_PROXY_SERVICES=true + LOCAL_BACKUP_OLD_DOCKER_COMPOSE_FILE=true + else + run_function confirm_user_action "Your services for this project are already running, \ + \nare you sure you want to continue?" + + [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_CURRENT_NGINX_PROXY_SERVICES=true && LOCAL_BACKUP_OLD_DOCKER_COMPOSE_FILE=true + fi +fi + +#----------------------------------------------------------------------- +# Check if the .env file was already configured +#----------------------------------------------------------------------- +run_function check_docker_nginx_proxy_automation_env_file_exits + +# Result from function above +if [[ "$DOCKER_NGINX_PROXY_AUTOMATION_ENV_FILE_EXISTS" == true ]]; then + [[ "$SILENT" != true ]] && echowarning \ + "There is an '.env' file already set to your project, if you continue \ + \nall settings will be replaced, there is no turn back on that, ok?." + + if [[ "$REPLY_YES" == true ]]; then + LOCAL_BACKUP_OLD_ENV_FILE=true + LOCAL_BACKUP_OLD_DOCKER_COMPOSE_FILE=true + else + run_function confirm_user_action "There is an .env file at your proxy folder, \ + \nall settings at will be replaced with new values, \ + \nare you sure you want to continue?" + [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_BACKUP_OLD_ENV_FILE=true && LOCAL_BACKUP_OLD_DOCKER_COMPOSE_FILE=true + fi +fi + +#----------------------------------------------------------------------- +# Arguments validation and variables fulfillment +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# NGINX-proxy service/container name +# +# Parameters: -pn | --proxy-name +# +# Final result: +# - NGINX_PROXY_SERVICE_NAME +# +# Further action: +# - LOCAL_STOP_AND_REMOVE_NGINX_PROXY_SERVICE_CONTAINER +#----------------------------------------------------------------------- +LOCAL_DEFAULT_NGINX_PROXY_SERVICE_NAME="proxy-web-auto" +if [[ $ARG_NGINX_PROXY_SERVICE_NAME == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + + # Get user's response + run_function common_read_user_input "Please enter the nginx-proxy service name (default: $LOCAL_DEFAULT_NGINX_PROXY_SERVICE_NAME):" + + LOCAL_NGINX_PROXY_SERVICE_NAME=${USER_INPUT_RESPONSE:-$LOCAL_DEFAULT_NGINX_PROXY_SERVICE_NAME} +else + LOCAL_NGINX_PROXY_SERVICE_NAME=${ARG_NGINX_PROXY_SERVICE_NAME:-$LOCAL_DEFAULT_NGINX_PROXY_SERVICE_NAME} +fi + +# Validate the name +run_function string_remove_all_special_char_string $LOCAL_NGINX_PROXY_SERVICE_NAME +NGINX_PROXY_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} +[[ $NGINX_PROXY_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" + +# Check exists a container with this name +run_function docker_check_container_exists $NGINX_PROXY_SERVICE_NAME + +if [[ "$DOCKER_CONTAINER_EXISTS" == true ]]; then + # Check if there is a container running with this name + run_function docker_check_container_is_running $NGINX_PROXY_SERVICE_NAME + + if [[ "$DOCKER_CONTAINER_IS_RUNNING" == true ]]; then + [[ "$SILENT" != true ]] && echowarning \ + "The container '$NGINX_PROXY_SERVICE_NAME' is running in this server \ + \nmake sure you have unique names for each container. This script \ + \nmight stop and remove the container if you set '--yes' or reply \ + \n'yes' on the line below, but, there is no turn back on this action!" + + if [[ "$REPLY_YES" == true ]]; then + LOCAL_STOP_AND_REMOVE_NGINX_PROXY_SERVICE_CONTAINER=true + else + run_function confirm_user_action \ + "The container '$NGINX_PROXY_SERVICE_NAME' is running in this server. We will \ + \nstop and REMOVE it, do you want to continue?" + + [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_NGINX_PROXY_SERVICE_CONTAINER=true + fi + else + [[ "$SILENT" != true ]] && echowarning \ + "The container '$NGINX_PROXY_SERVICE_NAME' is exist in this server, but it is not running \ + \nmake sure you have unique names for each container. This script \ + \nmight stop and remove the container if you set '--yes' or reply \ + \n'yes' on the line below, but, there is no turn back on this action!" + + if [[ "$REPLY_YES" == true ]]; then + LOCAL_STOP_AND_REMOVE_NGINX_PROXY_SERVICE_CONTAINER=true + else + run_function confirm_user_action \ + "The container '$NGINX_PROXY_SERVICE_NAME' exist in this server. We will \ + \nREMOVE it, do you want to continue?" + + [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_NGINX_PROXY_SERVICE_CONTAINER=true + fi + # We kept STOP and REMOVE because the stop function will no break the script even if the container isn't running + fi +fi + +#----------------------------------------------------------------------- +# Let's Encrypt service/container name +# +# Parameters: -ln | --letsencrypt-name +# +# Final result: +# - LETSENCRYPT_SERVICE_NAME +# +# Further action: +# - LOCAL_STOP_AND_REMOVE_LETSENCRYPT_SERVICE_CONTAINER +#----------------------------------------------------------------------- +LOCAL_DEFAULT_LETSENCRYPT_SERVICE_NAME="letsencrypt-auto" +if [[ $ARG_LETSENCRYPT_SERVICE_NAME == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + + # Get user's response + run_function common_read_user_input "Please enter the nginx-proxy service name (default: $LOCAL_DEFAULT_LETSENCRYPT_SERVICE_NAME):" + + LOCAL_LETSENCRYPT_SERVICE_NAME=${USER_INPUT_RESPONSE:-$LOCAL_DEFAULT_LETSENCRYPT_SERVICE_NAME} +else + LOCAL_LETSENCRYPT_SERVICE_NAME=${ARG_LETSENCRYPT_SERVICE_NAME:-$LOCAL_DEFAULT_LETSENCRYPT_SERVICE_NAME} +fi + +# Validate the name +run_function string_remove_all_special_char_string $LOCAL_LETSENCRYPT_SERVICE_NAME +LETSENCRYPT_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} +[[ $LETSENCRYPT_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" + +# Check exists a container with this name +run_function docker_check_container_exists $LETSENCRYPT_SERVICE_NAME + +if [[ "$DOCKER_CONTAINER_EXISTS" == true ]]; then + # Check if there is a container running with this name + run_function docker_check_container_is_running $LETSENCRYPT_SERVICE_NAME + + if [[ "$DOCKER_CONTAINER_IS_RUNNING" == true ]]; then + [[ "$SILENT" != true ]] && echowarning \ + "The container '$LETSENCRYPT_SERVICE_NAME' is running in this server \ + \nmake sure you have unique names for each container. This script \ + \nmight stop and remove the container if you set '--yes' or reply \ + \n'yes' on the line below, but, there is no turn back on this action!" + + if [[ "$REPLY_YES" == true ]]; then + LOCAL_STOP_AND_REMOVE_LETSENCRYPT_SERVICE_CONTAINER=true + else + run_function confirm_user_action \ + "The container '$LETSENCRYPT_SERVICE_NAME' is running in this server. We will \ + \nstop and REMOVE it, do you want to continue?" + + [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_LETSENCRYPT_SERVICE_CONTAINER=true + fi + else + [[ "$SILENT" != true ]] && echowarning \ + "The container '$LETSENCRYPT_SERVICE_NAME' is exist in this server, but it is not running \ + \nmake sure you have unique names for each container. This script \ + \nmight stop and remove the container if you set '--yes' or reply \ + \n'yes' on the line below, but, there is no turn back on this action!" + + if [[ "$REPLY_YES" == true ]]; then + LOCAL_STOP_AND_REMOVE_LETSENCRYPT_SERVICE_CONTAINER=true + else + run_function confirm_user_action \ + "The container '$LETSENCRYPT_SERVICE_NAME' exist in this server. We will \ + \nREMOVE it, do you want to continue?" + + [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_LETSENCRYPT_SERVICE_CONTAINER=true + fi + # We kept STOP and REMOVE because the stop function will no break the script even if the container isn't running + fi +fi + +#----------------------------------------------------------------------- +# Docker-gen service/container name +# +# Parameters: -gn | --docker-gen-name +# +# Final result: +# - DOCKER_GEN_SERVICE_NAME +# +# Further action: +# - LOCAL_STOP_AND_REMOVE_DOCKER_GEN_SERVICE_CONTAINER +#----------------------------------------------------------------------- +LOCAL_DEFAULT_DOCKER_GEN_SERVICE_NAME="docker-gen-auto" +if [[ $ARG_DOCKER_GEN_SERVICE_NAME == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + + # Get user's response + run_function common_read_user_input "Please enter the nginx-proxy service name (default: $LOCAL_DEFAULT_DOCKER_GEN_SERVICE_NAME):" + + LOCAL_DOCKER_GEN_SERVICE_NAME=${USER_INPUT_RESPONSE:-$LOCAL_DEFAULT_DOCKER_GEN_SERVICE_NAME} +else + LOCAL_DOCKER_GEN_SERVICE_NAME=${ARG_DOCKER_GEN_SERVICE_NAME:-$LOCAL_DEFAULT_DOCKER_GEN_SERVICE_NAME} +fi + +# Validate the name +run_function string_remove_all_special_char_string $LOCAL_DOCKER_GEN_SERVICE_NAME +DOCKER_GEN_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} +[[ $DOCKER_GEN_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" + +# Check exists a container with this name +run_function docker_check_container_exists $DOCKER_GEN_SERVICE_NAME + +if [[ "$DOCKER_CONTAINER_EXISTS" == true ]]; then + # Check if there is a container running with this name + run_function docker_check_container_is_running $DOCKER_GEN_SERVICE_NAME + + if [[ "$DOCKER_CONTAINER_IS_RUNNING" == true ]]; then + [[ "$SILENT" != true ]] && echowarning \ + "The container '$DOCKER_GEN_SERVICE_NAME' is running in this server \ + \nmake sure you have unique names for each container. This script \ + \nmight stop and remove the container if you set '--yes' or reply \ + \n'yes' on the line below, but, there is no turn back on this action!" + + if [[ "$REPLY_YES" == true ]]; then + LOCAL_STOP_AND_REMOVE_DOCKER_GEN_SERVICE_CONTAINER=true + else + run_function confirm_user_action \ + "The container '$DOCKER_GEN_SERVICE_NAME' is running in this server. We will \ + \nstop and REMOVE it, do you want to continue?" + + [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_DOCKER_GEN_SERVICE_CONTAINER=true + fi + else + [[ "$SILENT" != true ]] && echowarning \ + "The container '$DOCKER_GEN_SERVICE_NAME' is exist in this server, but it is not running \ + \nmake sure you have unique names for each container. This script \ + \nmight stop and remove the container if you set '--yes' or reply \ + \n'yes' on the line below, but, there is no turn back on this action!" + + if [[ "$REPLY_YES" == true ]]; then + LOCAL_STOP_AND_REMOVE_DOCKER_GEN_SERVICE_CONTAINER=true + else + run_function confirm_user_action \ + "The container '$DOCKER_GEN_SERVICE_NAME' exist in this server. We will \ + \nREMOVE it, do you want to continue?" + + [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_DOCKER_GEN_SERVICE_CONTAINER=true + fi + # We kept STOP and REMOVE because the stop function will no break the script even if the container isn't running + fi +fi + +#----------------------------------------------------------------------- +# nginx-proxy image version +# +# Parameters: -piv | --proxy-image-version +# +# Final result: +# - NGINX_PROXY_IMAGE_VERSION +#----------------------------------------------------------------------- +LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME=${DEFAULT_NGINX_PROXY_IMAGE_NAME:-nginx} +LOCAL_DEFAULT_NGINX_PROXY_IMAGE_VERSION=${DEFAULT_NGINX_PROXY_IMAGE_VERSION:-latest} +# We have commented the lines below once the proxy will use a regular nginx container and it's not optional today +#if [[ $ARG_NGINX_PROXY_IMAGE_VERSION == "" ]] && [[ ! "$REPLY_YES" == true ]]; then +# # Get user's response +# run_function dockerhub_list_tags $LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME +# run_function select_one_option "${DOCKERHUB_LIST_TAGS[*]}" "Please select a tag for the image '$LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME' (the list below comes from https://hub.docker.com):" +# +# [[ $SELECT_ONE_OPTION_NAME == "" ]] && echowarning "Once you did not select any option, '$LOCAL_DEFAULT_NGINX_PROXY_IMAGE_VERSION' will be used." +# NGINX_PROXY_IMAGE_VERSION=${SELECT_ONE_OPTION_NAME:-$LOCAL_DEFAULT_NGINX_PROXY_IMAGE_VERSION} +#else +NGINX_PROXY_IMAGE_VERSION=${ARG_NGINX_PROXY_IMAGE_VERSION:-$LOCAL_DEFAULT_NGINX_PROXY_IMAGE_VERSION} +#fi +# +#if [[ "$NGINX_PROXY_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME" == null ]]; then +# echoerr "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" +#fi + +# Final check image a version with dockerhub +[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME $NGINX_PROXY_IMAGE_VERSION + +#----------------------------------------------------------------------- +# Let's Encrypt image version +# +# Parameters: -liv | --letsencrypt-image-version +# +# Final result: +# - LETSENCRYPT_IMAGE_VERSION +#----------------------------------------------------------------------- +LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME=${DEFAULT_LETSENCRYPT_IMAGE_NAME:-null} +LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION=${DEFAULT_LETSENCRYPT_IMAGE_VERSION:-null} +if [[ $ARG_LETSENCRYPT_IMAGE_VERSION == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + # Get user's response + run_function dockerhub_list_tags $LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME + run_function select_one_option "${DOCKERHUB_LIST_TAGS[*]}" "Please select a tag for the image '$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME' (the list below comes from https://hub.docker.com):" + + [[ $SELECT_ONE_OPTION_NAME == "" ]] && echowarning "Once you did not select any option, '$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION' will be used." + LETSENCRYPT_IMAGE_VERSION=${SELECT_ONE_OPTION_NAME:-$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION} +else + LETSENCRYPT_IMAGE_VERSION=${ARG_LETSENCRYPT_IMAGE_VERSION:-$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION} +fi + +if [[ "$LETSENCRYPT_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION" == null ]]; then + echoerr "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" +fi + +# Final check image a version with dockerhub +[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME $LETSENCRYPT_IMAGE_VERSION + +#----------------------------------------------------------------------- +# docker-gen image version +# +# Parameters: -giv | --docker-gen-image-versio +# +# Final result: +# - DOCKER_GEN_IMAGE_VERSION +#----------------------------------------------------------------------- +LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME=${DEFAULT_DOCKER_GEN_IMAGE_NAME:-null} +LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION=${DEFAULT_DOCKER_GEN_IMAGE_VERSION:-null} +if [[ $ARG_DOCKER_GEN_IMAGE_VERSION == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + # Get user's response + run_function dockerhub_list_tags $LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME false + run_function select_one_option "${DOCKERHUB_LIST_TAGS[*]}" "Please select a tag for the image '$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME' (the list below comes from https://hub.docker.com):" + + [[ $SELECT_ONE_OPTION_NAME == "" ]] && echowarning "Once you did not select any option, '$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION' will be used." + DOCKER_GEN_IMAGE_VERSION=${SELECT_ONE_OPTION_NAME:-$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION} +else + DOCKER_GEN_IMAGE_VERSION=${ARG_DOCKER_GEN_IMAGE_VERSION:-$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION} +fi + +if [[ "$DOCKER_GEN_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION" == null ]]; then + echoerr "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" +fi + +# Final check image a version with dockerhub +[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME $DOCKER_GEN_IMAGE_VERSION + +#----------------------------------------------------------------------- +# IP address (IPv4) +# +# Parameters: -ip | --ip-address +# +# Final result: +# - IP_ADDRESS +#----------------------------------------------------------------------- +if [[ $ARG_IP_ADDRESS == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + + run_function ip_get_external_ipv4 + + # Get user's response + run_function common_read_user_input \ + "Please enter the IP address (ipv4) that your server uses to connect to the internet. \ + \nYou might try the following '$IP_EXTERNAL_IPV4' (default: 0.0.0.0):" + + LOCAL_IP_ADDRESS=${USER_INPUT_RESPONSE:-"0.0.0.0"} +else + LOCAL_IP_ADDRESS=${ARG_IP_ADDRESS:-"0.0.0.0"} +fi + +# Check the IP address +run_function ip_check_ipv4 $LOCAL_IP_ADDRESS + +if [[ ! "$IP_IPV4" == true ]]; then + echoerr "The IP address '$LOCAL_IP_ADDRESS' seems to be in wrong format. Please try again or keep the default value." + local_undo_restore +else + IP_ADDRESS=${LOCAL_IP_ADDRESS:-"::1"} +fi + +#----------------------------------------------------------------------- +# IP address (IPv6) +# +# Parameters: -ipv6 | --ipv6-address +# +# Final result: +# - IPv6_ADDRESS +#----------------------------------------------------------------------- +if [[ "$ACTIVATE_IPV6" == true ]]; then + + # Check the ipv6 + if [[ $ARG_IPv6_ADDRESS == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + + run_function ip_get_external_ipv6 + + # Get user's response + run_function common_read_user_input \ + "Please enter the IP address (ipv6) that your server uses to connect to the internet. \ + \nYou might try the following '$IP_EXTERNAL_IPV6' (default: ::1):" + + LOCAL_IPv6_ADDRESS=${USER_INPUT_RESPONSE:-"::1"} + else + LOCAL_IPv6_ADDRESS=${ARG_IPv6_ADDRESS:-"::1"} + fi + + # Check the IP address + run_function ip_check_ipv6 $LOCAL_IPv6_ADDRESS + + if [[ ! "$IP_IPV6" == true ]]; then + echoerr "The IP address '$LOCAL_IPv6_ADDRESS' seems to be in wrong format. Please try again or keep the default value." + local_undo_restore + else + IPv6_ADDRESS=${LOCAL_IPv6_ADDRESS:-"::1"} + fi +fi + +#----------------------------------------------------------------------- +# Docker network for the nginx-proxy +# +# Parameters: -net | --network-name +# +# Final result: +# - DOCKER_NETWORK_NAME +#----------------------------------------------------------------------- +LOCAL_DEFAULT_DOCKER_NETWORK_NAME=${DEFAULT_DOCKER_NETWORK_NAME:-"proxy"} +if [[ $ARG_NETWORK_NAME == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + + # Get user's response + run_function common_read_user_input "Please enter the network name for your nginx-proxy (default: $LOCAL_DEFAULT_DOCKER_NETWORK_NAME):" + + LOCAL_DOCKER_NETWORK_NAME=${USER_INPUT_RESPONSE:-$LOCAL_DEFAULT_DOCKER_NETWORK_NAME} +else + LOCAL_DOCKER_NETWORK_NAME=${ARG_NETWORK_NAME:-$LOCAL_DEFAULT_DOCKER_NETWORK_NAME} +fi + +# Validate the name +run_function string_remove_all_special_char_string $LOCAL_DOCKER_NETWORK_NAME +DOCKER_NETWORK_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} +[[ $DOCKER_NETWORK_NAME == null ]] && echoerr "The network name can not contain special chars, neither be empty" + +#----------------------------------------------------------------------- +# Data location for nginx-proxy files +# +# Parameters: -d | --data-files-location +# +# Final result: +# - DATA_LOCATION +#----------------------------------------------------------------------- +LOCAL_DEFAULT_DATA_LOCATION=${DEFAULT_DATA_LOCATION:-"$SCRIPT_PATH/../data"} +if [[ $ARG_DATA_LOCATION == "" ]] && [[ ! "$REPLY_YES" == true ]]; then + + # Get user's response + run_function common_read_user_input "Please enter the path location where you wish to place your nginx-proxy files (default: $LOCAL_DEFAULT_DATA_LOCATION):" + + DATA_LOCATION=${USER_INPUT_RESPONSE:-$LOCAL_DEFAULT_DATA_LOCATION} +else + DATA_LOCATION=${ARG_DATA_LOCATION:-$LOCAL_DEFAULT_DATA_LOCATION} +fi + +# Create folder if it does not exist +run_function common_create_folder $DATA_LOCATION + +#----------------------------------------------------------------------- +# Default email address for the Lets Encrypt certificates +# +# Parameters: -e | --default-email +# +# Final result: +# - DEFAULT_EMAIL +#----------------------------------------------------------------------- +if [[ $ARG_DEFAULT_EMAIL == "" ]]; then + + # Get user's response + run_function common_read_user_input "You must inform a valid email address in order to continue. Please check the docs:" + + DEFAULT_EMAIL=${USER_INPUT_RESPONSE} +else + DEFAULT_EMAIL=${ARG_DEFAULT_EMAIL} +fi + +# Check if email is valid +run_function email_check_is_valid $DEFAULT_EMAIL + +[[ ! "$EMAIL_IS_VALID" == true ]] && echoerr "You must inform a valid email address in order to continue. Please try again." + +#----------------------------------------------------------------------- +# Log settings for nginx-proxy +# +# We would like to comment that this is a very specific configuration +# that, once we will not offer the available options we decided to +# simplify these options once was not a common issue setting up +#----------------------------------------------------------------------- +NGINX_PROXY_LOG_DRIVER=${ARG_NGINX_PROXY_LOG_DRIVER:-"json-file"} +NGINX_PROXY_LOG_MAX_SIZE=${ARG_NGINX_PROXY_LOG_MAX_SIZE:-"4m"} +NGINX_PROXY_LOG_MAX_FILE=${ARG_NGINX_PROXY_LOG_MAX_FILE:-"10"} + +DOCKER_GEN_LOG_DRIVER=${ARG_DOCKER_GEN_LOG_DRIVER:-"json-file"} +DOCKER_GEN_LOG_MAX_SIZE=${ARG_DOCKER_GEN_LOG_MAX_SIZE:-"2m"} +DOCKER_GEN_LOG_MAX_FILE=${ARG_DOCKER_GEN_LOG_MAX_FILE:-"10"} + +LETSENCRYPT_LOG_DRIVER=${ARG_LETSENCRYPT_LOG_DRIVER:-"json-file"} +LETSENCRYPT_LOG_MAX_SIZE=${ARG_LETSENCRYPT_LOG_MAX_SIZE:-"2m"} +LETSENCRYPT_LOG_MAX_FILE=${ARG_LETSENCRYPT_LOG_MAX_FILE:-"10"} + +#----------------------------------------------------------------------- +# Port binding +# +# We would like to comment out that the settings below seems to be +# rearly changes by the users, so we kept that pretty simple in +# this script, if that is all right with you! Thank you! +#----------------------------------------------------------------------- +DOCKER_HTTP=${ARG_DOCKER_HTTP:-"80"} +DOCKER_HTTPS=${ARG_DOCKER_HTTPS:-"443"} + +#----------------------------------------------------------------------- +# SSL policy (defaults to Mozilla-Intermediate) +# +# Please read the options at the url below: +# https://github.com/nginx-proxy/nginx-proxy#how-ssl-support-works +#----------------------------------------------------------------------- +SSL_POLICY=${ARG_SSL_POLICY:-"Mozilla-Intermediate"} + +#----------------------------------------------------------------------- +# Start actions! +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Verify checksum of docker-compose.yml and .env.sample files +#----------------------------------------------------------------------- +run_function md5_check_checksum "$SCRIPT_PATH/../" "docker-compose.yml" $MD5_SUM_DOCKER_COMPOSE +if [[ ! "$MD5_CHECKSUM" == true ]] && [[ ! "$REPLY_YES" == true ]]; then + + run_function confirm_user_action \ + "We could not verify the checksum (md5) for the docker-compose.yml \ + \n are you sure you want to continue?" +fi + +run_function md5_check_checksum "$SCRIPT_PATH/../" ".env.sample" $MD5_SUM_ENV_SAMPLE +if [[ ! "$MD5_CHECKSUM" == true ]] && [[ ! "$REPLY_YES" == true ]]; then + + run_function confirm_user_action \ + "We could not verify the checksum (md5) for the .env \ + \n are you sure you want to continue?" +fi + +#----------------------------------------------------------------------- +# Stop services (docker-compose) if they are running +#----------------------------------------------------------------------- +if [[ "$LOCAL_STOP_CURRENT_NGINX_PROXY_SERVICES" == true ]]; then + run_function docker_compose_stop "$SCRIPT_PATH/../" + + ACTION_DOCKER_COMPOSE_STOPPED=true + + [[ "$ERROR_DOCKER_COMPOSE_START" == true ]] && local_undo_restore + + # If there is no error when stopping container backup docker-compose file + run_function backup_file "$SCRIPT_PATH/../docker-compose.yml" + ACTION_DOCKER_COMPOSE_FILE_RENAMED=true + LOCAL_BACKUP_DOCKER_COMPOSE_FILE=$BACKUP_FILE +fi + +#----------------------------------------------------------------------- +# Add nginx config folder (conf.d) +#----------------------------------------------------------------------- +if [[ "$USE_NGINX_CONF_FILES" == true ]]; then + # Create the conf folder if it does not exists + run_function common_create_folder "$DATA_LOCATION/conf.d" + + # Copy the special configurations to the nginx conf folder + cp -R $SCRIPT_PATH/../conf.d/* $DATA_LOCATION/conf.d/ + + # Check if there was an error and try with sudo + if [ $? -ne 0 ]; then + echo "sudo cp -R $SCRIPT_PATH/../conf.d/* $DATA_LOCATION/conf.d/" + exit 0 + sudo cp -R $SCRIPT_PATH/../conf.d/* $DATA_LOCATION/conf.d/ + fi + + # If there was any errors inform the user + if [ $? -ne 0 ]; then + echoerr "There was an error trying to copy the nginx conf files. \ + \nThe proxy will still work with default options, but \ + \nthe custom settings might not be loaded." + fi +fi + +#----------------------------------------------------------------------- +# Update the nginx.template with the latest version +#----------------------------------------------------------------------- +DEFAULT_NGINX_TEMPLATE_URL="https://raw.githubusercontent.com/nginx-proxy/nginx-proxy/master/nginx.tmpl" +if [[ "$UPDATE_NGINX_TEMPLATE" == true ]]; then + cd "$SCRIPT_PATH/../" + curl -L $DEFAULT_NGINX_TEMPLATE_URL -o nginx.tmpl + cd - > /dev/null 2>&1 +fi + +#----------------------------------------------------------------------- +# Backup .env file if exists +#----------------------------------------------------------------------- +if [[ "$LOCAL_BACKUP_OLD_ENV_FILE" == true ]]; then + run_function backup_file "$SCRIPT_PATH/../.env" + ACTION_ENV_FILE_RENAMED=true + LOCAL_BACKUP_ENV_FILE=$BACKUP_FILE +fi + +#----------------------------------------------------------------------- +# Backup docker-compose.yml file if exists +#----------------------------------------------------------------------- +if [[ "$LOCAL_BACKUP_OLD_DOCKER_COMPOSE_FILE" == true ]]; then + run_function backup_file "$SCRIPT_PATH/../docker-compose.yml" + ACTION_DOCKER_COMPOSE_FILE_RENAMED=true + LOCAL_BACKUP_DOCKER_COMPOSE_FILE=$BACKUP_FILE +fi + +#----------------------------------------------------------------------- +# Create and update .env file for nginx-proxy +#----------------------------------------------------------------------- +cp "$SCRIPT_PATH/../.env.sample" "$SCRIPT_PATH/../.env" + +run_function local_update_env_new_site_variables "$SCRIPT_PATH/../" + +#----------------------------------------------------------------------- +# Create docker network if it does not exist +#----------------------------------------------------------------------- +run_function docker_check_network_exists $DOCKER_NETWORK_NAME + +if [[ ! "$DOCKER_NETWORK_EXISTS" == true ]]; then + + run_function docker_network_create $DOCKER_NETWORK_NAME $ACTIVATE_IPV6 $ARG_IPv6_SUBNET + + if [[ "$ERROR_DOCKER_NETWORK_CREATE" == true ]]; then + echoerr "There was error when creating the docker network $DOCKER_NETWORK_NAME [IPv6 enabled: ${ACTIVATE_IPV6:-'false'} ]" false + local_undo_restore + else + ACTION_DOCKER_NETWORK_CREATED=true + fi +fi + +#----------------------------------------------------------------------- +# Update docker-compose file +#----------------------------------------------------------------------- +run_function local_update_docker_compose_file "$SCRIPT_PATH/../" + +#----------------------------------------------------------------------- +# Start proxy +#----------------------------------------------------------------------- +run_function docker_compose_start "$SCRIPT_PATH/../" + +if [[ "$ERROR_DOCKER_COMPOSE_START" == true ]]; then + echoerr "There was an error starting the service at '$SCRIPT_PATH/../'" + local_undo_restore +fi + +#----------------------------------------------------------------------- +# Show data for the user to take notes +#----------------------------------------------------------------------- +echosuccess "Your proxy was started successfully!" + +# @todo - testing the proxy +# +# attention: +# 1. if yes don't ask for testing unless splicit +# 2. timeout optional yes|no as default? +# 3. url for testing - test dns first +# 4. option for ssl testing as well +# +# without ssl +# docker run -d -e VIRTUAL_HOST=$DOMAIN --network=$NETWORK --name test-web httpd:alpine +# +# with ss +# docker run -d -e VIRTUAL_HOST=$DOMAIN -e LETSENCRYPT_HOST=$DOMAIN --network=$NETWORK --name $NAME httpd:alpine +# +# stop testint - timeout?! +# docker stop test-web && docker rm test-web + +exit 0 diff --git a/bin/localscript/bootstrap.sh b/bin/localscript/bootstrap.sh new file mode 100755 index 00000000..6a0c23ce --- /dev/null +++ b/bin/localscript/bootstrap.sh @@ -0,0 +1,44 @@ +#----------------------------------------------------------------------- +# +# Server Automation - https://github.com/evertramos/server-automation +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be careful when editing this file, it is part of a bigger script! +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This script has one main objective: +# 1. Load all functions in local folder +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Fill out local variables +#----------------------------------------------------------------------- +# Get Current directory +LOCAL_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" + +# Bootstrap file name +BOOTSTRAP_FILE_NAME="bootstrap.sh" + +#----------------------------------------------------------------------- +# Debug message +#----------------------------------------------------------------------- +[[ "$DEBUG" == true ]] && "Reading base script files... [bootstrap.sh]" + +#----------------------------------------------------------------------- +# Read files with extension '.sh' +#----------------------------------------------------------------------- +# Loop the base folder and source all files in root folder +for file in $LOCAL_PATH/*.sh +do + [[ $file != $LOCAL_PATH/$BOOTSTRAP_FILE_NAME ]] && source $file +done + +return 0 diff --git a/bin/localscript/check-docker-nginx-proxy-automation-env-file.sh b/bin/localscript/check-docker-nginx-proxy-automation-env-file.sh new file mode 100755 index 00000000..e0f4afcc --- /dev/null +++ b/bin/localscript/check-docker-nginx-proxy-automation-env-file.sh @@ -0,0 +1,29 @@ +#----------------------------------------------------------------------- +# +# Server Automation - https://github.com/evertramos/server-automation +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be careful when editing this file, it is part of a bigger script! +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This script has one main objective: +# 1. Check if the .env file already exists for the +# docker-nginx-proxy-automation +#----------------------------------------------------------------------- + +check_docker_nginx_proxy_automation_env_file_exits() +{ + [[ "$DEBUG" == true ]] && echo "Check if '.env' file exists for the nginx-proxy." + + if [[ -e ./../.env ]]; then + DOCKER_NGINX_PROXY_AUTOMATION_ENV_FILE_EXISTS=true + fi +} diff --git a/bin/localscript/check-local-env-file.sh b/bin/localscript/check-local-env-file.sh new file mode 100755 index 00000000..d583bdc6 --- /dev/null +++ b/bin/localscript/check-local-env-file.sh @@ -0,0 +1,31 @@ +#----------------------------------------------------------------------- +# +# Server Automation - https://github.com/evertramos/server-automation +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be careful when editing this file, it is part of a bigger script! +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This script has one main objective: +# 1. Check if the .env file exists in the current folder +#----------------------------------------------------------------------- + +check_local_env_file() +{ + [[ "$DEBUG" == true ]] && echo "Check if local '.env' file is set." + + if [[ -e .env ]]; then + source .env + else + MESSAGE="'.env' file not found! \n Cheers!" + return 1 + fi +} diff --git a/bin/localscript/update-docker-compose-file.sh b/bin/localscript/update-docker-compose-file.sh new file mode 100755 index 00000000..dfebce6c --- /dev/null +++ b/bin/localscript/update-docker-compose-file.sh @@ -0,0 +1,47 @@ +#----------------------------------------------------------------------- +# +# Server Automation - https://github.com/evertramos/server-automation +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be careful when editing this file, it is part of a bigger script! +# +#----------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# This function has one main objective: +# 1. Update all variables in docker-compose file +# +# You must/might inform the parameters below: +# 1. Path where docker-compose.yml file is located +# 2. [optional] (default: ) +# +# ---------------------------------------------------------------------- + +local_update_docker_compose_file() +{ + local LOCAL_FULL_PATH + + LOCAL_FULL_PATH=${1} + + [[ $LOCAL_FULL_PATH == "" || $LOCAL_FULL_PATH == null ]] && echoerr "You must inform the required argument(s) to the function: '${FUNCNAME[0]}'" + + [[ "$DEBUG" == true ]] && echo "Updating all variables in docker-compose.yml file for nginx-proxy (file: ${LOCAL_FULL_PATH})" + + # Services name + run_function docker_compose_replace_string $LOCAL_FULL_PATH "$REPLACE_NGINX_PROXY_SERVICE_NAME" "$NGINX_PROXY_SERVICE_NAME" + run_function docker_compose_replace_string $LOCAL_FULL_PATH "$REPLACE_DOCKER_GEN_SERVICE_NAME" "$DOCKER_GEN_SERVICE_NAME" + run_function docker_compose_replace_string $LOCAL_FULL_PATH "$REPLACE_LETSENCRYPT_SERVICE_NAME" "$LETSENCRYPT_SERVICE_NAME" + + # Uncomment in case of IPv6 activation or uncomment + [[ "$ACTIVATE_IPV6" == true ]] && run_function file_uncomment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPv6" + [[ ! "$ACTIVATE_IPV6" == true ]] && run_function file_comment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPv6" + # We are aware that it will set two '#' if the IPv6 is already commented + + return 0 +} diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh new file mode 100755 index 00000000..b1a3ddd0 --- /dev/null +++ b/bin/localscript/update-env-new-site-variables.sh @@ -0,0 +1,79 @@ +#----------------------------------------------------------------------- +# +# Server Automation - https://github.com/evertramos/server-automation +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be careful when editing this file, it is part of a bigger script! +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This function has one main objective: +# 1. Update all variables in .env file for fresh start script +# +# You must/might inform the parameters below: +# 1. Path where .env is located +# 2. [optional] (default: ) n/a +# +#----------------------------------------------------------------------- + +local_update_env_new_site_variables() +{ + local LOCAL_FILE_PATH + + LOCAL_FILE_PATH=${1:-null} + + [[ $LOCAL_FILE_PATH == "" || $LOCAL_FILE_PATH == null ]] && echoerr "You must inform the required argument(s) to the function: '${FUNCNAME[0]}'" + + [[ "$DEBUG" == true ]] && echo "Updating all variables in .env file for nginx-proxy (file: ${LOCAL_FILE_PATH})" + + # Docker servides and image versions + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_WEB" "$NGINX_PROXY_SERVICE_NAME" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_IMAGE_VERSION" "$NGINX_PROXY_IMAGE_VERSION" + run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_GEN" "$DOCKER_GEN_SERVICE_NAME" + run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_GEN_IMAGE_VERSION" "$DOCKER_GEN_IMAGE_VERSION" + run_function env_update_variable $LOCAL_FILE_PATH "LETS_ENCRYPT" "$LETSENCRYPT_SERVICE_NAME" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_PROXY_COMPANION_IMAGE_VERSION" "$LETSENCRYPT_IMAGE_VERSION" + + # IPs + run_function env_update_variable $LOCAL_FILE_PATH "IP" "$IP_ADDRESS" + [[ "$ACTIVATE_IPV6" == true ]] && run_function env_update_variable $LOCAL_FILE_PATH "IPv6" "$IPv6_ADDRESS" + + # Network + run_function env_update_variable $LOCAL_FILE_PATH "NETWORK" "$DOCKER_NETWORK_NAME" + + # Data files path + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_FILES_PATH" "$DATA_LOCATION" + + # Log variables + # proxy + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_WEB_LOG_DRIVER" "$NGINX_PROXY_LOG_DRIVER" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_WEB_LOG_MAX_SIZE" "$NGINX_PROXY_LOG_MAX_SIZE" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_WEB_LOG_MAX_FILE" "$NGINX_PROXY_LOG_MAX_FILE" + # docker-gen + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_GEN_LOG_DRIVER" "$DOCKER_GEN_LOG_DRIVER" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_GEN_LOG_MAX_SIZE" "$DOCKER_GEN_LOG_MAX_SIZE" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_GEN_LOG_MAX_FILE" "$DOCKER_GEN_LOG_MAX_FILE" + # Lets Encrypt + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_LETSENCRYPT_LOG_DRIVER" "$LETSENCRYPT_LOG_DRIVER" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_LETSENCRYPT_LOG_MAX_SIZE" "$LETSENCRYPT_LOG_MAX_SIZE" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_LETSENCRYPT_LOG_MAX_FILE" "$LETSENCRYPT_LOG_MAX_FILE" + + # Port bindings + run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_HTTP" "$DOCKER_HTTP" + run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_HTTPS" "$DOCKER_HTTPS" + + # SSL Policy + run_function env_update_variable $LOCAL_FILE_PATH "SSL_POLICY" "$SSL_POLICY" + + # Default email address + run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_EMAIL" "$DEFAULT_EMAIL" + + return 0 +} diff --git a/bin/localscript/usage-fresh-start.sh b/bin/localscript/usage-fresh-start.sh new file mode 100755 index 00000000..a8291dc5 --- /dev/null +++ b/bin/localscript/usage-fresh-start.sh @@ -0,0 +1,132 @@ +#----------------------------------------------------------------------- +# +# Server Automation - https://github.com/evertramos/server-automation +# +# Developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- +# +# Be careful when editing this file, it is part of a bigger script! +# +#----------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# This script has one main objective: +# 1. Show the script usage (helper) +#----------------------------------------------------------------------- + +# +# NGINX use special conf files +# +# In case you want to add some special configuration to your NGINX Web Proxy you could +# add your files to ./conf.d/ folder as of sample file 'uploadsize.conf' +# +# [WARNING] This setting was built to use our `start.sh`. +# +# [WARNING] Once you set this options to true all your files will be copied to data +# folder (./data/conf.d). If you decide to remove this special configuration +# you must delete your files from data folder ./data/conf.d. +# +# USE_NGINX_CONF_FILES=true + +#----------------------------------------------------------------------- +# +# Docker network options +# +# The docker network has many options when creating a new network, you can +# check the url below for more information about the docker network creation +# in our 'fresh_start.sh' script you can enable the network encryption option +# +# https://docs.docker.com/engine/reference/commandline/network_create/ +# +# NETWORK_OPTIONS="--opt encrypted=true" + +usage() +{ + cat << USAGE >&2 +${purple} +============================================================================= +| _____ _____ _ _ _ | +| | __|___ ___ _ _ ___ ___ ___| _ |_ _| |_ ___ _____ ___| |_|_|___ ___ | +| |__ | -_| _| | | -_| _|___| | | | _| . | | .'| _| | . | | | +| |_____|___|_| \_/|___|_| |__|__|___|_| |___|_|_|_|__,|_| |_|___|_|_| | +| | +============================================================================= +${reset}${blue} +Usage: + $SCRIPT_NAME -e "john.doe@example.com" + [-d "/server/proxy/data"] + [-pn "proxy"] [-ln "letsencrypt"] [-gn "docker-gen"] + [-net "proxy"] + [--use-nginx-conf-files] [--update-nginx-template] + [--yes] + [--debug] + + Required + -e | --default-email Default email address require to issue tld + certificates with Let's Encrypt service + + Basic options + -d | --data-files-location Proxy files location + -pn | --proxy-name Proxy service and container name + -ln | --letsencrypt-name Let's Encrypt service & container name + -gn | --docker-gen-name Docker-gen service and container name + -net | --network-name Docker network name for proxy services + -ip | --ip-address IP address for external connectivity + + Proxy config + --use-nginx-conf-files Add basic config folder to the Proxy + --update-nginx-template Download the latest nginx.tmpl + + Network + -netopt | --network-option Network options please check the docs + + Docker image + -piv | --proxy-image-version Proxy image version + -liv | --letsencrypt-image-version Let's Encrypt image version + -giv | --docker-gen-image-version Docker-gen image version + + --skip-docker-image-check Use this option to skip docker image + verification which might takes a few + seconds to check if images exists in + docker hub api + + Docker log + -lpd | --log-nginx-proxy-driver Proxy service log driver + -lpms | --log-nginx-proxy-max_size Proxy service log max file size + -lpmf | --log-nginx-proxy-max_file Proxy service log max files + -lgd | --log-docker-gen-driver Docker-gen service log driver + -lgms | --log-docker-gen-max_size Docker-gen service log max file size + -lgmf | --log-docker-gen-max_file Docker-gen service log max files + -lld | --log-letsencrypt-driver Let's Encrypt service log driver + -llms | --log-letsencrypt-max_size Let's Encrypt service log max size + -llmf | --log-letsencrypt-max_file Let's Encrypt service log max files + + Proxy port binding + -phttp | --port-http Proxy http port (default: 80) + -phttps | --port-https Proxy https port (default: 443) + + Proxy SSL policy + -sp | --ssl-policy Proxy SSL suport + (default: Mozilla-Intermediate) + + IPv6 support + --activate-ipv6 Use to activate IPv6 support + -ipv6 | --ipv6-address IPv6 address for external connectivity + --ipv6-subnet You must inform IPv6 subnet to create + a docker network + (default: 2001:db8:1:1::/112) + + Other options + --yes Set "yes" to all, use it with caution + --debug Show script debug options + --silent Hide all script message + -h | --help Display this help + +${reset} +USAGE + exit 1 +} diff --git a/docker-compose-multiple-networks.yml b/docker-compose-multiple-networks.yml deleted file mode 100644 index a9406a90..00000000 --- a/docker-compose-multiple-networks.yml +++ /dev/null @@ -1,79 +0,0 @@ -version: '3' -services: - nginx-web: - image: nginx - labels: - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" - container_name: ${NGINX_WEB:-nginx-web} - restart: always - ports: - - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80" - - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" - volumes: - - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d - - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html - - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:ro - - ${NGINX_FILES_PATH:-./data}/htpasswd:/etc/nginx/htpasswd:ro - networks: - - default - - outside - logging: - driver: ${NGINX_WEB_LOG_DRIVER:-json-file} - options: - max-size: ${NGINX_WEB_LOG_MAX_SIZE:-4m} - max-file: ${NGINX_WEB_LOG_MAX_FILE:-10} - - nginx-gen: - image: jwilder/docker-gen - command: -notify-sighup ${NGINX_WEB:-nginx-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf - container_name: ${DOCKER_GEN:-nginx-gen} - restart: always - environment: - SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} - volumes: - - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d - - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html - - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:ro - - ${NGINX_FILES_PATH:-./data}/htpasswd:/etc/nginx/htpasswd:ro - - /var/run/docker.sock:/tmp/docker.sock:ro - - ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro - networks: - - default - - outside - logging: - driver: ${NGINX_GEN_LOG_DRIVER:-json-file} - options: - max-size: ${NGINX_GEN_LOG_MAX_SIZE:-2m} - max-file: ${NGINX_GEN_LOG_MAX_FILE:-10} - - nginx-letsencrypt: - image: jrcs/letsencrypt-nginx-proxy-companion - container_name: ${LETS_ENCRYPT:-nginx-letsencrypt} - restart: always - volumes: - - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d - - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html - - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:rw - - /var/run/docker.sock:/var/run/docker.sock:ro - environment: - NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN:-nginx-gen} - NGINX_PROXY_CONTAINER: ${NGINX_WEB:-nginx-web} - networks: - - default - - outside - logging: - driver: ${NGINX_LETSENCRYPT_LOG_DRIVER:-json-file} - options: - max-size: ${NGINX_LETSENCRYPT_LOG_MAX_SIZE:-2m} - max-file: ${NGINX_LETSENCRYPT_LOG_MAX_FILE:-10} - -networks: - default: - external: - name: ${NETWORK:-webproxy} - outside: - external: - name: ${SERVICE_NETWORK:-webservices} diff --git a/docker-compose.yml b/docker-compose.yml index 6fcab021..54324096 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,19 @@ version: '3' + services: - nginx-web: - image: nginx:stable-alpine + nginx-proxy-automation-web: + image: nginx:${NGINX_IMAGE_VERSION:-stable-alpine} labels: com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" - container_name: ${NGINX_WEB:-nginx-web} + container_name: ${NGINX_WEB:-nginx-proxy-automation-web} restart: always ports: - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80" - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" +# - "${IPv6:-::/0}:80:80" +# - "${IPv6:-::/0}:443:443" + environment: + SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d @@ -21,13 +26,11 @@ services: max-size: ${NGINX_WEB_LOG_MAX_SIZE:-4m} max-file: ${NGINX_WEB_LOG_MAX_FILE:-10} - nginx-gen: - image: jwilder/docker-gen - command: -notify-sighup ${NGINX_WEB:-nginx-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf - container_name: ${DOCKER_GEN:-nginx-gen} + nginx-proxy-automation-gen: + image: jwilder/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-latest} + command: -notify-sighup ${NGINX_WEB:-nginx-proxy-automation-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf + container_name: ${DOCKER_GEN:-nginx-proxy-automation-gen} restart: always - environment: - SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d @@ -42,19 +45,21 @@ services: max-size: ${NGINX_GEN_LOG_MAX_SIZE:-2m} max-file: ${NGINX_GEN_LOG_MAX_FILE:-10} - nginx-letsencrypt: - image: jrcs/letsencrypt-nginx-proxy-companion:stable - container_name: ${LETS_ENCRYPT:-nginx-letsencrypt} + nginx-proxy-automation-letsencrypt: + image: jrcs/letsencrypt-nginx-proxy-companion:${NGINX_PROXY_COMPANION_IMAGE_VERSION:-2.0} + container_name: ${LETS_ENCRYPT:-nginx-proxy-automation-letsencrypt} restart: always volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:rw + - ${NGINX_FILES_PATH:-./data}/acme.sh:/etc/acme.sh - /var/run/docker.sock:/var/run/docker.sock:ro environment: - NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN:-nginx-gen} - NGINX_PROXY_CONTAINER: ${NGINX_WEB:-nginx-web} + NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN:-nginx-proxy-automation-gen} + NGINX_PROXY_CONTAINER: ${NGINX_WEB:-nginx-proxy-automation-web} + DEFAULT_EMAIL: ${DEFAULT_EMAIL:-mail@yourdomain.tld} logging: driver: ${NGINX_LETSENCRYPT_LOG_DRIVER:-json-file} options: @@ -64,4 +69,4 @@ services: networks: default: external: - name: ${NETWORK:-webproxy} + name: ${NETWORK:-proxy} diff --git a/nginx.tmpl b/nginx.tmpl index c1383c68..07e2b50e 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -1,5 +1,8 @@ {{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }} +{{ $external_http_port := coalesce $.Env.HTTP_PORT "80" }} +{{ $external_https_port := coalesce $.Env.HTTPS_PORT "443" }} + {{ define "upstream" }} {{ if .Address }} {{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}} @@ -135,25 +138,27 @@ proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port; proxy_set_header Proxy ""; {{ end }} +{{ $access_log := (or (and (not $.Env.DISABLE_ACCESS_LOGS) "access_log /var/log/nginx/access.log vhost;") "") }} + {{ $enable_ipv6 := eq (or ($.Env.ENABLE_IPV6) "") "true" }} server { server_name _; # This is just an invalid value which will never trigger on a real hostname. - listen 80; + listen {{ $external_http_port }}; {{ if $enable_ipv6 }} - listen [::]:80; + listen [::]:{{ $external_http_port }}; {{ end }} - access_log /var/log/nginx/access.log vhost; + {{ $access_log }} return 503; } {{ if (and (exists "/etc/nginx/certs/default.crt") (exists "/etc/nginx/certs/default.key")) }} server { server_name _; # This is just an invalid value which will never trigger on a real hostname. - listen 443 ssl http2; + listen {{ $external_https_port }} ssl http2; {{ if $enable_ipv6 }} - listen [::]:443 ssl http2; + listen [::]:{{ $external_https_port }} ssl http2; {{ end }} - access_log /var/log/nginx/access.log vhost; + {{ $access_log }} return 503; ssl_session_cache shared:SSL:50m; @@ -209,13 +214,13 @@ upstream {{ $upstream_name }} { {{ $network_tag := or (first (groupByKeys $containers "Env.NETWORK_ACCESS")) "external" }} {{/* Get the HTTPS_METHOD defined by containers w/ the same vhost, falling back to "redirect" */}} -{{ $https_method := or (first (groupByKeys $containers "Env.HTTPS_METHOD")) "redirect" }} +{{ $https_method := or (first (groupByKeys $containers "Env.HTTPS_METHOD")) (or $.Env.HTTPS_METHOD "redirect") }} {{/* Get the SSL_POLICY defined by containers w/ the same vhost, falling back to empty string (use default) */}} {{ $ssl_policy := or (first (groupByKeys $containers "Env.SSL_POLICY")) "" }} {{/* Get the HSTS defined by containers w/ the same vhost, falling back to "max-age=31536000" */}} -{{ $hsts := or (first (groupByKeys $containers "Env.HSTS")) "max-age=31536000" }} +{{ $hsts := or (first (groupByKeys $containers "Env.HSTS")) (or $.Env.HSTS "max-age=31536000") }} {{/* Get the VIRTUAL_ROOT By containers w/ use fastcgi root */}} {{ $vhost_root := or (first (groupByKeys $containers "Env.VIRTUAL_ROOT")) "/var/www/public" }} @@ -241,22 +246,34 @@ upstream {{ $upstream_name }} { {{ if eq $https_method "redirect" }} server { server_name {{ $host }}; - listen 80 {{ $default_server }}; + listen {{ $external_http_port }} {{ $default_server }}; {{ if $enable_ipv6 }} - listen [::]:80 {{ $default_server }}; + listen [::]:{{ $external_http_port }} {{ $default_server }}; {{ end }} - access_log /var/log/nginx/access.log vhost; - return 301 https://$host$request_uri; + {{ $access_log }} + + # Do not HTTPS redirect Let'sEncrypt ACME challenge + location /.well-known/acme-challenge/ { + auth_basic off; + allow all; + root /usr/share/nginx/html; + try_files $uri =404; + break; + } + + location / { + return 301 https://$host$request_uri; + } } {{ end }} server { server_name {{ $host }}; - listen 443 ssl http2 {{ $default_server }}; + listen {{ $external_https_port }} ssl http2 {{ $default_server }}; {{ if $enable_ipv6 }} - listen [::]:443 ssl http2 {{ $default_server }}; + listen [::]:{{ $external_https_port }} ssl http2 {{ $default_server }}; {{ end }} - access_log /var/log/nginx/access.log vhost; + {{ $access_log }} {{ if eq $network_tag "internal" }} # Only allow traffic from internal clients @@ -300,6 +317,8 @@ server { root {{ trim $vhost_root }}; include fastcgi_params; fastcgi_pass {{ trim $upstream_name }}; + {{ else if eq $proto "grpc" }} + grpc_pass {{ trim $proto }}://{{ trim $upstream_name }}; {{ else }} proxy_pass {{ trim $proto }}://{{ trim $upstream_name }}; {{ end }} @@ -322,11 +341,11 @@ server { server { server_name {{ $host }}; - listen 80 {{ $default_server }}; + listen {{ $external_http_port }} {{ $default_server }}; {{ if $enable_ipv6 }} listen [::]:80 {{ $default_server }}; {{ end }} - access_log /var/log/nginx/access.log vhost; + {{ $access_log }} {{ if eq $network_tag "internal" }} # Only allow traffic from internal clients @@ -347,6 +366,8 @@ server { root {{ trim $vhost_root }}; include fastcgi_params; fastcgi_pass {{ trim $upstream_name }}; + {{ else if eq $proto "grpc" }} + grpc_pass {{ trim $proto }}://{{ trim $upstream_name }}; {{ else }} proxy_pass {{ trim $proto }}://{{ trim $upstream_name }}; {{ end }} @@ -365,11 +386,11 @@ server { {{ if (and (not $is_https) (exists "/etc/nginx/certs/default.crt") (exists "/etc/nginx/certs/default.key")) }} server { server_name {{ $host }}; - listen 443 ssl http2 {{ $default_server }}; + listen {{ $external_https_port }} ssl http2 {{ $default_server }}; {{ if $enable_ipv6 }} - listen [::]:443 ssl http2 {{ $default_server }}; + listen [::]:{{ $external_https_port }} ssl http2 {{ $default_server }}; {{ end }} - access_log /var/log/nginx/access.log vhost; + {{ $access_log }} return 500; ssl_certificate /etc/nginx/certs/default.crt; diff --git a/scripts/update.sh b/scripts/update.sh index 6f5c15f3..614811c4 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -3,7 +3,7 @@ # # This scrip update the web proxy without downtime # -# Source: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion +# Source: https://github.com/evertramos/nginx-proxy-automation # # 1. Check if .env file exists diff --git a/start.sh b/start.sh deleted file mode 100755 index 6364531b..00000000 --- a/start.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -# -# This file should be used to prepare and run your WebProxy after set up your .env file -# Source: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion -# - -# 1. Check if .env file exists -if [ -e .env ]; then - source .env -else - echo "It seems you didnΒ΄t create your .env file, so we will create one for you." - cp .env.sample .env - # exit 1 -fi - -# 2. Create docker network -docker network create $NETWORK $NETWORK_OPTIONS - -# 3. Verify if second network is configured -if [ ! -z ${SERVICE_NETWORK+X} ]; then - docker network create $SERVICE_NETWORK $SERVICE_NETWORK_OPTIONS -fi - -# 4. Download the latest version of nginx.tmpl -curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > nginx.tmpl - -# 5. Update local images -docker-compose pull - -# 6. Add any special configuration if it's set in .env file - -# Check if user set to use Special Conf Files -if [ ! -z ${USE_NGINX_CONF_FILES+X} ] && [ "$USE_NGINX_CONF_FILES" = true ]; then - - # Create the conf folder if it does not exists - mkdir -p $NGINX_FILES_PATH/conf.d - - # Copy the special configurations to the nginx conf folder - cp -R ./conf.d/* $NGINX_FILES_PATH/conf.d - - # Check if there was an error and try with sudo - if [ $? -ne 0 ]; then - sudo cp -R ./conf.d/* $NGINX_FILES_PATH/conf.d - fi - - # If there was any errors inform the user - if [ $? -ne 0 ]; then - echo - echo "#######################################################" - echo - echo "There was an error trying to copy the nginx conf files." - echo "The proxy will still work with default options, but" - echo "the custom settings your have made could not be loaded." - echo - echo "#######################################################" - fi -fi - -# 7. Start proxy - -# Check if you have multiple network -if [ -z ${SERVICE_NETWORK+X} ]; then - docker-compose up -d -else - docker-compose -f docker-compose-multiple-networks.yml up -d -fi - -exit 0 diff --git a/test_start.sh b/test_start.sh deleted file mode 100755 index 8fb1058a..00000000 --- a/test_start.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Set up your DOMAIN -if [ $# -eq 0 ]; then - echo "Please inform your domain name to test your proxy." - echo "./test_start.sh $1" - exit 1 -else - DOMAIN=$1 -fi - -# Read your .env file -source .env - -# Testing your proxy -if [ -z ${SERVICE_NETWORK+X} ]; then - docker run -d -e VIRTUAL_HOST=$DOMAIN --network=$NETWORK --name test-web httpd:alpine -else - docker run -d -e VIRTUAL_HOST=$DOMAIN --network=$SERVICE_NETWORK --name test-web httpd:alpine -fi - -exit 0 diff --git a/test_start_ssl.sh b/test_start_ssl.sh deleted file mode 100755 index a14bd3a5..00000000 --- a/test_start_ssl.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -NAME=test-web - - -# Set up your DOMAIN -if [ $# -eq 0 ]; then - echo "Please inform your domain name to test your proxy." - echo "./test_start_ssl.sh $1" - exit 1 -else - DOMAIN=$1 -fi - -# Read your .env file -source .env - -# Testing your proxy -if [ -z ${SERVICE_NETWORK+X} ]; then - docker run -d -e VIRTUAL_HOST=$DOMAIN -e LETSENCRYPT_HOST=$DOMAIN --network=$NETWORK --name $NAME httpd:alpine -else - docker run -d -e VIRTUAL_HOST=$DOMAIN -e LETSENCRYPT_HOST=$DOMAIN --network=$SERVICE_NETWORK --name $NAME httpd:alpine -fi - -exit 0 diff --git a/test_stop.sh b/test_stop.sh deleted file mode 100755 index 065392a0..00000000 --- a/test_stop.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# Stop and remove test enviornment -docker stop test-web && docker rm test-web - -exit 0 From 11d2362a24486e47b57d276597560d55d315b958 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 15 Mar 2021 15:24:20 -0300 Subject: [PATCH 031/158] change basescript to http --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 715c8063..d68568a7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "basescript"] path = basescript - url = git@github.com:evertramos/basescript.git + url = https://github.com/evertramos/basescript.git From f1ae057624040c1ee4db8d3a5e8a137f92eeeb58 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 18 Mar 2021 21:52:22 -0300 Subject: [PATCH 032/158] Update checksum .env.sample file --- bin/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/.env b/bin/.env index 25e523a0..1c7a1222 100644 --- a/bin/.env +++ b/bin/.env @@ -57,4 +57,4 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # md5 checksum for .env and docker-compose.yml files # MD5_SUM_DOCKER_COMPOSE=5a9db4ac1b6fb25d683b8ed9929a7c42 -MD5_SUM_ENV_SAMPLE=2d6a35dc9d0ac8d31a3aa62b17e6e497 +MD5_SUM_ENV_SAMPLE=5b8d25f8a1b99d7220d10b2db4b12e72 From 8c995068c79b635316a34d3a119acad03c35433d Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 18 Mar 2021 21:52:34 -0300 Subject: [PATCH 033/158] Remove unused comments and fix typos --- bin/fresh-start.sh | 30 ++++++---------------------- bin/localscript/usage-fresh-start.sh | 2 +- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index e2e17e24..3abefb43 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -4,7 +4,7 @@ # # Fresh Start script - set up nginx-proxy in a fresh installed server # -# https://github.com/evertramos/docker-nginx-proxy-automation +# https://github.com/evertramos/nginx-proxy-automation # # Script developed by # Evert Ramos @@ -540,24 +540,6 @@ local_undo_restore() { ACTION_DOCKER_COMPOSE_STOPPED=false fi - # If site folder was created - # if [[ "$ACTION_SITE_PATH_CREATED" == true ]]; then - # [[ "$SILENT" != true ]] && echowarning "[undo] Creating site folder '$LOCAL_SITE_FULL_PATH'." - # # Remove folder - # run_function system_safe_delete_folder $LOCAL_SITE _FULL_PATH true - # ACTION_SITE_PATH_CREATED=false - # fi - - # If site domain was created - # if [[ "$ACTION_SITE_URL_CREATED" == true ]]; then - # [[ "$SILENT" != true ]] && echowarning "[undo] Creating site domain '$LOCAL_NEW_URL'." - # run_function domain_delete_domain_dns $LOCAL_NEW_URL - # ACTION_SITE_URL_CREATED=false - # if [[ "$WITH_WWW" == true ]]; then - # run_function domain_delete_domain_dns "www.$LOCAL_NEW_URL" - # fi - # fi - # exit 0 } @@ -703,7 +685,7 @@ if [[ "$DOCKER_CONTAINER_EXISTS" == true ]]; then [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_NGINX_PROXY_SERVICE_CONTAINER=true fi - # We kept STOP and REMOVE because the stop function will no break the script even if the container isn't running + # We kept STOP and REMOVE because the stop function will not break the script even if the container isn't running fi fi @@ -722,7 +704,7 @@ LOCAL_DEFAULT_LETSENCRYPT_SERVICE_NAME="letsencrypt-auto" if [[ $ARG_LETSENCRYPT_SERVICE_NAME == "" ]] && [[ ! "$REPLY_YES" == true ]]; then # Get user's response - run_function common_read_user_input "Please enter the nginx-proxy service name (default: $LOCAL_DEFAULT_LETSENCRYPT_SERVICE_NAME):" + run_function common_read_user_input "Please enter the letsencrypt service name (default: $LOCAL_DEFAULT_LETSENCRYPT_SERVICE_NAME):" LOCAL_LETSENCRYPT_SERVICE_NAME=${USER_INPUT_RESPONSE:-$LOCAL_DEFAULT_LETSENCRYPT_SERVICE_NAME} else @@ -773,7 +755,7 @@ if [[ "$DOCKER_CONTAINER_EXISTS" == true ]]; then [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_LETSENCRYPT_SERVICE_CONTAINER=true fi - # We kept STOP and REMOVE because the stop function will no break the script even if the container isn't running + # We kept STOP and REMOVE because the stop function will not break the script even if the container isn't running fi fi @@ -792,7 +774,7 @@ LOCAL_DEFAULT_DOCKER_GEN_SERVICE_NAME="docker-gen-auto" if [[ $ARG_DOCKER_GEN_SERVICE_NAME == "" ]] && [[ ! "$REPLY_YES" == true ]]; then # Get user's response - run_function common_read_user_input "Please enter the nginx-proxy service name (default: $LOCAL_DEFAULT_DOCKER_GEN_SERVICE_NAME):" + run_function common_read_user_input "Please enter the docker-gen service name (default: $LOCAL_DEFAULT_DOCKER_GEN_SERVICE_NAME):" LOCAL_DOCKER_GEN_SERVICE_NAME=${USER_INPUT_RESPONSE:-$LOCAL_DEFAULT_DOCKER_GEN_SERVICE_NAME} else @@ -843,7 +825,7 @@ if [[ "$DOCKER_CONTAINER_EXISTS" == true ]]; then [[ "$USER_ACTION_RESPONSE" == true ]] && LOCAL_STOP_AND_REMOVE_DOCKER_GEN_SERVICE_CONTAINER=true fi - # We kept STOP and REMOVE because the stop function will no break the script even if the container isn't running + # We kept STOP and REMOVE because the stop function will not break the script even if the container isn't running fi fi diff --git a/bin/localscript/usage-fresh-start.sh b/bin/localscript/usage-fresh-start.sh index a8291dc5..86d25b35 100755 --- a/bin/localscript/usage-fresh-start.sh +++ b/bin/localscript/usage-fresh-start.sh @@ -66,7 +66,7 @@ Usage: [--debug] Required - -e | --default-email Default email address require to issue tld + -e | --default-email Default email address require to issue ssl certificates with Let's Encrypt service Basic options From 75566ad3d17b48c39daec25c1c2915ac00e63e8f Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 18 Mar 2021 21:52:45 -0300 Subject: [PATCH 034/158] Add simple tests --- bin/ssl_test.sh | 31 +++++++++++++++++++++++++++++++ bin/test.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100755 bin/ssl_test.sh create mode 100755 bin/test.sh diff --git a/bin/ssl_test.sh b/bin/ssl_test.sh new file mode 100755 index 00000000..b43cd157 --- /dev/null +++ b/bin/ssl_test.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# +# test-proxy script - testing nginx-proxy +# +# https://github.com/evertramos/nginx-proxy-automation +# +# Script developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- + +# Set up your DOMAIN +if [ $# -eq 0 ]; then + echo "Please inform your domain name to test your proxy." + echo "./test.sh $1" + exit 1 +else + DOMAIN=$1 +fi + +# Read your .env file +source .env + +# Testing your proxy +docker run -d -e VIRTUAL_HOST=$DOMAIN -e LETSENCRYPT_HOST=$DOMAIN --network=$NETWORK --rm --name test-web httpd:alpine + +exit 0 diff --git a/bin/test.sh b/bin/test.sh new file mode 100755 index 00000000..4fcca2b6 --- /dev/null +++ b/bin/test.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# +# test-proxy script - testing nginx-proxy +# +# https://github.com/evertramos/nginx-proxy-automation +# +# Script developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- + +# Set up your DOMAIN +if [ $# -eq 0 ]; then + echo "Please inform your domain name to test your proxy." + echo "./test.sh $1" + exit 1 +else + DOMAIN=$1 +fi + +# Read your .env file +source .env + +# Testing your proxy +docker run -d -e VIRTUAL_HOST=$DOMAIN --network=$NETWORK --rm --name test-web httpd:alpine + +exit 0 From 99443ad73a797bdc515c6fd371c846234e049cca Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 18 Mar 2021 21:56:00 -0300 Subject: [PATCH 035/158] Update source and remove old container --- bin/ssl_test.sh | 6 +++++- bin/test.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/ssl_test.sh b/bin/ssl_test.sh index b43cd157..88514f21 100755 --- a/bin/ssl_test.sh +++ b/bin/ssl_test.sh @@ -23,7 +23,11 @@ else fi # Read your .env file -source .env +source ./../.env + +# Stop if test is running +docker stop test-web +docker rm test-web # Testing your proxy docker run -d -e VIRTUAL_HOST=$DOMAIN -e LETSENCRYPT_HOST=$DOMAIN --network=$NETWORK --rm --name test-web httpd:alpine diff --git a/bin/test.sh b/bin/test.sh index 4fcca2b6..e1df055a 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -23,7 +23,11 @@ else fi # Read your .env file -source .env +source ./../.env + +# Stop if test is running +docker stop test-web +docker rm test-web # Testing your proxy docker run -d -e VIRTUAL_HOST=$DOMAIN --network=$NETWORK --rm --name test-web httpd:alpine From 5770c339605f2965410833340cda03ff3f9cb6bc Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 18 Mar 2021 21:58:36 -0300 Subject: [PATCH 036/158] add stop and remove stop from testing --- bin/ssl_test.sh | 4 ---- bin/stop.sh | 20 ++++++++++++++++++++ bin/test.sh | 4 ---- 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100755 bin/stop.sh diff --git a/bin/ssl_test.sh b/bin/ssl_test.sh index 88514f21..31d8acec 100755 --- a/bin/ssl_test.sh +++ b/bin/ssl_test.sh @@ -25,10 +25,6 @@ fi # Read your .env file source ./../.env -# Stop if test is running -docker stop test-web -docker rm test-web - # Testing your proxy docker run -d -e VIRTUAL_HOST=$DOMAIN -e LETSENCRYPT_HOST=$DOMAIN --network=$NETWORK --rm --name test-web httpd:alpine diff --git a/bin/stop.sh b/bin/stop.sh new file mode 100755 index 00000000..fc5c97f2 --- /dev/null +++ b/bin/stop.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# +# test-proxy script - testing nginx-proxy +# +# https://github.com/evertramos/nginx-proxy-automation +# +# Script developed by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- + +# Stop if test is running +docker stop test-web +docker rm test-web + +exit 0 diff --git a/bin/test.sh b/bin/test.sh index e1df055a..61d94827 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -25,10 +25,6 @@ fi # Read your .env file source ./../.env -# Stop if test is running -docker stop test-web -docker rm test-web - # Testing your proxy docker run -d -e VIRTUAL_HOST=$DOMAIN --network=$NETWORK --rm --name test-web httpd:alpine From 7098d25bd7444959a64176b83234e69375502fdc Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 10:23:01 -0300 Subject: [PATCH 037/158] Update README.md --- .github/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/README.md b/.github/README.md index 3369fb91..efa5517b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -7,6 +7,12 @@ We strongly recommend you (:pray: please do!) to read all documentation. > To access the previous version of this project please access [version 0.4](https://github.com/evertramos/nginx-proxy-automation/tree/v0.4). +## Video Tutorial + +I made a 5 minutes video set up: + +[![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) + ## What this project does This script will set up your server with the *nginx-proxy*, which will enable you to host multiple sites, From ede5221668a74591a0fc195226e0a759eb9fbf61 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 11:28:18 -0300 Subject: [PATCH 038/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index efa5517b..05e6969f 100644 --- a/.github/README.md +++ b/.github/README.md @@ -9,7 +9,7 @@ We strongly recommend you (:pray: please do!) to read all documentation. ## Video Tutorial -I made a 5 minutes video set up: +I made a 5 minutes tutorial video: [![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) From a70cd382811b9e546a9a10affb79426c34a10081 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 13:07:51 -0300 Subject: [PATCH 039/158] remove container rm --- bin/stop.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/stop.sh b/bin/stop.sh index fc5c97f2..e66055fd 100755 --- a/bin/stop.sh +++ b/bin/stop.sh @@ -15,6 +15,5 @@ # Stop if test is running docker stop test-web -docker rm test-web exit 0 From 6c50a79e9fc72328f990def96a4bbdfd6a9b2a2e Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 13:09:52 -0300 Subject: [PATCH 040/158] Update basescript version --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index 02a8c210..d41ec7fd 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 02a8c2107bbb57fb86aa648f7d3dfd445c0ebfdb +Subproject commit d41ec7fd0a18465d5d131f724404f6b0ee13b814 From 6f92665340622834e1cf8a8de0647b0b3d5df1a0 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 13:53:57 -0300 Subject: [PATCH 041/158] Update ipv4 variable --- .env.sample | 2 +- bin/localscript/update-env-new-site-variables.sh | 2 +- docker-compose.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.sample b/.env.sample index cd543189..6adcfa8c 100644 --- a/.env.sample +++ b/.env.sample @@ -33,7 +33,7 @@ NGINX_PROXY_COMPANION_IMAGE_VERSION=2.0 # please make sure you use the correct address otherwise your proxy will not # work properly, '0.0.0.0' will work, but we recommend to update this variable # -IP=0.0.0.0 +IPv4=0.0.0.0 IPv6=::1 #----------------------------------------------------------------------- diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index b1a3ddd0..8a54025d 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -42,7 +42,7 @@ local_update_env_new_site_variables() run_function env_update_variable $LOCAL_FILE_PATH "NGINX_PROXY_COMPANION_IMAGE_VERSION" "$LETSENCRYPT_IMAGE_VERSION" # IPs - run_function env_update_variable $LOCAL_FILE_PATH "IP" "$IP_ADDRESS" + run_function env_update_variable $LOCAL_FILE_PATH "IPv4" "$IP_ADDRESS" [[ "$ACTIVATE_IPV6" == true ]] && run_function env_update_variable $LOCAL_FILE_PATH "IPv6" "$IPv6_ADDRESS" # Network diff --git a/docker-compose.yml b/docker-compose.yml index 54324096..5fa3deac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,8 +8,8 @@ services: container_name: ${NGINX_WEB:-nginx-proxy-automation-web} restart: always ports: - - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80" - - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" + - "${IPv4:-0.0.0.0}:${DOCKER_HTTP:-80}:80" + - "${IPv4:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" # - "${IPv6:-::/0}:80:80" # - "${IPv6:-::/0}:443:443" environment: From 4296a2d7b6135b9299815d988e86b060f4b4e5ca Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 13:56:37 -0300 Subject: [PATCH 042/158] Update docker-gen image --- .env.sample | 2 +- bin/.env | 2 +- bin/localscript/update-env-new-site-variables.sh | 2 +- docker-compose.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.env.sample b/.env.sample index 6adcfa8c..9be4a70c 100644 --- a/.env.sample +++ b/.env.sample @@ -19,7 +19,7 @@ NGINX_WEB=proxy-web NGINX_IMAGE_VERSION=stable-alpine -DOCKER_GEN=docker-gen +DOCKER_GEN_SEVICE_NAME=docker-gen DOCKER_GEN_IMAGE_VERSION=latest LETS_ENCRYPT=letsencrypt-companion diff --git a/bin/.env b/bin/.env index 1c7a1222..065891c2 100644 --- a/bin/.env +++ b/bin/.env @@ -57,4 +57,4 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # md5 checksum for .env and docker-compose.yml files # MD5_SUM_DOCKER_COMPOSE=5a9db4ac1b6fb25d683b8ed9929a7c42 -MD5_SUM_ENV_SAMPLE=5b8d25f8a1b99d7220d10b2db4b12e72 +MD5_SUM_ENV_SAMPLE=29b1e64f20482a5a78416b7993f6d670 diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index 8a54025d..3202d552 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -36,7 +36,7 @@ local_update_env_new_site_variables() # Docker servides and image versions run_function env_update_variable $LOCAL_FILE_PATH "NGINX_WEB" "$NGINX_PROXY_SERVICE_NAME" run_function env_update_variable $LOCAL_FILE_PATH "NGINX_IMAGE_VERSION" "$NGINX_PROXY_IMAGE_VERSION" - run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_GEN" "$DOCKER_GEN_SERVICE_NAME" + run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_GEN_SEVICE_NAME" "$DOCKER_GEN_SERVICE_NAME" run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_GEN_IMAGE_VERSION" "$DOCKER_GEN_IMAGE_VERSION" run_function env_update_variable $LOCAL_FILE_PATH "LETS_ENCRYPT" "$LETSENCRYPT_SERVICE_NAME" run_function env_update_variable $LOCAL_FILE_PATH "NGINX_PROXY_COMPANION_IMAGE_VERSION" "$LETSENCRYPT_IMAGE_VERSION" diff --git a/docker-compose.yml b/docker-compose.yml index 5fa3deac..0df1168a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: nginx-proxy-automation-gen: image: jwilder/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-latest} command: -notify-sighup ${NGINX_WEB:-nginx-proxy-automation-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf - container_name: ${DOCKER_GEN:-nginx-proxy-automation-gen} + container_name: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} restart: always volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d @@ -57,7 +57,7 @@ services: - ${NGINX_FILES_PATH:-./data}/acme.sh:/etc/acme.sh - /var/run/docker.sock:/var/run/docker.sock:ro environment: - NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN:-nginx-proxy-automation-gen} + NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} NGINX_PROXY_CONTAINER: ${NGINX_WEB:-nginx-proxy-automation-web} DEFAULT_EMAIL: ${DEFAULT_EMAIL:-mail@yourdomain.tld} logging: From e9e717b28b651537f3c620c1d45ea3274d3f884b Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 13:59:00 -0300 Subject: [PATCH 043/158] update nginx-proxy and letsencrypt service name variable --- .env.sample | 4 ++-- bin/.env | 2 +- bin/localscript/update-env-new-site-variables.sh | 4 ++-- docker-compose.yml | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.env.sample b/.env.sample index 9be4a70c..a9bd8407 100644 --- a/.env.sample +++ b/.env.sample @@ -16,13 +16,13 @@ # and the image version for each service, please note that if you use our script # we will replace the service name in docker-compose file with the container name # -NGINX_WEB=proxy-web +NGINX_WEB_SEVICE_NAME=proxy-web NGINX_IMAGE_VERSION=stable-alpine DOCKER_GEN_SEVICE_NAME=docker-gen DOCKER_GEN_IMAGE_VERSION=latest -LETS_ENCRYPT=letsencrypt-companion +LETS_ENCRYPT_SEVICE_NAME=letsencrypt-companion NGINX_PROXY_COMPANION_IMAGE_VERSION=2.0 #----------------------------------------------------------------------- diff --git a/bin/.env b/bin/.env index 065891c2..a455059e 100644 --- a/bin/.env +++ b/bin/.env @@ -57,4 +57,4 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # md5 checksum for .env and docker-compose.yml files # MD5_SUM_DOCKER_COMPOSE=5a9db4ac1b6fb25d683b8ed9929a7c42 -MD5_SUM_ENV_SAMPLE=29b1e64f20482a5a78416b7993f6d670 +MD5_SUM_ENV_SAMPLE=a24f8b55bc691fce5d1c49d89c5389ad diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index 3202d552..007c4599 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -34,11 +34,11 @@ local_update_env_new_site_variables() [[ "$DEBUG" == true ]] && echo "Updating all variables in .env file for nginx-proxy (file: ${LOCAL_FILE_PATH})" # Docker servides and image versions - run_function env_update_variable $LOCAL_FILE_PATH "NGINX_WEB" "$NGINX_PROXY_SERVICE_NAME" + run_function env_update_variable $LOCAL_FILE_PATH "NGINX_WEB_SEVICE_NAME" "$NGINX_PROXY_SERVICE_NAME" run_function env_update_variable $LOCAL_FILE_PATH "NGINX_IMAGE_VERSION" "$NGINX_PROXY_IMAGE_VERSION" run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_GEN_SEVICE_NAME" "$DOCKER_GEN_SERVICE_NAME" run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_GEN_IMAGE_VERSION" "$DOCKER_GEN_IMAGE_VERSION" - run_function env_update_variable $LOCAL_FILE_PATH "LETS_ENCRYPT" "$LETSENCRYPT_SERVICE_NAME" + run_function env_update_variable $LOCAL_FILE_PATH "LETS_ENCRYPT_SEVICE_NAME" "$LETSENCRYPT_SERVICE_NAME" run_function env_update_variable $LOCAL_FILE_PATH "NGINX_PROXY_COMPANION_IMAGE_VERSION" "$LETSENCRYPT_IMAGE_VERSION" # IPs diff --git a/docker-compose.yml b/docker-compose.yml index 0df1168a..79efc0ec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: nginx:${NGINX_IMAGE_VERSION:-stable-alpine} labels: com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" - container_name: ${NGINX_WEB:-nginx-proxy-automation-web} + container_name: ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} restart: always ports: - "${IPv4:-0.0.0.0}:${DOCKER_HTTP:-80}:80" @@ -28,7 +28,7 @@ services: nginx-proxy-automation-gen: image: jwilder/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-latest} - command: -notify-sighup ${NGINX_WEB:-nginx-proxy-automation-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf + command: -notify-sighup ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf container_name: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} restart: always volumes: @@ -47,7 +47,7 @@ services: nginx-proxy-automation-letsencrypt: image: jrcs/letsencrypt-nginx-proxy-companion:${NGINX_PROXY_COMPANION_IMAGE_VERSION:-2.0} - container_name: ${LETS_ENCRYPT:-nginx-proxy-automation-letsencrypt} + container_name: ${LETS_ENCRYPT_SEVICE_NAME:-nginx-proxy-automation-letsencrypt} restart: always volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d @@ -58,7 +58,7 @@ services: - /var/run/docker.sock:/var/run/docker.sock:ro environment: NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} - NGINX_PROXY_CONTAINER: ${NGINX_WEB:-nginx-proxy-automation-web} + NGINX_PROXY_CONTAINER: ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} DEFAULT_EMAIL: ${DEFAULT_EMAIL:-mail@yourdomain.tld} logging: driver: ${NGINX_LETSENCRYPT_LOG_DRIVER:-json-file} From 0ed88bed071a1ce200fd23a73a41f3ad25eb7238 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 14:08:21 -0300 Subject: [PATCH 044/158] Update http port variable and set port to ipv6 option --- .env.sample | 2 +- bin/.env | 2 +- bin/localscript/update-env-new-site-variables.sh | 2 +- docker-compose.yml | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.env.sample b/.env.sample index a9bd8407..56d94d64 100644 --- a/.env.sample +++ b/.env.sample @@ -86,7 +86,7 @@ NGINX_LETSENCRYPT_LOG_MAX_FILE=10 # where you might need to change http and https port number, keep in mind that changes # on that setting might will break the auto renewing Let's Encrypt certificate services # -DOCKER_HTTP=80 +DOCKER_HTTP_=80 DOCKER_HTTPS=443 #----------------------------------------------------------------------- diff --git a/bin/.env b/bin/.env index a455059e..e3c340a5 100644 --- a/bin/.env +++ b/bin/.env @@ -57,4 +57,4 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # md5 checksum for .env and docker-compose.yml files # MD5_SUM_DOCKER_COMPOSE=5a9db4ac1b6fb25d683b8ed9929a7c42 -MD5_SUM_ENV_SAMPLE=a24f8b55bc691fce5d1c49d89c5389ad +MD5_SUM_ENV_SAMPLE=c5b95cf10f4d510752602bb3f3939d6d diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index 007c4599..e09549b5 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -66,7 +66,7 @@ local_update_env_new_site_variables() run_function env_update_variable $LOCAL_FILE_PATH "NGINX_LETSENCRYPT_LOG_MAX_FILE" "$LETSENCRYPT_LOG_MAX_FILE" # Port bindings - run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_HTTP" "$DOCKER_HTTP" + run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_HTTP_" "$DOCKER_HTTP" run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_HTTPS" "$DOCKER_HTTPS" # SSL Policy diff --git a/docker-compose.yml b/docker-compose.yml index 79efc0ec..f9c781f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,10 +8,10 @@ services: container_name: ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} restart: always ports: - - "${IPv4:-0.0.0.0}:${DOCKER_HTTP:-80}:80" + - "${IPv4:-0.0.0.0}:${DOCKER_HTTP_:-80}:80" - "${IPv4:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" -# - "${IPv6:-::/0}:80:80" -# - "${IPv6:-::/0}:443:443" +# - "${IPv6:-::/0}:${DOCKER_HTTP_:-80}:80" +# - "${IPv6:-::/0}:${DOCKER_HTTPS:-443}:443" environment: SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} volumes: From 5027cfe9297e25c53f06bb899f57bfde03037d8b Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 14:11:28 -0300 Subject: [PATCH 045/158] update md5 for docker-compose --- bin/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/.env b/bin/.env index e3c340a5..fda57540 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=5a9db4ac1b6fb25d683b8ed9929a7c42 +MD5_SUM_DOCKER_COMPOSE=173dd5fe8088f758fa6062ad8c1faca9 MD5_SUM_ENV_SAMPLE=c5b95cf10f4d510752602bb3f3939d6d From 0d86250a9e0c505cde03807f71e78ec09c9f7d3d Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 14:11:48 -0300 Subject: [PATCH 046/158] set Mozilla-Modern if ssl policy is updated --- bin/fresh-start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 3abefb43..d5c4bdba 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -1081,12 +1081,12 @@ DOCKER_HTTP=${ARG_DOCKER_HTTP:-"80"} DOCKER_HTTPS=${ARG_DOCKER_HTTPS:-"443"} #----------------------------------------------------------------------- -# SSL policy (defaults to Mozilla-Intermediate) +# SSL policy (set to Mozilla-Modern) # # Please read the options at the url below: # https://github.com/nginx-proxy/nginx-proxy#how-ssl-support-works #----------------------------------------------------------------------- -SSL_POLICY=${ARG_SSL_POLICY:-"Mozilla-Intermediate"} +SSL_POLICY=${ARG_SSL_POLICY:-"Mozilla-Modern"} #----------------------------------------------------------------------- # Start actions! From 2e544e6f8c5e9d7773b128da504777c673ec72a5 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 14:22:36 -0300 Subject: [PATCH 047/158] set Mozilla-Intermediate if ssl policy as default --- bin/fresh-start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index d5c4bdba..98b27f8c 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -1081,12 +1081,12 @@ DOCKER_HTTP=${ARG_DOCKER_HTTP:-"80"} DOCKER_HTTPS=${ARG_DOCKER_HTTPS:-"443"} #----------------------------------------------------------------------- -# SSL policy (set to Mozilla-Modern) +# SSL policy (set to Mozilla-Intermediate) # # Please read the options at the url below: # https://github.com/nginx-proxy/nginx-proxy#how-ssl-support-works #----------------------------------------------------------------------- -SSL_POLICY=${ARG_SSL_POLICY:-"Mozilla-Modern"} +SSL_POLICY=${ARG_SSL_POLICY:-"Mozilla-Intermediate"} #----------------------------------------------------------------------- # Start actions! From bbe1f1ce6c256d4f20c8b70a76b77bd802b15632 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 14:22:51 -0300 Subject: [PATCH 048/158] Update IPv6 --- .env.sample | 2 +- bin/.env | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.sample b/.env.sample index 56d94d64..5668b1f3 100644 --- a/.env.sample +++ b/.env.sample @@ -34,7 +34,7 @@ NGINX_PROXY_COMPANION_IMAGE_VERSION=2.0 # work properly, '0.0.0.0' will work, but we recommend to update this variable # IPv4=0.0.0.0 -IPv6=::1 +IPv6=:: #----------------------------------------------------------------------- # diff --git a/bin/.env b/bin/.env index fda57540..f674c9df 100644 --- a/bin/.env +++ b/bin/.env @@ -57,4 +57,4 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # md5 checksum for .env and docker-compose.yml files # MD5_SUM_DOCKER_COMPOSE=173dd5fe8088f758fa6062ad8c1faca9 -MD5_SUM_ENV_SAMPLE=c5b95cf10f4d510752602bb3f3939d6d +MD5_SUM_ENV_SAMPLE=2b4d9183529cbf88974e19d9fd7ab803 From 7665c1d2d2ef0ac4dda1d9224741f406591f9442 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 19 Mar 2021 14:29:28 -0300 Subject: [PATCH 049/158] #256 Fix issue IPv6 --- .env.sample | 2 +- bin/.env | 4 ++-- bin/fresh-start.sh | 10 +++++----- docker-compose.yml | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.env.sample b/.env.sample index 5668b1f3..02efd7f7 100644 --- a/.env.sample +++ b/.env.sample @@ -34,7 +34,7 @@ NGINX_PROXY_COMPANION_IMAGE_VERSION=2.0 # work properly, '0.0.0.0' will work, but we recommend to update this variable # IPv4=0.0.0.0 -IPv6=:: +IPv6=::0 #----------------------------------------------------------------------- # diff --git a/bin/.env b/bin/.env index f674c9df..309b1ecf 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=173dd5fe8088f758fa6062ad8c1faca9 -MD5_SUM_ENV_SAMPLE=2b4d9183529cbf88974e19d9fd7ab803 +MD5_SUM_DOCKER_COMPOSE=2af4ea13a3a122898309cb154f64229c +MD5_SUM_ENV_SAMPLE=b299b584d68c1a6f7ac1b1a753a7517d diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 98b27f8c..3ac0c2d8 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -943,7 +943,7 @@ if [[ ! "$IP_IPV4" == true ]]; then echoerr "The IP address '$LOCAL_IP_ADDRESS' seems to be in wrong format. Please try again or keep the default value." local_undo_restore else - IP_ADDRESS=${LOCAL_IP_ADDRESS:-"::1"} + IP_ADDRESS=${LOCAL_IP_ADDRESS:-"0.0.0.0"} fi #----------------------------------------------------------------------- @@ -964,11 +964,11 @@ if [[ "$ACTIVATE_IPV6" == true ]]; then # Get user's response run_function common_read_user_input \ "Please enter the IP address (ipv6) that your server uses to connect to the internet. \ - \nYou might try the following '$IP_EXTERNAL_IPV6' (default: ::1):" + \nYou might try the following '$IP_EXTERNAL_IPV6' (default: ::0):" - LOCAL_IPv6_ADDRESS=${USER_INPUT_RESPONSE:-"::1"} + LOCAL_IPv6_ADDRESS=${USER_INPUT_RESPONSE:-"::0"} else - LOCAL_IPv6_ADDRESS=${ARG_IPv6_ADDRESS:-"::1"} + LOCAL_IPv6_ADDRESS=${ARG_IPv6_ADDRESS:-"::0"} fi # Check the IP address @@ -978,7 +978,7 @@ if [[ "$ACTIVATE_IPV6" == true ]]; then echoerr "The IP address '$LOCAL_IPv6_ADDRESS' seems to be in wrong format. Please try again or keep the default value." local_undo_restore else - IPv6_ADDRESS=${LOCAL_IPv6_ADDRESS:-"::1"} + IPv6_ADDRESS=${LOCAL_IPv6_ADDRESS:-"::0"} fi fi diff --git a/docker-compose.yml b/docker-compose.yml index f9c781f7..564e1ef2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,8 @@ services: ports: - "${IPv4:-0.0.0.0}:${DOCKER_HTTP_:-80}:80" - "${IPv4:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" -# - "${IPv6:-::/0}:${DOCKER_HTTP_:-80}:80" -# - "${IPv6:-::/0}:${DOCKER_HTTPS:-443}:443" +# - "${IPv6:-::0}:${DOCKER_HTTP_:-80}:80" +# - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" environment: SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} volumes: From 73bcb9b3c0e7fae9fca9ac773b68c9f386d4fe1e Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 08:08:30 -0300 Subject: [PATCH 050/158] Update FUNDING.yml --- .github/FUNDING.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 2783f12a..907027bd 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,13 @@ # These are supported funding model platforms +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: evertramos +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] + From ef3b55b27a5fbe603fcd1f110c50c266a292ef66 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 08:15:48 -0300 Subject: [PATCH 051/158] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 907027bd..6f150ab1 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,7 +2,7 @@ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: evertramos -open_collective: # Replace with a single Open Collective username +open_collective: nginx-proxy-automatio ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry From a4b79cd220f9ce18cdedc3aa076b7056db3646a2 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 13:24:00 -0300 Subject: [PATCH 052/158] Update README.md --- .github/README.md | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/README.md b/.github/README.md index 05e6969f..0368779f 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,27 +1,24 @@ # NGINX Proxy Automation -This project automates the [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy). -We strongly recommend you (:pray: please do!) to read all documentation. - -> To access the previous version of this project please access [version 0.4](https://github.com/evertramos/nginx-proxy-automation/tree/v0.4). +## What this project does +This script will _power up_ your new server with the [*nginx-proxy*](https://github.com/nginx-proxy/nginx-proxy), where you will be able to host multiple sites, +auto renewing LetΒ΄s Encrypt certificates! ❀️ -## Video Tutorial - -I made a 5 minutes tutorial video: +Something like: -[![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) +![Web Proxy environment](https://github.com/evertramos/images/raw/master/webproxy.jpg) -## What this project does +We strongly recommend you (please do! πŸ™) to read all documentation before starting in production as well as the [nginx-proxy docs](https://github.com/nginx-proxy/nginx-proxy). -This script will set up your server with the *nginx-proxy*, which will enable you to host multiple sites, -auto renewing LetΒ΄s Encrypt certificates. +> To access the previous version of this project please access [version 0.4](https://github.com/evertramos/nginx-proxy-automation/tree/v0.4). -Something like: +## Video Tutorial -![Web Proxy environment](https://github.com/evertramos/images/raw/master/webproxy.jpg) +I made a 5 minutes tutorial video to walk you through this project: +[![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) ## Prerequisites @@ -48,7 +45,7 @@ Also, you will need to make sure you have: ## How to use it -1. Clone this repository: +1. Clone this repository **using the option _--recurse-submodules_**: ```bash $ git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-automation.git proxy From 77dce29dc696fb44bdf48a7cdc01f7ad51bab2aa Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 13:25:42 -0300 Subject: [PATCH 053/158] Update README.md --- .github/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/README.md b/.github/README.md index 0368779f..09f1d18e 100644 --- a/.github/README.md +++ b/.github/README.md @@ -219,5 +219,7 @@ Credits goes to: - [@buchdag](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion/pull/226#event-1145800062) - [@fracz](https://github.com/fracz) - Many contributions! -# Support this project at [Patreon](https://www.patreon.com/evertramos) -[https://www.patreon.com/evertramos](https://www.patreon.com/evertramos) +### Just in case you are willing to support this project, you will find us at: + +[Patreon](https://www.patreon.com/evertramos) +[Open Collective](https://opencollective.com/nginx-proxy-automation) From ba4ed6047745b7d43d727371e5452f1b5d001caf Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 13:25:58 -0300 Subject: [PATCH 054/158] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 6f150ab1..4bd6c499 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,7 +2,7 @@ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: evertramos -open_collective: nginx-proxy-automatio +open_collective: nginx-proxy-automation ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry From 05c2eeb4481c5888ab7949b437a0e873f4c0e8bf Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 13:26:25 -0300 Subject: [PATCH 055/158] Update README.md --- .github/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/README.md b/.github/README.md index 09f1d18e..660b6209 100644 --- a/.github/README.md +++ b/.github/README.md @@ -222,4 +222,5 @@ Credits goes to: ### Just in case you are willing to support this project, you will find us at: [Patreon](https://www.patreon.com/evertramos) + [Open Collective](https://opencollective.com/nginx-proxy-automation) From 6e3dbb23ea7c73c986fef3b46326e530a6f27f6e Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 13:26:40 -0300 Subject: [PATCH 056/158] Update README.md --- .github/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/README.md b/.github/README.md index 660b6209..c4e4f6b4 100644 --- a/.github/README.md +++ b/.github/README.md @@ -221,6 +221,5 @@ Credits goes to: ### Just in case you are willing to support this project, you will find us at: -[Patreon](https://www.patreon.com/evertramos) - -[Open Collective](https://opencollective.com/nginx-proxy-automation) +- [Patreon](https://www.patreon.com/evertramos) +- [Open Collective](https://opencollective.com/nginx-proxy-automation) From bd82bb84f434582e22d66ad5f9f9adb370fb2baf Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 13:27:02 -0300 Subject: [PATCH 057/158] Update README.md --- .github/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/README.md b/.github/README.md index c4e4f6b4..244aeb48 100644 --- a/.github/README.md +++ b/.github/README.md @@ -221,5 +221,5 @@ Credits goes to: ### Just in case you are willing to support this project, you will find us at: -- [Patreon](https://www.patreon.com/evertramos) -- [Open Collective](https://opencollective.com/nginx-proxy-automation) +- [Patreon (evertramos)](https://www.patreon.com/evertramos) +- [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) From 1c994c9ed042ed86d4ab3d265977258c07573e55 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 20 Mar 2021 13:41:11 -0300 Subject: [PATCH 058/158] Create requirements.md --- docs/requirements.md | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 docs/requirements.md diff --git a/docs/requirements.md b/docs/requirements.md new file mode 100644 index 00000000..292cb11a --- /dev/null +++ b/docs/requirements.md @@ -0,0 +1,46 @@ +# Requirements to run this automation script + + +## Environment +- Linux + +## Softwares +- Bash +- Docker +- Docker Compose +- Git +- Curl +- Dpkg +- Md5sum + +## Used functions +- sudo +- source +- cd +- cp +- mv +- dirname +- type +- command +- systemctl +- echo +- printf +- read +- sed +- awk +- wget +- cat +- cut +- head +- tr +- grep +- rm +- trap +- dpkg +- tput +- md5sum +- ip +- git +- docker +- docker-compose +- curl From 372069bed3dc1e6c7f09f38883edfc94f9d97ed5 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 24 Mar 2021 08:23:58 -0300 Subject: [PATCH 059/158] #3 Use docker info to check if docker is running --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index d41ec7fd..2fcf41e0 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit d41ec7fd0a18465d5d131f724404f6b0ee13b814 +Subproject commit 2fcf41e019de1b794306feaeb7488a252454ea1d From 53838a806bd91407bf0bc9399d3b337a9c093067 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 24 Mar 2021 10:00:42 -0300 Subject: [PATCH 060/158] Update base script to check docker with docker info --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index 2fcf41e0..f6a4d39b 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 2fcf41e019de1b794306feaeb7488a252454ea1d +Subproject commit f6a4d39b1f729423be700b361e915b8c11f281e5 From cd349b1eff50f356adc9fcda75e810beeaccac85 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 24 Mar 2021 10:04:16 -0300 Subject: [PATCH 061/158] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..dd84ea78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..bbcbbe7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From d363439b7890642c95ff695a2de37f4c37a70208 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 24 Mar 2021 10:05:20 -0300 Subject: [PATCH 062/158] Delete ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index d05935ae..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ -# Error description: - - -# Steps to reproduce - - -# Expected result - - -# Error result - - -# Comments - - From 95883c7b5ac458c1c99a0b95cef40326f1bc2672 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 24 Mar 2021 10:14:25 -0300 Subject: [PATCH 063/158] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 21 ++++++++++----------- .github/ISSUE_TEMPLATE/feature_request.md | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea78..b2475e8f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,9 +1,9 @@ --- name: Bug report about: Create a report to help us improve -title: '' +title: "[BUG]" labels: '' -assignees: '' +assignees: evertramos --- @@ -23,16 +23,15 @@ A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] +**Server info (please complete the following information):** + - Linux release: [e.g. Ubuntu 20.10] + - Server type [e.g. vps, Raspberry Pi] + - Docker version [e.g. 20.10] + - docker-compose version [e.g. 1.27] -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] +**Logs (please send some logs):** + - nginx container + - letsencrypt container (if related to ssl) **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d..70f7aafe 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,9 +1,9 @@ --- name: Feature request about: Suggest an idea for this project -title: '' +title: "[FEATURE]" labels: '' -assignees: '' +assignees: evertramos --- From cfde7b7293040799aa0d8e6bb2b317895a77e928 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 24 Mar 2021 10:15:05 -0300 Subject: [PATCH 064/158] Update issue templates --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 70f7aafe..6c0a675d 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,7 @@ --- name: Feature request about: Suggest an idea for this project -title: "[FEATURE]" +title: '' labels: '' assignees: evertramos From 87c217dcd494c88c8ba2f131afbfc3bdb514b68b Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 24 Mar 2021 10:19:37 -0300 Subject: [PATCH 065/158] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index b2475e8f..5d790f24 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -21,7 +21,7 @@ Steps to reproduce the behavior: A clear and concise description of what you expected to happen. **Screenshots** -If applicable, add screenshots to help explain your problem. +If the error is in one of the scripts, an screen show will help a lot to identify which part of the script the error occurred. **Server info (please complete the following information):** - Linux release: [e.g. Ubuntu 20.10] From 08a8b719ae28808aa4ee6c3453b62938b816a077 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 29 Mar 2021 10:30:03 -0300 Subject: [PATCH 066/158] On '--yes' skip docker image check --- bin/fresh-start.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 3ac0c2d8..77538bac 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -856,7 +856,7 @@ NGINX_PROXY_IMAGE_VERSION=${ARG_NGINX_PROXY_IMAGE_VERSION:-$LOCAL_DEFAULT_NGINX_ #fi # Final check image a version with dockerhub -[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME $NGINX_PROXY_IMAGE_VERSION +[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME $NGINX_PROXY_IMAGE_VERSION #----------------------------------------------------------------------- # Let's Encrypt image version @@ -884,7 +884,7 @@ if [[ "$LETSENCRYPT_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_LETSENCRYPT_ fi # Final check image a version with dockerhub -[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME $LETSENCRYPT_IMAGE_VERSION +[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME $LETSENCRYPT_IMAGE_VERSION #----------------------------------------------------------------------- # docker-gen image version @@ -912,7 +912,7 @@ if [[ "$DOCKER_GEN_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_DOCKER_GEN_IM fi # Final check image a version with dockerhub -[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME $DOCKER_GEN_IMAGE_VERSION +[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME $DOCKER_GEN_IMAGE_VERSION #----------------------------------------------------------------------- # IP address (IPv4) From ecf920101c7e43b1e1aa4b9635c3e186ec4779fb Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 29 Mar 2021 10:44:47 -0300 Subject: [PATCH 067/158] Update README.md --- .github/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 244aeb48..022854ae 100644 --- a/.github/README.md +++ b/.github/README.md @@ -62,11 +62,12 @@ $ git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-autom $ cd proxy/bin $ ./fresh-start.sh ``` - This script will walk you through all config process. When it finishes you are good to go! :checkered_flag: +> If you are in a 'hurry' you could use just `$ ./fresh-start.sh --yes -e your_email@do` (please set your email) and your proxy will start it as soon as possible. + > You can check all available options to run the script `$ ./fresh-start.sh --help` 3. Fire your new site with the following options: From 04a4611cf4243797160a0cf99a92eed33ed3c8c0 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 30 Mar 2021 09:18:48 -0300 Subject: [PATCH 068/158] Update CONTRIBUTING.md --- .github/CONTRIBUTING.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 02c29f97..d906dc45 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,9 +1,16 @@ -### Contributions +## Contributions -All contributions regarding the `nginx.tmpl` should be suggested or implemented in the [nginx-proxy repository](https://raw.githubusercontent.com/jwilder/nginx-proxy). +### nginx.tmpl file + +All contributions regarding the `nginx.tmpl` should be suggested or implemented in the [nginx-proxy repository](https://github.com/nginx-proxy/nginx-proxy). We always use the latest version of this file: [https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl](https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl) +### Pull requests + +Sometimes it's better to start a discussion or an issue to find out the best solution of suggestion before sending a pull request... and if you do so, please test it with the automation script before sending new code. + + Thanks! From ec21dcfcab7a5dffb936306608c45d39405d271a Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 30 Mar 2021 13:12:29 -0300 Subject: [PATCH 069/158] Create upgrade-guide.md --- docs/upgrade-guide.md | 133 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 docs/upgrade-guide.md diff --git a/docs/upgrade-guide.md b/docs/upgrade-guide.md new file mode 100644 index 00000000..ba5d3c67 --- /dev/null +++ b/docs/upgrade-guide.md @@ -0,0 +1,133 @@ +# Upgrading guide + +Here we will try to cover all aspects we faced in a real production environment when migrating from the previous version of this project to the newst version. + +## From v0.4 to v0.5 + +The version v0.5 was a big step into automation. We 'conquer the world'! + +> I update one of the production server and got a _96 seconds_ of downtime, with no complaint from clients. +> Some of them did not even notice, but all were advised about the update and the possible downtime in case of failure. + +> If you can not afford this downtime there is a couple way around on this but you will need +a couple things... new server (temporary), set a dns rules to create the new certificates +copy all files to the new server and do the following, after all is ready, redirect the dns +to the new server and than copy the temp server to the production, fire all services, test +and redirect the dns to the new server. Be aware that changes made during this proccess might +need to be updated in the containers when syncing files from one server to another. + +So, let's go. First thing first! + +1. Backup EVERYTHING! I would suggest backup in the server and somewhere else (not in the server) + +2. Update the git repo with the new version (:warning:) + + 2.1 Copy _docker-compose.yml_ (or the _docker-compose-multiple-networks.yml_ if you used this option) and _.env_ file + + ```bash + $ cp docker-compose.yml docker-compose-old.yml + $ cp .env .env-old + ``` + + > We will use this do stop the current services + + 2.2 Reset all changes in the repo + + This is required to update to the latest version + + ```bash + $ git reset --hard + ``` + + 2.3 Checkout master + + ```bash + $ git checkout master + ``` + + 2.4 Set the **basescript** submodule + + If you notice the submodule folder used in this project ([basescript](https://github.com/evertramos/basescript/)) + is present in the master branch we just checkout, but it is empty, so we need to fix it (init and update). + + ```bash + $ cd basescript + $ git submodule init + $ git submodule update + ``` + + > The _basescript_ folder should not be empty after the commands above + +3. Run the _fresh-start.sh_ script (:construction:) + + Here we will run the _fresh-start.sh_ script in order to create all new settings that we will use. + Please do it carefully. You might use different names for proxy services. + + ```bash + $ cd bin + $ ./fresh-start.sh + ``` + + In most cases you will get the following _'error'_, which is expected: + + ![fresh-start-expected-error](https://user-images.githubusercontent.com/905951/113016796-33aaa080-9155-11eb-845d-aa712294236d.png) + + The error above is related to port binding, once port 80 is already binded to the current nginx-proxy container. + + > [IMPORTANT] If you use the *same service name* for all containers and the same network name you might not receive the error above + > and you should be ready to go at this point. Check the your running sites at the browser to see if everything is up and running. + + ⚠️ if you do not get the error above and your sites are NOT working, you might checkthe network name and go for the next item. + +4. Adding the running containers to the new network + + If you keep the same network name you might skip this item, but if not, you must add all running containers to the new network + created by the _fresh-start.sh_ script. + + ```bash + $ docker network connect [YOUR_NEW_NETWORK_NAME] [CONTAINER_NAME] + ``` + + > Run the command above for all containers connected to the proxy and remember to update the network name in the docker-compose file + > for the all sites + +5. Restart proxy with new service + + At this point all sites should be still up and running, so keep it cool and let's see if all will work as expected. + + After all containers are connected to the new proxy network (if the case) you will stop the current proxy services and start the new one. + We did it in one command line to reduce the downtime. + + ```bash + $ docker-compose --file docker-compose-old.yml down && docker-compose up -d + ``` + + Check your sites to see if it is all running, if some of them are not working, you might check the letsencrypt container logs to see if + there was a problem issuing new certificates. + + If something else happen and you must reverse it quickly just follow the next step. But try to check the logs first, it might take a few + minutes to fire new certificates with Let's Encrypt so, depending on the quantity of sites you are running in your server it might take + some time to issue it all. + +6. Reverting to the old proxy + + You can retore backup files and start the same exact environmen you had previously this upgrade guide, but there is a quicker way to restore your sites. + Just run the following: + + ```bash + $ docker-compose down && docker-compose --file docker-compose-old.yml --env-file .env-old up -d + ``` + + > The command above will stop the new version and fire the previous version of your proxy, so, after this command evertyhing should 'be back to normal' + > as it was before the update, but keep in mind to find the errors if they occured and update it. + +7. Clean up + + After having all work done you might remove unused file such as: + + + ```bash + $ rm docker-compose-old.yml .env-old + ``` + +> If you get any erros when updating please post on the [**upgrade discussion**](https://github.com/evertramos/basescript/discussions/5) (avoid creating new issues). From b2d5f6fad1b343092b2da275a6c732ed98b7f3a2 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 30 Mar 2021 14:27:10 -0300 Subject: [PATCH 070/158] Update upgrade-guide.md --- docs/upgrade-guide.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/upgrade-guide.md b/docs/upgrade-guide.md index ba5d3c67..d9a73123 100644 --- a/docs/upgrade-guide.md +++ b/docs/upgrade-guide.md @@ -39,9 +39,10 @@ So, let's go. First thing first! $ git reset --hard ``` - 2.3 Checkout master + 2.3 Pull and Checkout master ```bash + $ git pull origin master $ git checkout master ``` From ad49a1904b77921121f133784e51d93ed2b43620 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 30 Mar 2021 14:39:44 -0300 Subject: [PATCH 071/158] Upgrade guide --- .github/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/README.md b/.github/README.md index 022854ae..b3d6d5e2 100644 --- a/.github/README.md +++ b/.github/README.md @@ -14,6 +14,12 @@ We strongly recommend you (please do! πŸ™) to read all documentation before sta > To access the previous version of this project please access [version 0.4](https://github.com/evertramos/nginx-proxy-automation/tree/v0.4). +### Upgrading from previous version + +If you are upgrading from the previous version please follow the guide below carefully: + +https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/upgrade-guide.md + ## Video Tutorial I made a 5 minutes tutorial video to walk you through this project: From 37704da6781bb26210173e32e72b8bb21326cb86 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 30 Mar 2021 14:42:21 -0300 Subject: [PATCH 072/158] Update CONTRIBUTING.md --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d906dc45..3d96aaea 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ ## Contributions -### nginx.tmpl file +### NGINX template file (nginx.tmpl) All contributions regarding the `nginx.tmpl` should be suggested or implemented in the [nginx-proxy repository](https://github.com/nginx-proxy/nginx-proxy). From 9560390f01b50c2970973ab07d68318b5df021ca Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 30 Mar 2021 18:45:17 -0300 Subject: [PATCH 073/158] Our very first supporter! A special thanks for that!!! --- .github/sponsor.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/sponsor.md diff --git a/.github/sponsor.md b/.github/sponsor.md new file mode 100644 index 00000000..a51e5ed9 --- /dev/null +++ b/.github/sponsor.md @@ -0,0 +1,12 @@ +

Sponsors & Backers

+ +
+ + + +
+ + +

Automation Backers via Patreon

+ +- [Emanuele Rangan](https://github.com/emanuelerangan) From beda2a969fa1e5d2ef83844bc6c5d53cc7694920 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 30 Mar 2021 18:51:16 -0300 Subject: [PATCH 074/158] Add sponsor.md page --- .github/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/README.md b/.github/README.md index b3d6d5e2..59f2dc91 100644 --- a/.github/README.md +++ b/.github/README.md @@ -230,3 +230,7 @@ Credits goes to: - [Patreon (evertramos)](https://www.patreon.com/evertramos) - [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) + +### Current supporters, sponsors and backers + +Please access the page [Supporters, Sponsors and Backers](/.github/sponsor.md). From 6577df90c02526d5e161c4c1030cd13e183ecf2b Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 31 Mar 2021 11:25:11 -0300 Subject: [PATCH 075/158] Update README.md --- .github/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/README.md b/.github/README.md index 59f2dc91..35efbcf7 100644 --- a/.github/README.md +++ b/.github/README.md @@ -24,6 +24,8 @@ https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/upgrade-gu I made a 5 minutes tutorial video to walk you through this project: +Click [here](https://www.youtube.com/watch?v=E9BtHVr_v9I) to access the video or click the image below: + [![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) ## Prerequisites From 9e64bef19979fb534855c435194f560a515776bd Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 1 Apr 2021 04:42:30 -0300 Subject: [PATCH 076/158] Fix argument check --- bin/fresh-start.sh | 66 +++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 77538bac..7b88db9d 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -163,7 +163,7 @@ while [[ $# -gt 0 ]]; do # Network options -ip) ARG_IP_ADDRESS="${2}" - if [[ ARG_IP_ADDRESS == "" ]]; then + if [[ $ARG_IP_ADDRESS == "" ]]; then echoerr "Invalid option for -ip" break fi @@ -171,7 +171,7 @@ while [[ $# -gt 0 ]]; do ;; --ip-address=*) ARG_IP_ADDRESS="${1#*=}" - if [[ ARG_IP_ADDRESS == "" ]]; then + if [[ $ARG_IP_ADDRESS == "" ]]; then echoerr "Invalid option for --ip-address" break fi @@ -179,7 +179,7 @@ while [[ $# -gt 0 ]]; do ;; -ipv6) ARG_IPv6_ADDRESS="${2}" - if [[ ARG_IPv6_ADDRESS == "" ]]; then + if [[ $ARG_IPv6_ADDRESS == "" ]]; then echoerr "Invalid option for -ipv6" break fi @@ -187,7 +187,7 @@ while [[ $# -gt 0 ]]; do ;; --ipv6-address=*) ARG_IPv6_ADDRESS="${1#*=}" - if [[ ARG_IPv6_ADDRESS == "" ]]; then + if [[ $ARG_IPv6_ADDRESS == "" ]]; then echoerr "Invalid option for --ipv6-address" break fi @@ -195,7 +195,7 @@ while [[ $# -gt 0 ]]; do ;; -net) ARG_NETWORK_NAME="${2}" - if [[ ARG_NETWORK_NAME == "" ]]; then + if [[ $ARG_NETWORK_NAME == "" ]]; then echoerr "Invalid option for -net" break fi @@ -203,7 +203,7 @@ while [[ $# -gt 0 ]]; do ;; --network-name=*) ARG_NETWORK_NAME="${1#*=}" - if [[ ARG_NETWORK_NAME == "" ]]; then + if [[ $ARG_NETWORK_NAME == "" ]]; then echoerr "Invalid option for --network-name" break fi @@ -211,7 +211,7 @@ while [[ $# -gt 0 ]]; do ;; -netopt) NETWORK_OPTION="${2}" - if [[ NETWORK_OPTION == "" ]]; then + if [[ $NETWORK_OPTION == "" ]]; then echoerr "Invalid option for -netopt" break fi @@ -219,7 +219,7 @@ while [[ $# -gt 0 ]]; do ;; --network-option=*) NETWORK_OPTION="${1#*=}" - if [[ NETWORK_OPTION == "" ]]; then + if [[ $NETWORK_OPTION == "" ]]; then echoerr "Invalid option for --network-option" break fi @@ -229,7 +229,7 @@ while [[ $# -gt 0 ]]; do # Log settings -lpd) ARG_NGINX_PROXY_LOG_DRIVER="${2}" - if [[ ARG_NGINX_PROXY_LOG_DRIVER == "" ]]; then + if [[ $ARG_NGINX_PROXY_LOG_DRIVER == "" ]]; then echoerr "Invalid option for -lpd" break fi @@ -237,7 +237,7 @@ while [[ $# -gt 0 ]]; do ;; --log-nginx-proxy-driver=*) ARG_NGINX_PROXY_LOG_DRIVER="${1#*=}" - if [[ ARG_NGINX_PROXY_LOG_DRIVER == "" ]]; then + if [[ $ARG_NGINX_PROXY_LOG_DRIVER == "" ]]; then echoerr "Invalid option for --log-nginx-proxy-driver" break fi @@ -245,7 +245,7 @@ while [[ $# -gt 0 ]]; do ;; -lpms) ARG_NGINX_PROXY_LOG_MAX_SIZE="${2}" - if [[ ARG_NGINX_PROXY_LOG_MAX_SIZE == "" ]]; then + if [[ $ARG_NGINX_PROXY_LOG_MAX_SIZE == "" ]]; then echoerr "Invalid option for -lpms" break fi @@ -253,7 +253,7 @@ while [[ $# -gt 0 ]]; do ;; --log-nginx-proxy-max_size=*) ARG_NGINX_PROXY_LOG_MAX_SIZE="${1#*=}" - if [[ ARG_NGINX_PROXY_LOG_MAX_SIZE == "" ]]; then + if [[ $ARG_NGINX_PROXY_LOG_MAX_SIZE == "" ]]; then echoerr "Invalid option for --log-nginx-proxy-max_size" break fi @@ -261,7 +261,7 @@ while [[ $# -gt 0 ]]; do ;; -lpmf) ARG_NGINX_PROXY_LOG_MAX_FILE="${2}" - if [[ ARG_NGINX_PROXY_LOG_MAX_FILE == "" ]]; then + if [[ $ARG_NGINX_PROXY_LOG_MAX_FILE == "" ]]; then echoerr "Invalid option for -lpmf" break fi @@ -269,7 +269,7 @@ while [[ $# -gt 0 ]]; do ;; --log-nginx-proxy-max_file=*) ARG_NGINX_PROXY_LOG_MAX_FILE="${1#*=}" - if [[ ARG_NGINX_PROXY_LOG_MAX_FILE == "" ]]; then + if [[ $ARG_NGINX_PROXY_LOG_MAX_FILE == "" ]]; then echoerr "Invalid option for --log-nginx-proxy-max_file" break fi @@ -277,7 +277,7 @@ while [[ $# -gt 0 ]]; do ;; -lgd) ARG_DOCKER_GEN_LOG_DRIVER="${2}" - if [[ ARG_DOCKER_GEN_LOG_DRIVER == "" ]]; then + if [[ $ARG_DOCKER_GEN_LOG_DRIVER == "" ]]; then echoerr "Invalid option for -lgd" break fi @@ -285,7 +285,7 @@ while [[ $# -gt 0 ]]; do ;; --log-docker-gen-driver=*) ARG_DOCKER_GEN_LOG_DRIVER="${1#*=}" - if [[ ARG_DOCKER_GEN_LOG_DRIVER == "" ]]; then + if [[ $ARG_DOCKER_GEN_LOG_DRIVER == "" ]]; then echoerr "Invalid option for --log-docker-gen-driver" break fi @@ -293,7 +293,7 @@ while [[ $# -gt 0 ]]; do ;; -lgms) ARG_DOCKER_GEN_LOG_MAX_SIZE="${2}" - if [[ ARG_DOCKER_GEN_LOG_MAX_SIZE == "" ]]; then + if [[ $ARG_DOCKER_GEN_LOG_MAX_SIZE == "" ]]; then echoerr "Invalid option for -lgms" break fi @@ -301,7 +301,7 @@ while [[ $# -gt 0 ]]; do ;; --log-docker-gen-max_size=*) ARG_DOCKER_GEN_LOG_MAX_SIZE="${1#*=}" - if [[ ARG_DOCKER_GEN_LOG_MAX_SIZE == "" ]]; then + if [[ $ARG_DOCKER_GEN_LOG_MAX_SIZE == "" ]]; then echoerr "Invalid option for --log-docker-gen-max_size" break fi @@ -309,7 +309,7 @@ while [[ $# -gt 0 ]]; do ;; -lgmf) ARG_DOCKER_GEN_LOG_MAX_FILE="${2}" - if [[ ARG_DOCKER_GEN_LOG_MAX_FILE == "" ]]; then + if [[ $ARG_DOCKER_GEN_LOG_MAX_FILE == "" ]]; then echoerr "Invalid option for -lgmf" break fi @@ -317,7 +317,7 @@ while [[ $# -gt 0 ]]; do ;; --log-docker-gen-max_file=*) ARG_DOCKER_GEN_LOG_MAX_FILE="${1#*=}" - if [[ ARG_DOCKER_GEN_LOG_MAX_FILE == "" ]]; then + if [[ $ARG_DOCKER_GEN_LOG_MAX_FILE == "" ]]; then echoerr "Invalid option for --log-docker-gen-max_file" break fi @@ -325,7 +325,7 @@ while [[ $# -gt 0 ]]; do ;; -lld) ARG_LETSENCRYPT_LOG_DRIVER="${2}" - if [[ ARG_LETSENCRYPT_LOG_DRIVER == "" ]]; then + if [[ $ARG_LETSENCRYPT_LOG_DRIVER == "" ]]; then echoerr "Invalid option for -lld" break fi @@ -333,7 +333,7 @@ while [[ $# -gt 0 ]]; do ;; --log-letsencrypt-driver=*) ARG_LETSENCRYPT_LOG_DRIVER="${1#*=}" - if [[ ARG_LETSENCRYPT_LOG_DRIVER == "" ]]; then + if [[ $ARG_LETSENCRYPT_LOG_DRIVER == "" ]]; then echoerr "Invalid option for --log-letsencrypt-driver" break fi @@ -341,7 +341,7 @@ while [[ $# -gt 0 ]]; do ;; -llms) ARG_LETSENCRYPT_LOG_MAX_SIZE="${2}" - if [[ ARG_LETSENCRYPT_LOG_MAX_SIZE == "" ]]; then + if [[ $ARG_LETSENCRYPT_LOG_MAX_SIZE == "" ]]; then echoerr "Invalid option for -llms" break fi @@ -349,7 +349,7 @@ while [[ $# -gt 0 ]]; do ;; --log-letsencrypt-max_size=*) ARG_LETSENCRYPT_LOG_MAX_SIZE="${1#*=}" - if [[ ARG_LETSENCRYPT_LOG_MAX_SIZE == "" ]]; then + if [[ $ARG_LETSENCRYPT_LOG_MAX_SIZE == "" ]]; then echoerr "Invalid option for --log-letsencrypt-max_size" break fi @@ -357,7 +357,7 @@ while [[ $# -gt 0 ]]; do ;; -llmf) ARG_LETSENCRYPT_LOG_MAX_FILE="${2}" - if [[ ARG_LETSENCRYPT_LOG_MAX_FILE == "" ]]; then + if [[ $ARG_LETSENCRYPT_LOG_MAX_FILE == "" ]]; then echoerr "Invalid option for -llmf" break fi @@ -365,7 +365,7 @@ while [[ $# -gt 0 ]]; do ;; --log-letsencrypt-max_file=*) ARG_LETSENCRYPT_LOG_MAX_FILE="${1#*=}" - if [[ ARG_LETSENCRYPT_LOG_MAX_FILE == "" ]]; then + if [[ $ARG_LETSENCRYPT_LOG_MAX_FILE == "" ]]; then echoerr "Invalid option for --log-letsencrypt-max_file" break fi @@ -375,7 +375,7 @@ while [[ $# -gt 0 ]]; do # Port binginds -phttp) ARG_DOCKER_HTTP="${2}" - if [[ ARG_DOCKER_HTTP == "" ]]; then + if [[ $ARG_DOCKER_HTTP == "" ]]; then echoerr "Invalid option for -phttp" break fi @@ -383,7 +383,7 @@ while [[ $# -gt 0 ]]; do ;; --port-http=*) ARG_DOCKER_HTTP="${1#*=}" - if [[ ARG_DOCKER_HTTP == "" ]]; then + if [[ $ARG_DOCKER_HTTP == "" ]]; then echoerr "Invalid option for --port-http" break fi @@ -391,7 +391,7 @@ while [[ $# -gt 0 ]]; do ;; -phttps) ARG_DOCKER_HTTPS="${2}" - if [[ ARG_DOCKER_HTTPS == "" ]]; then + if [[ $ARG_DOCKER_HTTPS == "" ]]; then echoerr "Invalid option for -phttps" break fi @@ -399,7 +399,7 @@ while [[ $# -gt 0 ]]; do ;; --port-https=*) ARG_DOCKER_HTTPS="${1#*=}" - if [[ ARG_DOCKER_HTTPS == "" ]]; then + if [[ $ARG_DOCKER_HTTPS == "" ]]; then echoerr "Invalid option for --port-https" break fi @@ -409,7 +409,7 @@ while [[ $# -gt 0 ]]; do # SSL Policy -sp) ARG_SSL_POLICY="${2}" - if [[ ARG_SSL_POLICY == "" ]]; then + if [[ $ARG_SSL_POLICY == "" ]]; then echoerr "Invalid option for -sp" break fi @@ -417,7 +417,7 @@ while [[ $# -gt 0 ]]; do ;; --ssl-policy=*) ARG_SSL_POLICY="${1#*=}" - if [[ ARG_SSL_POLICY == "" ]]; then + if [[ $ARG_SSL_POLICY == "" ]]; then echoerr "Invalid option for --ssl-policy" break fi @@ -427,7 +427,7 @@ while [[ $# -gt 0 ]]; do # IPv6 options --ipv6-subnet=*) ARG_IPv6_SUBNET="${1#*=}" - if [[ ARG_IPv6_SUBNET == "" ]]; then + if [[ $ARG_IPv6_SUBNET == "" ]]; then echoerr "Invalid option for --ipv6-subnet" break fi From 54d078d708182c8abf45248cd0594f963d8d3dc9 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 2 Apr 2021 16:12:09 -0300 Subject: [PATCH 077/158] Update README.md --- .github/README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/README.md b/.github/README.md index 35efbcf7..74ef56a1 100644 --- a/.github/README.md +++ b/.github/README.md @@ -202,7 +202,7 @@ docker stop test-web && docker rm test-web Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/HOWTO-Synlogy.md). -## Production Environment using Web Proxy +## Other projects using nginx-proxy Following are links to docker containers using this web proxy: @@ -222,17 +222,11 @@ Credits goes to: - docker-gen [@jwilder](https://github.com/jwilder/docker-gen) - docker-letsencrypt-nginx-proxy-companion [@JrCs](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) -### Special thanks to: - -- [@j7an](https://github.com/j7an) - Many contributions and the ipv6 branch! -- [@buchdag](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion/pull/226#event-1145800062) -- [@fracz](https://github.com/fracz) - Many contributions! - ### Just in case you are willing to support this project, you will find us at: - [Patreon (evertramos)](https://www.patreon.com/evertramos) - [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) -### Current supporters, sponsors and backers +### List of all contributer, supporters, sponsors and backers Please access the page [Supporters, Sponsors and Backers](/.github/sponsor.md). From 4f35b7dc2ac6e9371bb76d490d67dd69db3d652c Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 2 Apr 2021 17:34:27 -0300 Subject: [PATCH 078/158] Delete sponsor.md --- .github/sponsor.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/sponsor.md diff --git a/.github/sponsor.md b/.github/sponsor.md deleted file mode 100644 index a51e5ed9..00000000 --- a/.github/sponsor.md +++ /dev/null @@ -1,12 +0,0 @@ -

Sponsors & Backers

- -
- - - -
- - -

Automation Backers via Patreon

- -- [Emanuele Rangan](https://github.com/emanuelerangan) From 097e696288a94e80b2716caf1547746f302de45f Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 2 Apr 2021 18:00:50 -0300 Subject: [PATCH 079/158] Update README.md --- .github/README.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/README.md b/.github/README.md index 74ef56a1..088687f7 100644 --- a/.github/README.md +++ b/.github/README.md @@ -140,9 +140,10 @@ docker network connect myownnetwork nginx-gen docker network connect myownnetwork nginx-letsencrypt ``` -3. Using different ports to be proxied +3. Ports -If your service container runs on port 8545 you probably will need to add the `VIRTUAL_PORT` environment variable to your container, in the `docker-compose.yml`, as of: +If your service container runs on port 8545 you probably will need to add the `VIRTUAL_PORT` environment variable to your container, +in the `docker-compose.yml`, so it can be proxied, as of: ```bash parity @@ -170,12 +171,12 @@ docker exec -it ${NGINX_WEB} nginx -s reload Where *${NGINX_WEB}* is your proxy container name, which in the original `.env` file is set as *nginx-web*. -## Testing your proxy with scripts preconfigured +## Testing nginx-proxy 1. Run the script `test.sh` informing your domain already configured in your DNS to point out to your server as follow: ```bash -./test_start_ssl.sh your.domain.com +./test.sh your.domain.com ``` or simply run: @@ -184,12 +185,14 @@ or simply run: docker run -dit -e VIRTUAL_HOST=your.domain.com --network=webproxy --name test-web httpd:alpine ``` +> If you want to test the Let's Encrypt certificate as well use `ssl_test.sh your.domain.com` + Access your browser with your domain! -To stop and remove your test container run our `stop_test.sh` script: +To stop and remove your test container run our `stop.sh` script: ```bash -./test_stop.sh +./stop.sh ``` Or simply run: @@ -198,10 +201,6 @@ Or simply run: docker stop test-web && docker rm test-web ``` -## Running this Proxy on a Synology NAS - -Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/HOWTO-Synlogy.md). - ## Other projects using nginx-proxy Following are links to docker containers using this web proxy: @@ -213,20 +212,24 @@ Following are links to docker containers using this web proxy: 5. [gitlab-docker-letsencrypt](https://github.com/steevepay/gitlab-docker-letsencrypt) 6. [docker-webtrees-letsencrypt](https://github.com/mstroppel/docker-webtrees-letsencrypt) +## Running this Proxy on a Synology NAS + +Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/HOWTO-Synlogy.md). + ## Credits -Without the repositories below this webproxy wouldnΒ΄t be possible. +Without the project below this proxy wouldnΒ΄t be possible: Credits goes to: -- nginx-proxy [@jwilder](https://github.com/jwilder/nginx-proxy) -- docker-gen [@jwilder](https://github.com/jwilder/docker-gen) -- docker-letsencrypt-nginx-proxy-companion [@JrCs](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) +- [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) by [@jwilder](https://github.com/jwilder) +- [docker-gen](https://github.com/jwilder/docker-gen) by [@jwilder](https://github.com/jwilder) +- [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) by [@JrCs](https://github.com/JrCs) -### Just in case you are willing to support this project, you will find us at: +## Just in case you are willing to support this project, you will find us at: - [Patreon (evertramos)](https://www.patreon.com/evertramos) - [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) -### List of all contributer, supporters, sponsors and backers +## List of all contributers, supporters, sponsors and backers Please access the page [Supporters, Sponsors and Backers](/.github/sponsor.md). From 79c6fb433bc7629dc81c41b15bcb10135f867c42 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 2 Apr 2021 18:01:52 -0300 Subject: [PATCH 080/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 088687f7..0c683631 100644 --- a/.github/README.md +++ b/.github/README.md @@ -218,7 +218,7 @@ Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automatio ## Credits -Without the project below this proxy wouldnΒ΄t be possible: +Without the projects below this proxy would be impossible: Credits goes to: - [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) by [@jwilder](https://github.com/jwilder) From e9bdcdd143ecbd35ae560c64a941be4444e44f8c Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 2 Apr 2021 18:02:27 -0300 Subject: [PATCH 081/158] Update README.md --- .github/README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/README.md b/.github/README.md index 0c683631..40cdbcc5 100644 --- a/.github/README.md +++ b/.github/README.md @@ -202,9 +202,7 @@ docker stop test-web && docker rm test-web ``` ## Other projects using nginx-proxy - Following are links to docker containers using this web proxy: - 1. [docker-wordpress-letsencrypt](https://github.com/evertramos/docker-wordpress-letsencrypt) 2. [docker-portainer-letsencrypt](https://github.com/evertramos/docker-portainer-letsencrypt) 3. [docker-nextcloud-letsencrypt](https://github.com/evertramos/docker-nextcloud-letsencrypt) @@ -213,23 +211,17 @@ Following are links to docker containers using this web proxy: 6. [docker-webtrees-letsencrypt](https://github.com/mstroppel/docker-webtrees-letsencrypt) ## Running this Proxy on a Synology NAS - Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/HOWTO-Synlogy.md). ## Credits - Without the projects below this proxy would be impossible: - -Credits goes to: - [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) by [@jwilder](https://github.com/jwilder) - [docker-gen](https://github.com/jwilder/docker-gen) by [@jwilder](https://github.com/jwilder) - [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) by [@JrCs](https://github.com/JrCs) ## Just in case you are willing to support this project, you will find us at: - - [Patreon (evertramos)](https://www.patreon.com/evertramos) - [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) ## List of all contributers, supporters, sponsors and backers - Please access the page [Supporters, Sponsors and Backers](/.github/sponsor.md). From f815fc1910609a51ccd71d43de915e7f7fa55931 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 2 Apr 2021 18:35:32 -0300 Subject: [PATCH 082/158] Update README.md --- .github/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/README.md b/.github/README.md index 40cdbcc5..7f833b02 100644 --- a/.github/README.md +++ b/.github/README.md @@ -201,6 +201,12 @@ Or simply run: docker stop test-web && docker rm test-web ``` +## **PRODUCTION** ⚠️ [IMPORTANT] + +If you are using this project in production enviroment, check all license involved and consider the following recomendation: + +- [rootless docker](https://docs.docker.com/engine/security/rootless/) + ## Other projects using nginx-proxy Following are links to docker containers using this web proxy: 1. [docker-wordpress-letsencrypt](https://github.com/evertramos/docker-wordpress-letsencrypt) From cfdc3a54ee9f79784fcb8963aaf8b4f02e043b12 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 2 Apr 2021 18:37:01 -0300 Subject: [PATCH 083/158] Update README.md --- .github/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 7f833b02..5596a4e5 100644 --- a/.github/README.md +++ b/.github/README.md @@ -225,7 +225,8 @@ Without the projects below this proxy would be impossible: - [docker-gen](https://github.com/jwilder/docker-gen) by [@jwilder](https://github.com/jwilder) - [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) by [@JrCs](https://github.com/JrCs) -## Just in case you are willing to support this project, you will find us at: +## Supporting | Sponsoring β™₯️ +In case you are willing to support this project, check: - [Patreon (evertramos)](https://www.patreon.com/evertramos) - [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) From 0ad7630b5abe40d2283fd3c18f5ba5b2ec2b5515 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 2 Apr 2021 18:45:49 -0300 Subject: [PATCH 084/158] Update README.md --- .github/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/README.md b/.github/README.md index 5596a4e5..1fbd009d 100644 --- a/.github/README.md +++ b/.github/README.md @@ -206,6 +206,7 @@ docker stop test-web && docker rm test-web If you are using this project in production enviroment, check all license involved and consider the following recomendation: - [rootless docker](https://docs.docker.com/engine/security/rootless/) +- [docker compose files](https://docs.docker.com/compose/production/) ## Other projects using nginx-proxy Following are links to docker containers using this web proxy: From 67f946f9db312c8c0ead6c9fdd1d977091da9ef0 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 4 Apr 2021 13:50:26 -0300 Subject: [PATCH 085/158] Update upgrade-guide.md --- docs/upgrade-guide.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/upgrade-guide.md b/docs/upgrade-guide.md index d9a73123..26498cec 100644 --- a/docs/upgrade-guide.md +++ b/docs/upgrade-guide.md @@ -52,7 +52,6 @@ So, let's go. First thing first! is present in the master branch we just checkout, but it is empty, so we need to fix it (init and update). ```bash - $ cd basescript $ git submodule init $ git submodule update ``` From 01329283343703747a5e47416d7b5e26eb9cadda Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 4 Apr 2021 15:01:46 -0300 Subject: [PATCH 086/158] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 5d790f24..925b4449 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,6 +7,8 @@ assignees: evertramos --- +**Check [Discussions](https://github.com/evertramos/nginx-proxy-automation/discussions) to see if there is an answer might help you before opening an issue** + **Describe the bug** A clear and concise description of what the bug is. From 06eccec0273ded391a526e515d48b917d50da336 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 21 Apr 2021 07:10:31 -0300 Subject: [PATCH 087/158] Add IPv6 option to nginx proxy container --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 564e1ef2..de379d46 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: # - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" environment: SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} +# ENABLE_IPV6: "true" volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d From dd13a2c6a8937b662f366c8f826101fc27e2c0b3 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 21 Apr 2021 07:11:36 -0300 Subject: [PATCH 088/158] Comment out and uncomment the 'IPv6' and 'IPV6' option in docker-compose file --- bin/localscript/update-docker-compose-file.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/localscript/update-docker-compose-file.sh b/bin/localscript/update-docker-compose-file.sh index dfebce6c..586d3d79 100755 --- a/bin/localscript/update-docker-compose-file.sh +++ b/bin/localscript/update-docker-compose-file.sh @@ -39,8 +39,8 @@ local_update_docker_compose_file() run_function docker_compose_replace_string $LOCAL_FULL_PATH "$REPLACE_LETSENCRYPT_SERVICE_NAME" "$LETSENCRYPT_SERVICE_NAME" # Uncomment in case of IPv6 activation or uncomment - [[ "$ACTIVATE_IPV6" == true ]] && run_function file_uncomment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPv6" - [[ ! "$ACTIVATE_IPV6" == true ]] && run_function file_comment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPv6" + [[ "$ACTIVATE_IPV6" == true ]] && run_function file_uncomment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPv6" && run_function file_uncomment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPV6" + [[ ! "$ACTIVATE_IPV6" == true ]] && run_function file_comment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPv6" && run_function file_comment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPV6" # We are aware that it will set two '#' if the IPv6 is already commented return 0 From e2cdccacbde69ca44e413b69148ed047dfeeb492 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 21 Apr 2021 07:20:22 -0300 Subject: [PATCH 089/158] Update with latest version of basescript --- basescript | 2 +- bin/fresh-start.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/basescript b/basescript index f6a4d39b..93b17988 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit f6a4d39b1f729423be700b361e915b8c11f281e5 +Subproject commit 93b179881beb34aba786b1ff7f4bb9db0e6b0ca0 diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 7b88db9d..169ee7c8 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -1002,7 +1002,7 @@ else fi # Validate the name -run_function string_remove_all_special_char_string $LOCAL_DOCKER_NETWORK_NAME +run_function string_remove_all_special_char_string $LOCAL_DOCKER_NETWORK_NAME "-_" DOCKER_NETWORK_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} [[ $DOCKER_NETWORK_NAME == null ]] && echoerr "The network name can not contain special chars, neither be empty" From fd6deac4360e49f3cbab69a75a45b61fa69fe641 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 21 Apr 2021 07:33:35 -0300 Subject: [PATCH 090/158] Allow services name to use dash and underscore --- bin/fresh-start.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 169ee7c8..bf2c98c5 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -642,7 +642,7 @@ else fi # Validate the name -run_function string_remove_all_special_char_string $LOCAL_NGINX_PROXY_SERVICE_NAME +run_function string_remove_all_special_char_string $LOCAL_NGINX_PROXY_SERVICE_NAME "-_" NGINX_PROXY_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} [[ $NGINX_PROXY_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" @@ -712,7 +712,7 @@ else fi # Validate the name -run_function string_remove_all_special_char_string $LOCAL_LETSENCRYPT_SERVICE_NAME +run_function string_remove_all_special_char_string $LOCAL_LETSENCRYPT_SERVICE_NAME "-_" LETSENCRYPT_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} [[ $LETSENCRYPT_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" @@ -782,7 +782,7 @@ else fi # Validate the name -run_function string_remove_all_special_char_string $LOCAL_DOCKER_GEN_SERVICE_NAME +run_function string_remove_all_special_char_string $LOCAL_DOCKER_GEN_SERVICE_NAME "-_" DOCKER_GEN_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} [[ $DOCKER_GEN_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" From 22a7241c8940d4f1dbf44a9d7009df9a2c0c4dd1 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 29 Apr 2021 05:44:31 -0300 Subject: [PATCH 091/158] Add logging system to nginx-proxy --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index 93b17988..f2ef3d00 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 93b179881beb34aba786b1ff7f4bb9db0e6b0ca0 +Subproject commit f2ef3d00f0eea7ed07921fd597f3fad6ec14f48c From f76ec4895f6032975ea18a3c8f3501e30b129703 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 29 Apr 2021 05:46:00 -0300 Subject: [PATCH 092/158] Add logging system to nginx-proxy-automation --- bin/fresh-start.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index bf2c98c5..3d35651e 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -26,6 +26,10 @@ source $SCRIPT_PATH"/../basescript/bootstrap.sh" # Source localscripts source $SCRIPT_PATH"/localscript/bootstrap.sh" +# Log +log "Start execution" +log "$@" + #----------------------------------------------------------------------- # Process arguments #----------------------------------------------------------------------- From 4fb682fb7548172f9058b2408b88fe5aed282ffe Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 29 Apr 2021 06:05:43 -0300 Subject: [PATCH 093/158] update logging system --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index f2ef3d00..83ca05fd 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit f2ef3d00f0eea7ed07921fd597f3fad6ec14f48c +Subproject commit 83ca05fd6b4ec98a8e6759fef4fae64d8dc90968 From 02531342aaf7df3c60f8bcabfd7f349df4dbdd6e Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 5 May 2021 08:06:05 -0300 Subject: [PATCH 094/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 1fbd009d..b4e82f8e 100644 --- a/.github/README.md +++ b/.github/README.md @@ -232,4 +232,4 @@ In case you are willing to support this project, check: - [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) ## List of all contributers, supporters, sponsors and backers -Please access the page [Supporters, Sponsors and Backers](/.github/sponsor.md). +Please access the page [Supporters, Sponsors and Backers](https://github.com/evertramos/evertramos/blob/main/pages/supporters.md). From c018b3678f55168d7a113c2f879bc3652eeff60a Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 7 May 2021 13:32:50 -0300 Subject: [PATCH 095/158] Update messaging system with a more neat version --- basescript | 2 +- bin/fresh-start.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/basescript b/basescript index 83ca05fd..c34e1d91 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 83ca05fd6b4ec98a8e6759fef4fae64d8dc90968 +Subproject commit c34e1d91f0672fb4af99b4cbfe6bcafc5453f1ac diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 3d35651e..b685a09a 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -27,6 +27,7 @@ source $SCRIPT_PATH"/../basescript/bootstrap.sh" source $SCRIPT_PATH"/localscript/bootstrap.sh" # Log +printf "${energy} Start execution '${SCRIPT_PATH}/${SCRIPT_NAME} " log "Start execution" log "$@" From eb39cdfd9cde04ffd5242e8d967237d987dc1a29 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 7 May 2021 13:42:39 -0300 Subject: [PATCH 096/158] Update README.md --- .github/README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/README.md b/.github/README.md index b4e82f8e..c69dc555 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,5 +1,5 @@ -# NGINX Proxy Automation +# NGINX Proxy Automation πŸ”₯ ## What this project does @@ -30,13 +30,13 @@ Click [here](https://www.youtube.com/watch?v=E9BtHVr_v9I) to access the video or ## Prerequisites -1. Linux! 🐧 (just in case...) +1. 🐧 Linux! (just in case...) > Please check all requirements at [requirements](/docs/requirements.md). In order to use this compose file (docker-compose.yml) you must have: -2. Docker installed (https://docs.docker.com/engine/installation/) +2. πŸ‹ Docker installed (https://docs.docker.com/engine/installation/) 3. Docker-compose installed (https://docs.docker.com/compose/install/) @@ -64,7 +64,7 @@ $ git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-autom > Please note we use 'proxy' as folder at the end. But you can change it to whatever fits you better -2. Run the script 'fresh_start.sh' +2. πŸš€ Run the script 'fresh_start.sh' ```bash $ cd proxy/bin @@ -74,9 +74,11 @@ This script will walk you through all config process. When it finishes you are good to go! :checkered_flag: -> If you are in a 'hurry' you could use just `$ ./fresh-start.sh --yes -e your_email@do` (please set your email) and your proxy will start it as soon as possible. +> ✈️ If you are in a 'hurry' you could use just `$ ./fresh-start.sh --yes -e your_email@do` (please set your email) and your proxy will start it as soon as possible. -> You can check all available options to run the script `$ ./fresh-start.sh --help` +> ⚠️ You can check all available options to run the script `$ ./fresh-start.sh --help` + +> πŸ—’οΈ From version _v0.3_ the script will output logs to _/var/log/basescript.log_ 3. Fire your new site with the following options: @@ -226,10 +228,10 @@ Without the projects below this proxy would be impossible: - [docker-gen](https://github.com/jwilder/docker-gen) by [@jwilder](https://github.com/jwilder) - [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) by [@JrCs](https://github.com/JrCs) -## Supporting | Sponsoring β™₯️ +## Supporting β™₯️ In case you are willing to support this project, check: - [Patreon (evertramos)](https://www.patreon.com/evertramos) - [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) -## List of all contributers, supporters, sponsors and backers -Please access the page [Supporters, Sponsors and Backers](https://github.com/evertramos/evertramos/blob/main/pages/supporters.md). +## List of all supporters +Please access the page [Supporters](https://github.com/evertramos/evertramos/blob/main/pages/supporters.md). From 41d3e6f2f3a5bd3fff921aacb0d0810462559ed3 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 7 May 2021 13:45:50 -0300 Subject: [PATCH 097/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index c69dc555..f03b7310 100644 --- a/.github/README.md +++ b/.github/README.md @@ -74,7 +74,7 @@ This script will walk you through all config process. When it finishes you are good to go! :checkered_flag: -> ✈️ If you are in a 'hurry' you could use just `$ ./fresh-start.sh --yes -e your_email@do` (please set your email) and your proxy will start it as soon as possible. +> ✈️ If you are in a 'hurry' just run `$ ./fresh-start.sh --yes -e your_email@domain --skip-docker-image-check` > ⚠️ You can check all available options to run the script `$ ./fresh-start.sh --help` From e0eed024925811f3b3e00a3403f41ed4d9e6a751 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 7 May 2021 15:16:33 -0300 Subject: [PATCH 098/158] Update basescript --- docker-compose.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index de379d46..ced6b447 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,20 @@ version: '3' services: - nginx-proxy-automation-web: + proxy-web-auto: image: nginx:${NGINX_IMAGE_VERSION:-stable-alpine} labels: com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" - container_name: ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} + container_name: ${NGINX_WEB_SEVICE_NAME:-proxy-web-auto} restart: always ports: - "${IPv4:-0.0.0.0}:${DOCKER_HTTP_:-80}:80" - "${IPv4:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" -# - "${IPv6:-::0}:${DOCKER_HTTP_:-80}:80" -# - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" +## - "${IPv6:-::0}:${DOCKER_HTTP_:-80}:80" +## - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" environment: SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} -# ENABLE_IPV6: "true" +## ENABLE_IPV6: "true" volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d @@ -27,10 +27,10 @@ services: max-size: ${NGINX_WEB_LOG_MAX_SIZE:-4m} max-file: ${NGINX_WEB_LOG_MAX_FILE:-10} - nginx-proxy-automation-gen: + docker-gen-auto: image: jwilder/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-latest} - command: -notify-sighup ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf - container_name: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} + command: -notify-sighup ${NGINX_WEB_SEVICE_NAME:-proxy-web-auto} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf + container_name: ${DOCKER_GEN_SEVICE_NAME:-docker-gen-auto} restart: always volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d @@ -46,9 +46,9 @@ services: max-size: ${NGINX_GEN_LOG_MAX_SIZE:-2m} max-file: ${NGINX_GEN_LOG_MAX_FILE:-10} - nginx-proxy-automation-letsencrypt: + letsencrypt-auto: image: jrcs/letsencrypt-nginx-proxy-companion:${NGINX_PROXY_COMPANION_IMAGE_VERSION:-2.0} - container_name: ${LETS_ENCRYPT_SEVICE_NAME:-nginx-proxy-automation-letsencrypt} + container_name: ${LETS_ENCRYPT_SEVICE_NAME:-letsencrypt-auto} restart: always volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d @@ -58,8 +58,8 @@ services: - ${NGINX_FILES_PATH:-./data}/acme.sh:/etc/acme.sh - /var/run/docker.sock:/var/run/docker.sock:ro environment: - NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} - NGINX_PROXY_CONTAINER: ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} + NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN_SEVICE_NAME:-docker-gen-auto} + NGINX_PROXY_CONTAINER: ${NGINX_WEB_SEVICE_NAME:-proxy-web-auto} DEFAULT_EMAIL: ${DEFAULT_EMAIL:-mail@yourdomain.tld} logging: driver: ${NGINX_LETSENCRYPT_LOG_DRIVER:-json-file} From a4b29ab2e514cd42096de1cec4ad3e8d72463ace Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 7 May 2021 15:19:35 -0300 Subject: [PATCH 099/158] Update basescript --- basescript | 2 +- docker-compose.yml | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/basescript b/basescript index c34e1d91..bdee7a72 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit c34e1d91f0672fb4af99b4cbfe6bcafc5453f1ac +Subproject commit bdee7a72d3dc8fc3596190f5ddb1fb27c44151fc diff --git a/docker-compose.yml b/docker-compose.yml index ced6b447..24e73a14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,20 @@ version: '3' services: - proxy-web-auto: + nginx-proxy-automation-web: image: nginx:${NGINX_IMAGE_VERSION:-stable-alpine} labels: - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" - container_name: ${NGINX_WEB_SEVICE_NAME:-proxy-web-auto} + com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" + container_name: ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} restart: always ports: - "${IPv4:-0.0.0.0}:${DOCKER_HTTP_:-80}:80" - "${IPv4:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" -## - "${IPv6:-::0}:${DOCKER_HTTP_:-80}:80" -## - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" + # - "${IPv6:-::0}:${DOCKER_HTTP_:-80}:80" + # - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" environment: SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} -## ENABLE_IPV6: "true" + # ENABLE_IPV6: "true" volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d @@ -27,10 +27,10 @@ services: max-size: ${NGINX_WEB_LOG_MAX_SIZE:-4m} max-file: ${NGINX_WEB_LOG_MAX_FILE:-10} - docker-gen-auto: + nginx-proxy-automation-gen: image: jwilder/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-latest} - command: -notify-sighup ${NGINX_WEB_SEVICE_NAME:-proxy-web-auto} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf - container_name: ${DOCKER_GEN_SEVICE_NAME:-docker-gen-auto} + command: -notify-sighup ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf + container_name: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} restart: always volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d @@ -46,9 +46,9 @@ services: max-size: ${NGINX_GEN_LOG_MAX_SIZE:-2m} max-file: ${NGINX_GEN_LOG_MAX_FILE:-10} - letsencrypt-auto: + nginx-proxy-automation-letsencrypt: image: jrcs/letsencrypt-nginx-proxy-companion:${NGINX_PROXY_COMPANION_IMAGE_VERSION:-2.0} - container_name: ${LETS_ENCRYPT_SEVICE_NAME:-letsencrypt-auto} + container_name: ${LETS_ENCRYPT_SEVICE_NAME:-nginx-proxy-automation-letsencrypt} restart: always volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d @@ -58,8 +58,8 @@ services: - ${NGINX_FILES_PATH:-./data}/acme.sh:/etc/acme.sh - /var/run/docker.sock:/var/run/docker.sock:ro environment: - NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN_SEVICE_NAME:-docker-gen-auto} - NGINX_PROXY_CONTAINER: ${NGINX_WEB_SEVICE_NAME:-proxy-web-auto} + NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} + NGINX_PROXY_CONTAINER: ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} DEFAULT_EMAIL: ${DEFAULT_EMAIL:-mail@yourdomain.tld} logging: driver: ${NGINX_LETSENCRYPT_LOG_DRIVER:-json-file} @@ -71,3 +71,4 @@ networks: default: external: name: ${NETWORK:-proxy} + From 15fdbee502eb45f23a3a9913d38beffd6bcbc637 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 7 May 2021 15:20:23 -0300 Subject: [PATCH 100/158] remove extra space --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 24e73a14..30052651 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,11 +10,11 @@ services: ports: - "${IPv4:-0.0.0.0}:${DOCKER_HTTP_:-80}:80" - "${IPv4:-0.0.0.0}:${DOCKER_HTTPS:-443}:443" - # - "${IPv6:-::0}:${DOCKER_HTTP_:-80}:80" - # - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" +# - "${IPv6:-::0}:${DOCKER_HTTP_:-80}:80" +# - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" environment: SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} - # ENABLE_IPV6: "true" +# ENABLE_IPV6: "true" volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d From d2866110043718bc3b17820b2d9995f944097207 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 7 May 2021 15:24:04 -0300 Subject: [PATCH 101/158] update echoerror function name --- bin/fresh-start.sh | 132 +++++++++--------- bin/localscript/update-docker-compose-file.sh | 2 +- .../update-env-new-site-variables.sh | 2 +- 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index b685a09a..e944b086 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -39,7 +39,7 @@ while [[ $# -gt 0 ]]; do -d) ARG_DATA_LOCATION="${2}" if [[ $ARG_DATA_LOCATION == "" ]]; then - echoerr "Invalid option for -d" + echoerror "Invalid option for -d" break fi shift 2 @@ -47,7 +47,7 @@ while [[ $# -gt 0 ]]; do --data-files-location=*) ARG_DATA_LOCATION="${1#*=}" if [[ $ARG_DATA_LOCATION == "" ]]; then - echoerr "Invalid option for --data-files-location=''" + echoerror "Invalid option for --data-files-location=''" break fi shift 1 @@ -55,7 +55,7 @@ while [[ $# -gt 0 ]]; do -e) ARG_DEFAULT_EMAIL="${2}" if [[ $ARG_DEFAULT_EMAIL == "" ]]; then - echoerr "Invalid option for -e" + echoerror "Invalid option for -e" break fi shift 2 @@ -63,7 +63,7 @@ while [[ $# -gt 0 ]]; do --default-email=*) ARG_DEFAULT_EMAIL="${1#*=}" if [[ $ARG_DEFAULT_EMAIL == "" ]]; then - echoerr "Invalid option for --default-email=''" + echoerror "Invalid option for --default-email=''" break fi shift 1 @@ -71,7 +71,7 @@ while [[ $# -gt 0 ]]; do -pn) ARG_NGINX_PROXY_SERVICE_NAME="${2}" if [[ $ARG_NGINX_PROXY_SERVICE_NAME == "" ]]; then - echoerr "Invalid option for -pn" + echoerror "Invalid option for -pn" break fi shift 2 @@ -79,7 +79,7 @@ while [[ $# -gt 0 ]]; do --proxy-name=*) ARG_NGINX_PROXY_SERVICE_NAME="${1#*=}" if [[ $ARG_NGINX_PROXY_SERVICE_NAME == "" ]]; then - echoerr "Invalid option for --proxy-name=''" + echoerror "Invalid option for --proxy-name=''" break fi shift 1 @@ -87,7 +87,7 @@ while [[ $# -gt 0 ]]; do -ln) ARG_LETSENCRYPT_SERVICE_NAME="${2}" if [[ $ARG_LETSENCRYPT_SERVICE_NAME == "" ]]; then - echoerr "Invalid option for -ln" + echoerror "Invalid option for -ln" break fi shift 2 @@ -95,7 +95,7 @@ while [[ $# -gt 0 ]]; do --letsencrypt-name=*) ARG_LETSENCRYPT_SERVICE_NAME="${1#*=}" if [[ $ARG_LETSENCRYPT_SERVICE_NAME == "" ]]; then - echoerr "Invalid option for --letsencrypt-name=''" + echoerror "Invalid option for --letsencrypt-name=''" break fi shift 1 @@ -103,7 +103,7 @@ while [[ $# -gt 0 ]]; do -gn) ARG_DOCKER_GEN_SERVICE_NAME="${2}" if [[ $ARG_DOCKER_GEN_SERVICE_NAME == "" ]]; then - echoerr "Invalid option for -gn" + echoerror "Invalid option for -gn" break fi shift 2 @@ -111,7 +111,7 @@ while [[ $# -gt 0 ]]; do --docker-gen-name=*) ARG_DOCKER_GEN_SERVICE_NAME="${1#*=}" if [[ $ARG_DOCKER_GEN_SERVICE_NAME == "" ]]; then - echoerr "Invalid option for --docker-gen-name=''" + echoerror "Invalid option for --docker-gen-name=''" break fi shift 1 @@ -119,7 +119,7 @@ while [[ $# -gt 0 ]]; do -piv) ARG_NGINX_PROXY_IMAGE_VERSION="${2}" if [[ $ARG_NGINX_PROXY_IMAGE_VERSION == "" ]]; then - echoerr "Invalid option for -pversion" + echoerror "Invalid option for -pversion" break fi shift 2 @@ -127,7 +127,7 @@ while [[ $# -gt 0 ]]; do --proxy-image-version=*) ARG_NGINX_PROXY_IMAGE_VERSION="${1#*=}" if [[ $ARG_NGINX_PROXY_IMAGE_VERSION == "" ]]; then - echoerr "Invalid option for --proxy-image-version=''" + echoerror "Invalid option for --proxy-image-version=''" break fi shift 1 @@ -135,7 +135,7 @@ while [[ $# -gt 0 ]]; do -liv) ARG_LETSENCRYPT_IMAGE_VERSION="${2}" if [[ $ARG_LETSENCRYPT_IMAGE_VERSION == "" ]]; then - echoerr "Invalid option for -liv" + echoerror "Invalid option for -liv" break fi shift 2 @@ -143,7 +143,7 @@ while [[ $# -gt 0 ]]; do --letsencrypt-image-version=*) ARG_LETSENCRYPT_IMAGE_VERSION="${1#*=}" if [[ $ARG_LETSENCRYPT_IMAGE_VERSION == "" ]]; then - echoerr "Invalid option for --letsencrypt-image-version=''" + echoerror "Invalid option for --letsencrypt-image-version=''" break fi shift 1 @@ -151,7 +151,7 @@ while [[ $# -gt 0 ]]; do -giv) ARG_DOCKER_GEN_IMAGE_VERSION="${2}" if [[ $ARG_DOCKER_GEN_IMAGE_VERSION == "" ]]; then - echoerr "Invalid option for -giv" + echoerror "Invalid option for -giv" break fi shift 2 @@ -159,7 +159,7 @@ while [[ $# -gt 0 ]]; do --docker-gen-image-version=*) ARG_DOCKER_GEN_IMAGE_VERSION="${1#*=}" if [[ $ARG_DOCKER_GEN_IMAGE_VERSION == "" ]]; then - echoerr "Invalid option for --docker-gen-image-version=''" + echoerror "Invalid option for --docker-gen-image-version=''" break fi shift 1 @@ -169,7 +169,7 @@ while [[ $# -gt 0 ]]; do -ip) ARG_IP_ADDRESS="${2}" if [[ $ARG_IP_ADDRESS == "" ]]; then - echoerr "Invalid option for -ip" + echoerror "Invalid option for -ip" break fi shift 2 @@ -177,7 +177,7 @@ while [[ $# -gt 0 ]]; do --ip-address=*) ARG_IP_ADDRESS="${1#*=}" if [[ $ARG_IP_ADDRESS == "" ]]; then - echoerr "Invalid option for --ip-address" + echoerror "Invalid option for --ip-address" break fi shift 1 @@ -185,7 +185,7 @@ while [[ $# -gt 0 ]]; do -ipv6) ARG_IPv6_ADDRESS="${2}" if [[ $ARG_IPv6_ADDRESS == "" ]]; then - echoerr "Invalid option for -ipv6" + echoerror "Invalid option for -ipv6" break fi shift 2 @@ -193,7 +193,7 @@ while [[ $# -gt 0 ]]; do --ipv6-address=*) ARG_IPv6_ADDRESS="${1#*=}" if [[ $ARG_IPv6_ADDRESS == "" ]]; then - echoerr "Invalid option for --ipv6-address" + echoerror "Invalid option for --ipv6-address" break fi shift 1 @@ -201,7 +201,7 @@ while [[ $# -gt 0 ]]; do -net) ARG_NETWORK_NAME="${2}" if [[ $ARG_NETWORK_NAME == "" ]]; then - echoerr "Invalid option for -net" + echoerror "Invalid option for -net" break fi shift 2 @@ -209,7 +209,7 @@ while [[ $# -gt 0 ]]; do --network-name=*) ARG_NETWORK_NAME="${1#*=}" if [[ $ARG_NETWORK_NAME == "" ]]; then - echoerr "Invalid option for --network-name" + echoerror "Invalid option for --network-name" break fi shift 1 @@ -217,7 +217,7 @@ while [[ $# -gt 0 ]]; do -netopt) NETWORK_OPTION="${2}" if [[ $NETWORK_OPTION == "" ]]; then - echoerr "Invalid option for -netopt" + echoerror "Invalid option for -netopt" break fi shift 2 @@ -225,7 +225,7 @@ while [[ $# -gt 0 ]]; do --network-option=*) NETWORK_OPTION="${1#*=}" if [[ $NETWORK_OPTION == "" ]]; then - echoerr "Invalid option for --network-option" + echoerror "Invalid option for --network-option" break fi shift 1 @@ -235,7 +235,7 @@ while [[ $# -gt 0 ]]; do -lpd) ARG_NGINX_PROXY_LOG_DRIVER="${2}" if [[ $ARG_NGINX_PROXY_LOG_DRIVER == "" ]]; then - echoerr "Invalid option for -lpd" + echoerror "Invalid option for -lpd" break fi shift 2 @@ -243,7 +243,7 @@ while [[ $# -gt 0 ]]; do --log-nginx-proxy-driver=*) ARG_NGINX_PROXY_LOG_DRIVER="${1#*=}" if [[ $ARG_NGINX_PROXY_LOG_DRIVER == "" ]]; then - echoerr "Invalid option for --log-nginx-proxy-driver" + echoerror "Invalid option for --log-nginx-proxy-driver" break fi shift 1 @@ -251,7 +251,7 @@ while [[ $# -gt 0 ]]; do -lpms) ARG_NGINX_PROXY_LOG_MAX_SIZE="${2}" if [[ $ARG_NGINX_PROXY_LOG_MAX_SIZE == "" ]]; then - echoerr "Invalid option for -lpms" + echoerror "Invalid option for -lpms" break fi shift 2 @@ -259,7 +259,7 @@ while [[ $# -gt 0 ]]; do --log-nginx-proxy-max_size=*) ARG_NGINX_PROXY_LOG_MAX_SIZE="${1#*=}" if [[ $ARG_NGINX_PROXY_LOG_MAX_SIZE == "" ]]; then - echoerr "Invalid option for --log-nginx-proxy-max_size" + echoerror "Invalid option for --log-nginx-proxy-max_size" break fi shift 1 @@ -267,7 +267,7 @@ while [[ $# -gt 0 ]]; do -lpmf) ARG_NGINX_PROXY_LOG_MAX_FILE="${2}" if [[ $ARG_NGINX_PROXY_LOG_MAX_FILE == "" ]]; then - echoerr "Invalid option for -lpmf" + echoerror "Invalid option for -lpmf" break fi shift 2 @@ -275,7 +275,7 @@ while [[ $# -gt 0 ]]; do --log-nginx-proxy-max_file=*) ARG_NGINX_PROXY_LOG_MAX_FILE="${1#*=}" if [[ $ARG_NGINX_PROXY_LOG_MAX_FILE == "" ]]; then - echoerr "Invalid option for --log-nginx-proxy-max_file" + echoerror "Invalid option for --log-nginx-proxy-max_file" break fi shift 1 @@ -283,7 +283,7 @@ while [[ $# -gt 0 ]]; do -lgd) ARG_DOCKER_GEN_LOG_DRIVER="${2}" if [[ $ARG_DOCKER_GEN_LOG_DRIVER == "" ]]; then - echoerr "Invalid option for -lgd" + echoerror "Invalid option for -lgd" break fi shift 2 @@ -291,7 +291,7 @@ while [[ $# -gt 0 ]]; do --log-docker-gen-driver=*) ARG_DOCKER_GEN_LOG_DRIVER="${1#*=}" if [[ $ARG_DOCKER_GEN_LOG_DRIVER == "" ]]; then - echoerr "Invalid option for --log-docker-gen-driver" + echoerror "Invalid option for --log-docker-gen-driver" break fi shift 1 @@ -299,7 +299,7 @@ while [[ $# -gt 0 ]]; do -lgms) ARG_DOCKER_GEN_LOG_MAX_SIZE="${2}" if [[ $ARG_DOCKER_GEN_LOG_MAX_SIZE == "" ]]; then - echoerr "Invalid option for -lgms" + echoerror "Invalid option for -lgms" break fi shift 2 @@ -307,7 +307,7 @@ while [[ $# -gt 0 ]]; do --log-docker-gen-max_size=*) ARG_DOCKER_GEN_LOG_MAX_SIZE="${1#*=}" if [[ $ARG_DOCKER_GEN_LOG_MAX_SIZE == "" ]]; then - echoerr "Invalid option for --log-docker-gen-max_size" + echoerror "Invalid option for --log-docker-gen-max_size" break fi shift 1 @@ -315,7 +315,7 @@ while [[ $# -gt 0 ]]; do -lgmf) ARG_DOCKER_GEN_LOG_MAX_FILE="${2}" if [[ $ARG_DOCKER_GEN_LOG_MAX_FILE == "" ]]; then - echoerr "Invalid option for -lgmf" + echoerror "Invalid option for -lgmf" break fi shift 2 @@ -323,7 +323,7 @@ while [[ $# -gt 0 ]]; do --log-docker-gen-max_file=*) ARG_DOCKER_GEN_LOG_MAX_FILE="${1#*=}" if [[ $ARG_DOCKER_GEN_LOG_MAX_FILE == "" ]]; then - echoerr "Invalid option for --log-docker-gen-max_file" + echoerror "Invalid option for --log-docker-gen-max_file" break fi shift 1 @@ -331,7 +331,7 @@ while [[ $# -gt 0 ]]; do -lld) ARG_LETSENCRYPT_LOG_DRIVER="${2}" if [[ $ARG_LETSENCRYPT_LOG_DRIVER == "" ]]; then - echoerr "Invalid option for -lld" + echoerror "Invalid option for -lld" break fi shift 2 @@ -339,7 +339,7 @@ while [[ $# -gt 0 ]]; do --log-letsencrypt-driver=*) ARG_LETSENCRYPT_LOG_DRIVER="${1#*=}" if [[ $ARG_LETSENCRYPT_LOG_DRIVER == "" ]]; then - echoerr "Invalid option for --log-letsencrypt-driver" + echoerror "Invalid option for --log-letsencrypt-driver" break fi shift 1 @@ -347,7 +347,7 @@ while [[ $# -gt 0 ]]; do -llms) ARG_LETSENCRYPT_LOG_MAX_SIZE="${2}" if [[ $ARG_LETSENCRYPT_LOG_MAX_SIZE == "" ]]; then - echoerr "Invalid option for -llms" + echoerror "Invalid option for -llms" break fi shift 2 @@ -355,7 +355,7 @@ while [[ $# -gt 0 ]]; do --log-letsencrypt-max_size=*) ARG_LETSENCRYPT_LOG_MAX_SIZE="${1#*=}" if [[ $ARG_LETSENCRYPT_LOG_MAX_SIZE == "" ]]; then - echoerr "Invalid option for --log-letsencrypt-max_size" + echoerror "Invalid option for --log-letsencrypt-max_size" break fi shift 1 @@ -363,7 +363,7 @@ while [[ $# -gt 0 ]]; do -llmf) ARG_LETSENCRYPT_LOG_MAX_FILE="${2}" if [[ $ARG_LETSENCRYPT_LOG_MAX_FILE == "" ]]; then - echoerr "Invalid option for -llmf" + echoerror "Invalid option for -llmf" break fi shift 2 @@ -371,7 +371,7 @@ while [[ $# -gt 0 ]]; do --log-letsencrypt-max_file=*) ARG_LETSENCRYPT_LOG_MAX_FILE="${1#*=}" if [[ $ARG_LETSENCRYPT_LOG_MAX_FILE == "" ]]; then - echoerr "Invalid option for --log-letsencrypt-max_file" + echoerror "Invalid option for --log-letsencrypt-max_file" break fi shift 1 @@ -381,7 +381,7 @@ while [[ $# -gt 0 ]]; do -phttp) ARG_DOCKER_HTTP="${2}" if [[ $ARG_DOCKER_HTTP == "" ]]; then - echoerr "Invalid option for -phttp" + echoerror "Invalid option for -phttp" break fi shift 2 @@ -389,7 +389,7 @@ while [[ $# -gt 0 ]]; do --port-http=*) ARG_DOCKER_HTTP="${1#*=}" if [[ $ARG_DOCKER_HTTP == "" ]]; then - echoerr "Invalid option for --port-http" + echoerror "Invalid option for --port-http" break fi shift 1 @@ -397,7 +397,7 @@ while [[ $# -gt 0 ]]; do -phttps) ARG_DOCKER_HTTPS="${2}" if [[ $ARG_DOCKER_HTTPS == "" ]]; then - echoerr "Invalid option for -phttps" + echoerror "Invalid option for -phttps" break fi shift 2 @@ -405,7 +405,7 @@ while [[ $# -gt 0 ]]; do --port-https=*) ARG_DOCKER_HTTPS="${1#*=}" if [[ $ARG_DOCKER_HTTPS == "" ]]; then - echoerr "Invalid option for --port-https" + echoerror "Invalid option for --port-https" break fi shift 1 @@ -415,7 +415,7 @@ while [[ $# -gt 0 ]]; do -sp) ARG_SSL_POLICY="${2}" if [[ $ARG_SSL_POLICY == "" ]]; then - echoerr "Invalid option for -sp" + echoerror "Invalid option for -sp" break fi shift 2 @@ -423,7 +423,7 @@ while [[ $# -gt 0 ]]; do --ssl-policy=*) ARG_SSL_POLICY="${1#*=}" if [[ $ARG_SSL_POLICY == "" ]]; then - echoerr "Invalid option for --ssl-policy" + echoerror "Invalid option for --ssl-policy" break fi shift 1 @@ -433,7 +433,7 @@ while [[ $# -gt 0 ]]; do --ipv6-subnet=*) ARG_IPv6_SUBNET="${1#*=}" if [[ $ARG_IPv6_SUBNET == "" ]]; then - echoerr "Invalid option for --ipv6-subnet" + echoerror "Invalid option for --ipv6-subnet" break fi shift 1 @@ -472,7 +472,7 @@ while [[ $# -gt 0 ]]; do exit 0 ;; *) - echoerr "Unknown argument: $1" false + echoerror "Unknown argument: $1" false usage exit 0 ;; @@ -505,7 +505,7 @@ local_undo_restore() { LOCAL_KEEP_RESTORE_FILES=${1:-$KEEP_RESTORE_FILES} - echoerr \ + echoerror \ "It seems something went wrong running '${FUNCNAME[0]}' \ \nwe will try to UNDO all actions done by this script. \ \nPlease make sure everything was put it back in place." false @@ -561,7 +561,7 @@ local_check_docker_hub_image_version() { run_function dockerhub_check_image_exists $LOCAL_DOCKER_IMAGE_NAME if [[ "$DOCKERHUB_IMAGE_EXISTS" != true ]]; then - echoerr "It seems the image '$LOCAL_DOCKER_IMAGE_NAME' does not exist in docker hub (https://hub.docker.com) or the site is down. Wait a few minutes and try again." false + echoerror "It seems the image '$LOCAL_DOCKER_IMAGE_NAME' does not exist in docker hub (https://hub.docker.com) or the site is down. Wait a few minutes and try again." false local_undo_restore fi @@ -569,7 +569,7 @@ local_check_docker_hub_image_version() { run_function dockerhub_check_image_exists $LOCAL_DOCKER_IMAGE_NAME $LOCAL_DOCKER_IMAGE_VERSION if [[ "$DOCKERHUB_IMAGE_EXISTS" != true ]]; then - echoerr "It seems the image '$LOCAL_DOCKER_IMAGE_NAME:$LOCAL_DOCKER_IMAGE_VERSION' does not exist in docker hub (https://hub.docker.com) or the site is down. Wait a few minutes and try again." false + echoerror "It seems the image '$LOCAL_DOCKER_IMAGE_NAME:$LOCAL_DOCKER_IMAGE_VERSION' does not exist in docker hub (https://hub.docker.com) or the site is down. Wait a few minutes and try again." false local_undo_restore fi } @@ -649,7 +649,7 @@ fi # Validate the name run_function string_remove_all_special_char_string $LOCAL_NGINX_PROXY_SERVICE_NAME "-_" NGINX_PROXY_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} -[[ $NGINX_PROXY_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" +[[ $NGINX_PROXY_SERVICE_NAME == null ]] && echoerror "The service name can not contain special chars, neither be empty" # Check exists a container with this name run_function docker_check_container_exists $NGINX_PROXY_SERVICE_NAME @@ -719,7 +719,7 @@ fi # Validate the name run_function string_remove_all_special_char_string $LOCAL_LETSENCRYPT_SERVICE_NAME "-_" LETSENCRYPT_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} -[[ $LETSENCRYPT_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" +[[ $LETSENCRYPT_SERVICE_NAME == null ]] && echoerror "The service name can not contain special chars, neither be empty" # Check exists a container with this name run_function docker_check_container_exists $LETSENCRYPT_SERVICE_NAME @@ -789,7 +789,7 @@ fi # Validate the name run_function string_remove_all_special_char_string $LOCAL_DOCKER_GEN_SERVICE_NAME "-_" DOCKER_GEN_SERVICE_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} -[[ $DOCKER_GEN_SERVICE_NAME == null ]] && echoerr "The service name can not contain special chars, neither be empty" +[[ $DOCKER_GEN_SERVICE_NAME == null ]] && echoerror "The service name can not contain special chars, neither be empty" # Check exists a container with this name run_function docker_check_container_exists $DOCKER_GEN_SERVICE_NAME @@ -857,7 +857,7 @@ NGINX_PROXY_IMAGE_VERSION=${ARG_NGINX_PROXY_IMAGE_VERSION:-$LOCAL_DEFAULT_NGINX_ #fi # #if [[ "$NGINX_PROXY_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME" == null ]]; then -# echoerr "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" +# echoerror "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" #fi # Final check image a version with dockerhub @@ -885,7 +885,7 @@ else fi if [[ "$LETSENCRYPT_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION" == null ]]; then - echoerr "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" + echoerror "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" fi # Final check image a version with dockerhub @@ -913,7 +913,7 @@ else fi if [[ "$DOCKER_GEN_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION" == null ]]; then - echoerr "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" + echoerror "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" fi # Final check image a version with dockerhub @@ -945,7 +945,7 @@ fi run_function ip_check_ipv4 $LOCAL_IP_ADDRESS if [[ ! "$IP_IPV4" == true ]]; then - echoerr "The IP address '$LOCAL_IP_ADDRESS' seems to be in wrong format. Please try again or keep the default value." + echoerror "The IP address '$LOCAL_IP_ADDRESS' seems to be in wrong format. Please try again or keep the default value." local_undo_restore else IP_ADDRESS=${LOCAL_IP_ADDRESS:-"0.0.0.0"} @@ -980,7 +980,7 @@ if [[ "$ACTIVATE_IPV6" == true ]]; then run_function ip_check_ipv6 $LOCAL_IPv6_ADDRESS if [[ ! "$IP_IPV6" == true ]]; then - echoerr "The IP address '$LOCAL_IPv6_ADDRESS' seems to be in wrong format. Please try again or keep the default value." + echoerror "The IP address '$LOCAL_IPv6_ADDRESS' seems to be in wrong format. Please try again or keep the default value." local_undo_restore else IPv6_ADDRESS=${LOCAL_IPv6_ADDRESS:-"::0"} @@ -1009,7 +1009,7 @@ fi # Validate the name run_function string_remove_all_special_char_string $LOCAL_DOCKER_NETWORK_NAME "-_" DOCKER_NETWORK_NAME=${STRING_REMOVE_ALL_SPECIAL_CHAR_STRING_RESPONSE:-null} -[[ $DOCKER_NETWORK_NAME == null ]] && echoerr "The network name can not contain special chars, neither be empty" +[[ $DOCKER_NETWORK_NAME == null ]] && echoerror "The network name can not contain special chars, neither be empty" #----------------------------------------------------------------------- # Data location for nginx-proxy files @@ -1054,7 +1054,7 @@ fi # Check if email is valid run_function email_check_is_valid $DEFAULT_EMAIL -[[ ! "$EMAIL_IS_VALID" == true ]] && echoerr "You must inform a valid email address in order to continue. Please try again." +[[ ! "$EMAIL_IS_VALID" == true ]] && echoerror "You must inform a valid email address in order to continue. Please try again." #----------------------------------------------------------------------- # Log settings for nginx-proxy @@ -1151,7 +1151,7 @@ if [[ "$USE_NGINX_CONF_FILES" == true ]]; then # If there was any errors inform the user if [ $? -ne 0 ]; then - echoerr "There was an error trying to copy the nginx conf files. \ + echoerror "There was an error trying to copy the nginx conf files. \ \nThe proxy will still work with default options, but \ \nthe custom settings might not be loaded." fi @@ -1202,7 +1202,7 @@ if [[ ! "$DOCKER_NETWORK_EXISTS" == true ]]; then run_function docker_network_create $DOCKER_NETWORK_NAME $ACTIVATE_IPV6 $ARG_IPv6_SUBNET if [[ "$ERROR_DOCKER_NETWORK_CREATE" == true ]]; then - echoerr "There was error when creating the docker network $DOCKER_NETWORK_NAME [IPv6 enabled: ${ACTIVATE_IPV6:-'false'} ]" false + echoerror "There was error when creating the docker network $DOCKER_NETWORK_NAME [IPv6 enabled: ${ACTIVATE_IPV6:-'false'} ]" false local_undo_restore else ACTION_DOCKER_NETWORK_CREATED=true @@ -1220,7 +1220,7 @@ run_function local_update_docker_compose_file "$SCRIPT_PATH/../" run_function docker_compose_start "$SCRIPT_PATH/../" if [[ "$ERROR_DOCKER_COMPOSE_START" == true ]]; then - echoerr "There was an error starting the service at '$SCRIPT_PATH/../'" + echoerror "There was an error starting the service at '$SCRIPT_PATH/../'" local_undo_restore fi diff --git a/bin/localscript/update-docker-compose-file.sh b/bin/localscript/update-docker-compose-file.sh index 586d3d79..25786e5f 100755 --- a/bin/localscript/update-docker-compose-file.sh +++ b/bin/localscript/update-docker-compose-file.sh @@ -29,7 +29,7 @@ local_update_docker_compose_file() LOCAL_FULL_PATH=${1} - [[ $LOCAL_FULL_PATH == "" || $LOCAL_FULL_PATH == null ]] && echoerr "You must inform the required argument(s) to the function: '${FUNCNAME[0]}'" + [[ $LOCAL_FULL_PATH == "" || $LOCAL_FULL_PATH == null ]] && echoerror "You must inform the required argument(s) to the function: '${FUNCNAME[0]}'" [[ "$DEBUG" == true ]] && echo "Updating all variables in docker-compose.yml file for nginx-proxy (file: ${LOCAL_FULL_PATH})" diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index e09549b5..b6568b53 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -29,7 +29,7 @@ local_update_env_new_site_variables() LOCAL_FILE_PATH=${1:-null} - [[ $LOCAL_FILE_PATH == "" || $LOCAL_FILE_PATH == null ]] && echoerr "You must inform the required argument(s) to the function: '${FUNCNAME[0]}'" + [[ $LOCAL_FILE_PATH == "" || $LOCAL_FILE_PATH == null ]] && echoerror "You must inform the required argument(s) to the function: '${FUNCNAME[0]}'" [[ "$DEBUG" == true ]] && echo "Updating all variables in .env file for nginx-proxy (file: ${LOCAL_FILE_PATH})" From 1ce60f9c7762985157e22080d03d85ea256d51d7 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 9 May 2021 21:13:56 -0300 Subject: [PATCH 102/158] Do not load .env file on start inicial check --- bin/fresh-start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index e944b086..b6785dfa 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -490,7 +490,7 @@ run_function check_local_env_file NEW_PID_FILE=${PID_FILE_FRESH_INSTALL:-".fresh_start"} # Run initial check function -run_function starts_initial_check $NEW_PID_FILE true +run_function starts_initial_check $NEW_PID_FILE # Save PID system_save_pid $NEW_PID_FILE From 6fda88d3250b3d37b3324950af9404672cabf481 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 9 May 2021 21:16:40 -0300 Subject: [PATCH 103/158] Update checksum docker-compose --- bin/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/.env b/bin/.env index 309b1ecf..99e47f32 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=2af4ea13a3a122898309cb154f64229c +MD5_SUM_DOCKER_COMPOSE=acb712ecf4c2edd04583032b1cd4da07 MD5_SUM_ENV_SAMPLE=b299b584d68c1a6f7ac1b1a753a7517d From ed98f95792832a4a54edd02f53feebe28e4db8bf Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 9 May 2021 21:33:18 -0300 Subject: [PATCH 104/158] update basescript with correct .env replacement --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index bdee7a72..d0da0320 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit bdee7a72d3dc8fc3596190f5ddb1fb27c44151fc +Subproject commit d0da0320b2c19b891cc7bde882d4105cedcd0e58 From cde472659469185ed48b42633cdc721da66edf9e Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 13 May 2021 12:27:01 -0300 Subject: [PATCH 105/158] Add ipv4 subnet option --- basescript | 2 +- bin/fresh-start.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/basescript b/basescript index d0da0320..25dde088 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit d0da0320b2c19b891cc7bde882d4105cedcd0e58 +Subproject commit 25dde0885e6b99fb3738c7ebf0a85a439b0fc2ec diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index b6785dfa..e8a9df19 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -429,6 +429,15 @@ while [[ $# -gt 0 ]]; do shift 1 ;; + # IPv4 options + --ipv4-subnet=*) + ARG_IPv4_SUBNET="${1#*=}" + if [[ $ARG_IPv4_SUBNET == "" ]]; then + echoerror "Invalid option for --ipv4-subnet" + break + fi + shift 1 + ;; # IPv6 options --ipv6-subnet=*) ARG_IPv6_SUBNET="${1#*=}" @@ -1199,7 +1208,8 @@ run_function docker_check_network_exists $DOCKER_NETWORK_NAME if [[ ! "$DOCKER_NETWORK_EXISTS" == true ]]; then - run_function docker_network_create $DOCKER_NETWORK_NAME $ACTIVATE_IPV6 $ARG_IPv6_SUBNET + IPv4_SUBNET=${ARG_IPv4_SUBNET:-"172.17.0.0/16"} # required argument for function docker_network_create + run_function docker_network_create $DOCKER_NETWORK_NAME $IPv4_SUBNET $ACTIVATE_IPV6 $ARG_IPv6_SUBNET if [[ "$ERROR_DOCKER_NETWORK_CREATE" == true ]]; then echoerror "There was error when creating the docker network $DOCKER_NETWORK_NAME [IPv6 enabled: ${ACTIVATE_IPV6:-'false'} ]" false From 0d173d7b2cd46546fe7de7d42c2ad52507f8de60 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 13 May 2021 12:29:55 -0300 Subject: [PATCH 106/158] Add ipv4 subnet option in helper --- bin/localscript/usage-fresh-start.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/localscript/usage-fresh-start.sh b/bin/localscript/usage-fresh-start.sh index 86d25b35..cd95d5b3 100755 --- a/bin/localscript/usage-fresh-start.sh +++ b/bin/localscript/usage-fresh-start.sh @@ -83,6 +83,9 @@ Usage: Network -netopt | --network-option Network options please check the docs + --ipv4-subnet You may inform IPv4 subnet to create + a docker network + (default: 172.17.0.0/16) Docker image -piv | --proxy-image-version Proxy image version From 215299cdd12311c58cf9e9adc420dd88e51a57f5 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 17 May 2021 16:07:55 -0300 Subject: [PATCH 107/158] Fix network creation --- basescript | 2 +- bin/fresh-start.sh | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/basescript b/basescript index 25dde088..3089f4eb 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 25dde0885e6b99fb3738c7ebf0a85a439b0fc2ec +Subproject commit 3089f4eb38a1f6d00ff7cf7c320820d9e90591e9 diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index e8a9df19..8e07fc8f 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -515,9 +515,9 @@ local_undo_restore() { LOCAL_KEEP_RESTORE_FILES=${1:-$KEEP_RESTORE_FILES} echoerror \ - "It seems something went wrong running '${FUNCNAME[0]}' \ - \nwe will try to UNDO all actions done by this script. \ - \nPlease make sure everything was put it back in place." false + "It seems something went wrong! \ + \nRunning '${FUNCNAME[0]} to try to UNDO all actions done by this script. \ + \nPlease make sure everything was put it back in place." false # If docker network was created if [[ "$ACTION_DOCKER_NETWORK_CREATED" == true ]]; then @@ -1208,11 +1208,14 @@ run_function docker_check_network_exists $DOCKER_NETWORK_NAME if [[ ! "$DOCKER_NETWORK_EXISTS" == true ]]; then - IPv4_SUBNET=${ARG_IPv4_SUBNET:-"172.17.0.0/16"} # required argument for function docker_network_create - run_function docker_network_create $DOCKER_NETWORK_NAME $IPv4_SUBNET $ACTIVATE_IPV6 $ARG_IPv6_SUBNET + run_function docker_network_create $DOCKER_NETWORK_NAME ${ARG_IPv4_SUBNET:-null} $ACTIVATE_IPV6 $ARG_IPv6_SUBNET if [[ "$ERROR_DOCKER_NETWORK_CREATE" == true ]]; then - echoerror "There was error when creating the docker network $DOCKER_NETWORK_NAME [IPv6 enabled: ${ACTIVATE_IPV6:-'false'} ]" false + echoerror \ + "There was an error when creating the docker network $DOCKER_NETWORK_NAME [IPv6 enabled: ${ACTIVATE_IPV6:-'false'} ] \ + \nPlease try to create the network by yourself using the appropriate options described below and try again: \ + \nhttps://docs.docker.com/engine/reference/commandline/network_create/" \ + false local_undo_restore else ACTION_DOCKER_NETWORK_CREATED=true From 9f84c2c3f77f025477ec285d71f17107bb5ae307 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 30 Jun 2021 20:39:45 -0300 Subject: [PATCH 108/158] Atualiza basescript --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index 3089f4eb..4d1e334c 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 3089f4eb38a1f6d00ff7cf7c320820d9e90591e9 +Subproject commit 4d1e334c806621d3276ae87a86b0167ec7ffeed3 From 31ceb7dbea1c8c50336e8d7012922c6b3385ca96 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 13 Jul 2021 22:28:09 -0300 Subject: [PATCH 109/158] Add default host --- .env.sample | 11 +++++++++++ bin/fresh-start.sh | 11 +++++++++++ bin/localscript/update-env-new-site-variables.sh | 3 +++ docker-compose.yml | 1 + 4 files changed, 26 insertions(+) diff --git a/.env.sample b/.env.sample index 02efd7f7..0d7e9a65 100644 --- a/.env.sample +++ b/.env.sample @@ -110,3 +110,14 @@ DOCKER_HTTPS=443 # replaced by the LETSENCRYPT_EMAIL environment varibale present in your docker container # DEFAULT_EMAIL=mail@yourdomain.tld + +#----------------------------------------------------------------------- +# +# Default host +# +# Nginx-proxy will then redirect all requests to a container where VIRTUAL_HOST +# is set to DEFAULT_HOST, if they don't match any (other) VIRTUAL_HOST, you +# might want to check the link below for more information: +# https://github.com/nginx-proxy/nginx-proxy#default-host +# +DEFAULT_HOST= diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 8e07fc8f..636979df 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -452,6 +452,17 @@ while [[ $# -gt 0 ]]; do shift 1 ;; + # Default host + --default-host=*) + ARG_DEFAULT_HOST="${1#*=}" + if [[ $ARG_DEFAULT_HOST == "" ]]; then + echoerror "Invalid option for --default-host" + break + fi + shift 1 + ;; + + # Other options --update-nginx-template) UPDATE_NGINX_TEMPLATE=true shift 1 diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index b6568b53..e2b358ef 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -75,5 +75,8 @@ local_update_env_new_site_variables() # Default email address run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_EMAIL" "$DEFAULT_EMAIL" + # Default host + run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_HOST" "$ARG_DEFAULT_HOST" + return 0 } diff --git a/docker-compose.yml b/docker-compose.yml index 30052651..ed0e75f6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: # - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" environment: SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} + DEFAULT_HOST: ${DEFAULT_HOST:-localhost} # ENABLE_IPV6: "true" volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d From c29b2669953528e8e92775a57bfd3541cf0a137a Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 13 Jul 2021 22:36:13 -0300 Subject: [PATCH 110/158] Set localhost to default will not affect anything else --- .env.sample | 6 +++--- bin/localscript/update-env-new-site-variables.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.sample b/.env.sample index 0d7e9a65..f9331bc0 100644 --- a/.env.sample +++ b/.env.sample @@ -115,9 +115,9 @@ DEFAULT_EMAIL=mail@yourdomain.tld # # Default host # -# Nginx-proxy will then redirect all requests to a container where VIRTUAL_HOST -# is set to DEFAULT_HOST, if they don't match any (other) VIRTUAL_HOST, you -# might want to check the link below for more information: +# Nginx-proxy will then redirect all requests to a container where you have set +# "VIRTUAL HOST" set to "DEFAULT HOST", if they don't match any (other) container +# You might want to check the link below for more information: # https://github.com/nginx-proxy/nginx-proxy#default-host # DEFAULT_HOST= diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index e2b358ef..c8b39ae7 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -76,7 +76,7 @@ local_update_env_new_site_variables() run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_EMAIL" "$DEFAULT_EMAIL" # Default host - run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_HOST" "$ARG_DEFAULT_HOST" + run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_HOST" "${ARG_DEFAULT_HOST:-localhost}" return 0 } From e01bfbd5db91a155ba8ece453b2aa19944c88e17 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 13 Jul 2021 22:43:38 -0300 Subject: [PATCH 111/158] Set default host only if option was informed --- bin/localscript/update-docker-compose-file.sh | 5 ++++- bin/localscript/update-env-new-site-variables.sh | 2 +- bin/localscript/usage-fresh-start.sh | 4 ++++ docker-compose.yml | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/localscript/update-docker-compose-file.sh b/bin/localscript/update-docker-compose-file.sh index 25786e5f..c2fe4abf 100755 --- a/bin/localscript/update-docker-compose-file.sh +++ b/bin/localscript/update-docker-compose-file.sh @@ -38,10 +38,13 @@ local_update_docker_compose_file() run_function docker_compose_replace_string $LOCAL_FULL_PATH "$REPLACE_DOCKER_GEN_SERVICE_NAME" "$DOCKER_GEN_SERVICE_NAME" run_function docker_compose_replace_string $LOCAL_FULL_PATH "$REPLACE_LETSENCRYPT_SERVICE_NAME" "$LETSENCRYPT_SERVICE_NAME" - # Uncomment in case of IPv6 activation or uncomment + # Uncomment in case of IPv6 activation or comment [[ "$ACTIVATE_IPV6" == true ]] && run_function file_uncomment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPv6" && run_function file_uncomment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPV6" [[ ! "$ACTIVATE_IPV6" == true ]] && run_function file_comment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPv6" && run_function file_comment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "IPV6" # We are aware that it will set two '#' if the IPv6 is already commented + # Uncomment in case of Default Host activation + [[ ! $ARG_DEFAULT_HOST == "" ]] && run_function file_uncomment_line_with_string ${LOCAL_FULL_PATH%/}"/docker-compose.yml" "DEFAULT_HOST" + return 0 } diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index c8b39ae7..3a5d9d11 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -76,7 +76,7 @@ local_update_env_new_site_variables() run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_EMAIL" "$DEFAULT_EMAIL" # Default host - run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_HOST" "${ARG_DEFAULT_HOST:-localhost}" + [[ ! $ARG_DEFAULT_HOST == "" ]] && run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_HOST" "${ARG_DEFAULT_HOST}" return 0 } diff --git a/bin/localscript/usage-fresh-start.sh b/bin/localscript/usage-fresh-start.sh index cd95d5b3..ba1d735a 100755 --- a/bin/localscript/usage-fresh-start.sh +++ b/bin/localscript/usage-fresh-start.sh @@ -116,6 +116,10 @@ Usage: -sp | --ssl-policy Proxy SSL suport (default: Mozilla-Intermediate) + Default Host + --default-host The default host where nginx-proxy will redirect any request + (default: localhost - which will return a 503) + IPv6 support --activate-ipv6 Use to activate IPv6 support -ipv6 | --ipv6-address IPv6 address for external connectivity diff --git a/docker-compose.yml b/docker-compose.yml index ed0e75f6..f8c428e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: # - "${IPv6:-::0}:${DOCKER_HTTPS:-443}:443" environment: SSL_POLICY: ${SSL_POLICY:-Mozilla-Intermediate} - DEFAULT_HOST: ${DEFAULT_HOST:-localhost} +# DEFAULT_HOST: ${DEFAULT_HOST} # ENABLE_IPV6: "true" volumes: - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d From bac7cf3fa6caf626c68fc0db425fe3a5fee0bc29 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 13 Jul 2021 22:49:22 -0300 Subject: [PATCH 112/158] Set default host short option and update documentation --- basescript | 2 +- bin/fresh-start.sh | 8 ++++++++ bin/localscript/usage-fresh-start.sh | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/basescript b/basescript index 4d1e334c..73e5e18c 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 4d1e334c806621d3276ae87a86b0167ec7ffeed3 +Subproject commit 73e5e18c06e61e96b48c852b463bbf884fc86f7f diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 636979df..50ab85bc 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -453,6 +453,14 @@ while [[ $# -gt 0 ]]; do ;; # Default host + -dh) + ARG_DEFAULT_HOST="${2}" + if [[ $ARG_DEFAULT_HOST == "" ]]; then + echoerror "Invalid option for -dh" + break + fi + shift 2 + ;; --default-host=*) ARG_DEFAULT_HOST="${1#*=}" if [[ $ARG_DEFAULT_HOST == "" ]]; then diff --git a/bin/localscript/usage-fresh-start.sh b/bin/localscript/usage-fresh-start.sh index ba1d735a..2493ec54 100755 --- a/bin/localscript/usage-fresh-start.sh +++ b/bin/localscript/usage-fresh-start.sh @@ -117,8 +117,8 @@ Usage: (default: Mozilla-Intermediate) Default Host - --default-host The default host where nginx-proxy will redirect any request - (default: localhost - which will return a 503) + -df | --default-host The default host where nginx-proxy will redirect all requests to + the container that matches the VIRTUAL_HOST IPv6 support --activate-ipv6 Use to activate IPv6 support From 9ce0320fff25360dbd7ec2feb61ac1e725f81446 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 13 Jul 2021 23:02:01 -0300 Subject: [PATCH 113/158] Update uploadsize.conf Fix the comment --- conf.d/uploadsize.conf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/conf.d/uploadsize.conf b/conf.d/uploadsize.conf index ed6efd1a..4dcdc1d0 100644 --- a/conf.d/uploadsize.conf +++ b/conf.d/uploadsize.conf @@ -1,7 +1,5 @@ # -# [WARNING] To enable this files you need to uncomment USE_NGINX_CONF_FILES=true in .env file -# -# [WARNING] Also, read all the comments in .env about NGINX use special conf files +# [WARNING] In order to enable this option in the proxy you must run the fresh start script with the option `--use-nginx-conf-files` # client_max_body_size 100m; From eb5bd1cbd4727813b121e3c421ea4b560c5fc833 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 20 Jul 2021 23:37:36 -0300 Subject: [PATCH 114/158] Add funcion to automate checksum update --- bin/.env | 4 +- bin/update-checksum.sh | 96 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 2 deletions(-) create mode 100755 bin/update-checksum.sh diff --git a/bin/.env b/bin/.env index 99e47f32..3c856597 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=acb712ecf4c2edd04583032b1cd4da07 -MD5_SUM_ENV_SAMPLE=b299b584d68c1a6f7ac1b1a753a7517d +MD5_SUM_DOCKER_COMPOSE=0a91c69a103cd6c7cd475477b78a237b +MD5_SUM_ENV_SAMPLE=7a8b027dc2bf252a8c91d23f74e2bd2a diff --git a/bin/update-checksum.sh b/bin/update-checksum.sh new file mode 100755 index 00000000..af67e498 --- /dev/null +++ b/bin/update-checksum.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# +# Update checksum in .env files +# +# Part of https://github.com/evertramos/nginx-proxy-automation +# +# Script written by +# Evert Ramos +# +# Copyright Evert Ramos +# +#----------------------------------------------------------------------- + +# Bash settings (do not mess with it) +shopt -s nullglob globstar + +# Get the script name and its file real path +SCRIPT_PATH="$(dirname "$(readlink -f "$0")")" +SCRIPT_NAME="${0##*/}" + +# Source basescript functions +source $SCRIPT_PATH"/../basescript/bootstrap.sh" + +# Source localscripts +source $SCRIPT_PATH"/localscript/bootstrap.sh" + +# Log +printf "${energy} Start execution '${SCRIPT_PATH}/${SCRIPT_NAME} " +log "Start execution" +log "$@" + +#----------------------------------------------------------------------- +# Initial check - DO NOT CHANGE SETTINGS BELOW +#----------------------------------------------------------------------- + +# Check if there is an .env file in local folder +run_function check_local_env_file + +# Specific PID File if needs to run multiple scripts +NEW_PID_FILE=${PID_FILE_FRESH_INSTALL:-".update_checksum"} + +# Run initial check function +run_function starts_initial_check $NEW_PID_FILE + +# Save PID +system_save_pid $NEW_PID_FILE + +# DO NOT CHANGE ANY OPTIONS ABOVE THIS LINE! + +#----------------------------------------------------------------------- +# [function] Undo script actions +#----------------------------------------------------------------------- +local_undo_restore() { +# local LOCAL_KEEP_RESTORE_FILES +# +# LOCAL_KEEP_RESTORE_FILES=${1:-$KEEP_RESTORE_FILES} + + echoerror \ + "It seems something went wrong! \ + \nRunning '${FUNCNAME[0]} to try to UNDO all actions done by this script. \ + \nPlease make sure everything was put it back in place." false + + # If docker network was created +# if [[ "$ACTION_DOCKER_NETWORK_CREATED" == true ]]; then +# [[ "$SILENT" != true ]] && echowarning "[undo] Deleting created docker network '$DOCKER_NETWORK_NAME'." +# run_function docker_network_remove $DOCKER_NETWORK_NAME +# ACTION_DOCKER_NETWORK_CREATED=false +# fi + + exit 0 +} + +#----------------------------------------------------------------------- +# Verify checksum of docker-compose.yml and .env.sample files +#----------------------------------------------------------------------- +run_function md5_check_checksum "$SCRIPT_PATH/../" "docker-compose.yml" $MD5_SUM_DOCKER_COMPOSE +if [[ ! "$MD5_CHECKSUM" == true ]]; then + DOCKER_COMPOSE_CHECKSUM=$(md5sum "$SCRIPT_PATH/../docker-compose.yml" | awk '{print $1}') + echowarning "Updating the checksum for 'MD5_SUM_DOCKER_COMPOSE'" + run_function env_update_variable "$SCRIPT_PATH" "MD5_SUM_DOCKER_COMPOSE" "$DOCKER_COMPOSE_CHECKSUM" +else + echosuccess "Checksum for 'MD5_SUM_DOCKER_COMPOSE' is just fine!" +fi + +run_function md5_check_checksum "$SCRIPT_PATH/../" ".env.sample" $MD5_SUM_ENV_SAMPLE +if [[ ! "$MD5_CHECKSUM" == true ]]; then + ENV_CHECKSUM=$(md5sum "$SCRIPT_PATH/../.env.sample" | awk '{print $1}') + echowarning "Updating the checksum for 'MD5_SUM_ENV_SAMPLE'" + run_function env_update_variable "$SCRIPT_PATH" "MD5_SUM_ENV_SAMPLE" "$ENV_CHECKSUM" +else + echosuccess "Checksum for 'MD5_SUM_ENV_SAMPLE' is just fine!" +fi + +exit 0 From 523bb97394b1edfe809f3861d3145b24e22e46fc Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 30 Jul 2021 06:14:01 -0300 Subject: [PATCH 115/158] Update checksum! --- bin/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/.env b/bin/.env index 3c856597..c85f2c9d 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=0a91c69a103cd6c7cd475477b78a237b +MD5_SUM_DOCKER_COMPOSE=11b79cee40db0714cb35d0bce182cf3e MD5_SUM_ENV_SAMPLE=7a8b027dc2bf252a8c91d23f74e2bd2a From dc35fbc0aa3963c2c77f1d2f26bc5b1eab9840ec Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Fri, 30 Jul 2021 06:16:20 -0300 Subject: [PATCH 116/158] Update basescript to the latest version --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index 2f912520..9716afb7 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 2f912520019d805346fcffc2edd8336a1945f82f +Subproject commit 9716afb7830e3791d6554fe821059fe3274c43f9 From d44403d670fe21786fa9c9186a5a132fed222d9e Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 3 Aug 2021 00:58:54 -0300 Subject: [PATCH 117/158] Create oldReadme --- docs/oldReadme | 237 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 docs/oldReadme diff --git a/docs/oldReadme b/docs/oldReadme new file mode 100644 index 00000000..f03b7310 --- /dev/null +++ b/docs/oldReadme @@ -0,0 +1,237 @@ + +# NGINX Proxy Automation πŸ”₯ + +## What this project does + +This script will _power up_ your new server with the [*nginx-proxy*](https://github.com/nginx-proxy/nginx-proxy), where you will be able to host multiple sites, +auto renewing LetΒ΄s Encrypt certificates! ❀️ + +Something like: + +![Web Proxy environment](https://github.com/evertramos/images/raw/master/webproxy.jpg) + +We strongly recommend you (please do! πŸ™) to read all documentation before starting in production as well as the [nginx-proxy docs](https://github.com/nginx-proxy/nginx-proxy). + +> To access the previous version of this project please access [version 0.4](https://github.com/evertramos/nginx-proxy-automation/tree/v0.4). + +### Upgrading from previous version + +If you are upgrading from the previous version please follow the guide below carefully: + +https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/upgrade-guide.md + +## Video Tutorial + +I made a 5 minutes tutorial video to walk you through this project: + +Click [here](https://www.youtube.com/watch?v=E9BtHVr_v9I) to access the video or click the image below: + +[![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) + +## Prerequisites + +1. 🐧 Linux! (just in case...) + +> Please check all requirements at [requirements](/docs/requirements.md). + +In order to use this compose file (docker-compose.yml) you must have: + +2. πŸ‹ Docker installed (https://docs.docker.com/engine/installation/) + +3. Docker-compose installed (https://docs.docker.com/compose/install/) + +> I have an [easy-server](https://github.com/evertramos/easy-server) for myself which I use to install +> docker and docker-compose in new servers and some aliases and other stuff. Feel free to use it, **but** +> it is not related to this repo and maintainance it's for my own use only. Check './install/docker' folder. + +Also, you will need to make sure you have: + +4. Port 80 and 443 available for binding - which means apache/nginx or other web services should not be + running in your server + +5. Server must be accessible by a public IP address + +## How to use it + +1. Clone this repository **using the option _--recurse-submodules_**: + +```bash +$ git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-automation.git proxy +``` + +> Make sure you use the option '--recurse-submodules' once we use an external module in this project, please check +> [basescript](https://github.com/evertramos/basescript) + +> Please note we use 'proxy' as folder at the end. But you can change it to whatever fits you better + +2. πŸš€ Run the script 'fresh_start.sh' + +```bash +$ cd proxy/bin +$ ./fresh-start.sh +``` +This script will walk you through all config process. + +When it finishes you are good to go! :checkered_flag: + +> ✈️ If you are in a 'hurry' just run `$ ./fresh-start.sh --yes -e your_email@domain --skip-docker-image-check` + +> ⚠️ You can check all available options to run the script `$ ./fresh-start.sh --help` + +> πŸ—’οΈ From version _v0.3_ the script will output logs to _/var/log/basescript.log_ + +3. Fire your new site with the following options: + +```yaml + VIRTUAL_HOST=your.domain.com + LETSENCRYPT_HOST=your.domain.com + LETSENCRYPT_EMAIL=your.email@your.domain.com + NETWORK=proxy +``` + +The fresh start script asked you for the proxy network name if you changed set a name differente from +the default please update the option *'NETWORK'* in the examples below before running it. + +- Simple site without Let's Encrypt certificate +```bash +$ docker run -d -e VIRTUAL_HOST=your.domain.com \ + --network=proxy \ + --name my_app \ + httpd:alpine +``` + +- To have SSL in your web/app you must add the option `-e LETSENCRYPT_HOST=your.domain.com`, as follow: + +```bash +$ docker run -d -e VIRTUAL_HOST=your.domain.com \ + -e LETSENCRYPT_HOST=your.domain.com \ + -e LETSENCRYPT_EMAIL=your.email@your.domain.com \ + --network=proxy \ + --name my_app \ + httpd:alpine +``` + +> You donΒ΄t need to open port *443* in your container, the certificate validation is managed by the web proxy + +> Please note that when running a new container to generate certificates with Let's Encrypt +> (`-e LETSENCRYPT_HOST=your.domain.com`), it may take a few minutes + + +## Further Options + +1. Basic Authentication Support + +In order to be able to secure your virtual host with basic authentication, you must create a htpasswd file +within `${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}` via: + +```bash +$ sudo sh -c "echo -n '[username]:' >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" +$ sudo sh -c "openssl passwd -apr1 >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" +``` + +> Please replace the `${NGINX_FILES_PATH}` with real path to information, replace `[username]` with your username and `${VIRTUAL_HOST}` with your host's domain. You will be prompted for a password. + +2. Using different networks + +If you want to use more than one network to better organize your environment you could set the option `SERVICE_NETWORK` in our `.env.sample` or you can just create your own network and attach all your containers as of: + +```bash +docker network create myownnetwork +docker network connect myownnetwork nginx-web +docker network connect myownnetwork nginx-gen +docker network connect myownnetwork nginx-letsencrypt +``` + +3. Ports + +If your service container runs on port 8545 you probably will need to add the `VIRTUAL_PORT` environment variable to your container, +in the `docker-compose.yml`, so it can be proxied, as of: + +```bash +parity + image: parity/parity:v1.8.9 + [...] + environment: + [...] + VIRTUAL_PORT: 8545 +``` + +Or as of below: + +```bash +docker run [...] -e VIRTUAL_PORT=8545 [...] +``` + +4. Restarting proxy container + +In some cases you will need to restart the proxy in order to read, as an example, the Basic Auth, if you set it after your service container is already up and running. So, the way I use to restart the proxy (NGINX) is as following, which has no downtime: + +```bash +docker exec -it ${NGINX_WEB} nginx -s reload +``` + +Where *${NGINX_WEB}* is your proxy container name, which in the original `.env` file is set as *nginx-web*. + + +## Testing nginx-proxy + +1. Run the script `test.sh` informing your domain already configured in your DNS to point out to your server as follow: + +```bash +./test.sh your.domain.com +``` + +or simply run: + +```bash +docker run -dit -e VIRTUAL_HOST=your.domain.com --network=webproxy --name test-web httpd:alpine +``` + +> If you want to test the Let's Encrypt certificate as well use `ssl_test.sh your.domain.com` + +Access your browser with your domain! + +To stop and remove your test container run our `stop.sh` script: + +```bash +./stop.sh +``` + +Or simply run: + +```bash +docker stop test-web && docker rm test-web +``` + +## **PRODUCTION** ⚠️ [IMPORTANT] + +If you are using this project in production enviroment, check all license involved and consider the following recomendation: + +- [rootless docker](https://docs.docker.com/engine/security/rootless/) +- [docker compose files](https://docs.docker.com/compose/production/) + +## Other projects using nginx-proxy +Following are links to docker containers using this web proxy: +1. [docker-wordpress-letsencrypt](https://github.com/evertramos/docker-wordpress-letsencrypt) +2. [docker-portainer-letsencrypt](https://github.com/evertramos/docker-portainer-letsencrypt) +3. [docker-nextcloud-letsencrypt](https://github.com/evertramos/docker-nextcloud-letsencrypt) +4. [docker-registry-letsencrypt](https://github.com/evertramos/docker-registry-letsencrypt) +5. [gitlab-docker-letsencrypt](https://github.com/steevepay/gitlab-docker-letsencrypt) +6. [docker-webtrees-letsencrypt](https://github.com/mstroppel/docker-webtrees-letsencrypt) + +## Running this Proxy on a Synology NAS +Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/HOWTO-Synlogy.md). + +## Credits +Without the projects below this proxy would be impossible: +- [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) by [@jwilder](https://github.com/jwilder) +- [docker-gen](https://github.com/jwilder/docker-gen) by [@jwilder](https://github.com/jwilder) +- [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) by [@JrCs](https://github.com/JrCs) + +## Supporting β™₯️ +In case you are willing to support this project, check: +- [Patreon (evertramos)](https://www.patreon.com/evertramos) +- [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) + +## List of all supporters +Please access the page [Supporters](https://github.com/evertramos/evertramos/blob/main/pages/supporters.md). From 35d075a540eb5e28033e1905504efea19787ccbd Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 3 Aug 2021 01:10:46 -0300 Subject: [PATCH 118/158] Update and rename oldReadme to README.md --- docs/{oldReadme => README.md} | 1 - 1 file changed, 1 deletion(-) rename docs/{oldReadme => README.md} (99%) diff --git a/docs/oldReadme b/docs/README.md similarity index 99% rename from docs/oldReadme rename to docs/README.md index f03b7310..410544ec 100644 --- a/docs/oldReadme +++ b/docs/README.md @@ -1,4 +1,3 @@ - # NGINX Proxy Automation πŸ”₯ ## What this project does From afde52988d4622ce7b362d93756fb85ba93c43b9 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 3 Aug 2021 01:11:32 -0300 Subject: [PATCH 119/158] Update README.md --- docs/README.md | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/docs/README.md b/docs/README.md index 410544ec..e4d9ec8e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,10 +5,6 @@ This script will _power up_ your new server with the [*nginx-proxy*](https://github.com/nginx-proxy/nginx-proxy), where you will be able to host multiple sites, auto renewing LetΒ΄s Encrypt certificates! ❀️ -Something like: - -![Web Proxy environment](https://github.com/evertramos/images/raw/master/webproxy.jpg) - We strongly recommend you (please do! πŸ™) to read all documentation before starting in production as well as the [nginx-proxy docs](https://github.com/nginx-proxy/nginx-proxy). > To access the previous version of this project please access [version 0.4](https://github.com/evertramos/nginx-proxy-automation/tree/v0.4). @@ -19,14 +15,6 @@ If you are upgrading from the previous version please follow the guide below car https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/upgrade-guide.md -## Video Tutorial - -I made a 5 minutes tutorial video to walk you through this project: - -Click [here](https://www.youtube.com/watch?v=E9BtHVr_v9I) to access the video or click the image below: - -[![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) - ## Prerequisites 1. 🐧 Linux! (just in case...) @@ -221,16 +209,3 @@ Following are links to docker containers using this web proxy: ## Running this Proxy on a Synology NAS Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/HOWTO-Synlogy.md). -## Credits -Without the projects below this proxy would be impossible: -- [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) by [@jwilder](https://github.com/jwilder) -- [docker-gen](https://github.com/jwilder/docker-gen) by [@jwilder](https://github.com/jwilder) -- [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) by [@JrCs](https://github.com/JrCs) - -## Supporting β™₯️ -In case you are willing to support this project, check: -- [Patreon (evertramos)](https://www.patreon.com/evertramos) -- [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) - -## List of all supporters -Please access the page [Supporters](https://github.com/evertramos/evertramos/blob/main/pages/supporters.md). From 40f472c520cf283d4a38b7ded68a911f11acf7f1 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 3 Aug 2021 01:12:59 -0300 Subject: [PATCH 120/158] Update README.md --- .github/README.md | 236 +++++++--------------------------------------- 1 file changed, 33 insertions(+), 203 deletions(-) diff --git a/.github/README.md b/.github/README.md index f03b7310..adfafd5d 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,237 +1,67 @@ # NGINX Proxy Automation πŸ”₯ -## What this project does +Automate your server with this proxy! ❀️ -This script will _power up_ your new server with the [*nginx-proxy*](https://github.com/nginx-proxy/nginx-proxy), where you will be able to host multiple sites, -auto renewing LetΒ΄s Encrypt certificates! ❀️ +

+ + + +

+

+ +

-Something like: +

+ +

-![Web Proxy environment](https://github.com/evertramos/images/raw/master/webproxy.jpg) +## How to start +[![shell script](https://img.shields.io/badge/Shell_Script-121011?style=for-the-badge&logo=gnu-bash&logoColor=white)](https://github.com/evertramos) -We strongly recommend you (please do! πŸ™) to read all documentation before starting in production as well as the [nginx-proxy docs](https://github.com/nginx-proxy/nginx-proxy). -> To access the previous version of this project please access [version 0.4](https://github.com/evertramos/nginx-proxy-automation/tree/v0.4). - -### Upgrading from previous version - -If you are upgrading from the previous version please follow the guide below carefully: - -https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/upgrade-guide.md - -## Video Tutorial - -I made a 5 minutes tutorial video to walk you through this project: - -Click [here](https://www.youtube.com/watch?v=E9BtHVr_v9I) to access the video or click the image below: - -[![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) - -## Prerequisites - -1. 🐧 Linux! (just in case...) - -> Please check all requirements at [requirements](/docs/requirements.md). - -In order to use this compose file (docker-compose.yml) you must have: - -2. πŸ‹ Docker installed (https://docs.docker.com/engine/installation/) - -3. Docker-compose installed (https://docs.docker.com/compose/install/) - -> I have an [easy-server](https://github.com/evertramos/easy-server) for myself which I use to install -> docker and docker-compose in new servers and some aliases and other stuff. Feel free to use it, **but** -> it is not related to this repo and maintainance it's for my own use only. Check './install/docker' folder. - -Also, you will need to make sure you have: - -4. Port 80 and 443 available for binding - which means apache/nginx or other web services should not be - running in your server - -5. Server must be accessible by a public IP address - -## How to use it - -1. Clone this repository **using the option _--recurse-submodules_**: +1. Clone this repository using the option **_--recurse-submodules_** ```bash -$ git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-automation.git proxy +git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-automation.git proxy ``` -> Make sure you use the option '--recurse-submodules' once we use an external module in this project, please check -> [basescript](https://github.com/evertramos/basescript) +We use submodule for [basescript](https://github.com/evertramos/basescript) -> Please note we use 'proxy' as folder at the end. But you can change it to whatever fits you better - -2. πŸš€ Run the script 'fresh_start.sh' +2. πŸš€ Run the script 'fresh_start.sh' from the _./proxy/bin_ folder ```bash -$ cd proxy/bin -$ ./fresh-start.sh -``` -This script will walk you through all config process. - -When it finishes you are good to go! :checkered_flag: - -> ✈️ If you are in a 'hurry' just run `$ ./fresh-start.sh --yes -e your_email@domain --skip-docker-image-check` - -> ⚠️ You can check all available options to run the script `$ ./fresh-start.sh --help` - -> πŸ—’οΈ From version _v0.3_ the script will output logs to _/var/log/basescript.log_ - -3. Fire your new site with the following options: - -```yaml - VIRTUAL_HOST=your.domain.com - LETSENCRYPT_HOST=your.domain.com - LETSENCRYPT_EMAIL=your.email@your.domain.com - NETWORK=proxy -``` - -The fresh start script asked you for the proxy network name if you changed set a name differente from -the default please update the option *'NETWORK'* in the examples below before running it. - -- Simple site without Let's Encrypt certificate -```bash -$ docker run -d -e VIRTUAL_HOST=your.domain.com \ - --network=proxy \ - --name my_app \ - httpd:alpine -``` - -- To have SSL in your web/app you must add the option `-e LETSENCRYPT_HOST=your.domain.com`, as follow: - -```bash -$ docker run -d -e VIRTUAL_HOST=your.domain.com \ - -e LETSENCRYPT_HOST=your.domain.com \ - -e LETSENCRYPT_EMAIL=your.email@your.domain.com \ - --network=proxy \ - --name my_app \ - httpd:alpine +cd proxy/bin && ./fresh-start.sh --yes -e your_email@domain --skip-docker-image-check ``` -> You donΒ΄t need to open port *443* in your container, the certificate validation is managed by the web proxy - -> Please note that when running a new container to generate certificates with Let's Encrypt -> (`-e LETSENCRYPT_HOST=your.domain.com`), it may take a few minutes +Update the email above with your real e-mail address - -## Further Options - -1. Basic Authentication Support - -In order to be able to secure your virtual host with basic authentication, you must create a htpasswd file -within `${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}` via: - -```bash -$ sudo sh -c "echo -n '[username]:' >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" -$ sudo sh -c "openssl passwd -apr1 >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" -``` - -> Please replace the `${NGINX_FILES_PATH}` with real path to information, replace `[username]` with your username and `${VIRTUAL_HOST}` with your host's domain. You will be prompted for a password. - -2. Using different networks - -If you want to use more than one network to better organize your environment you could set the option `SERVICE_NETWORK` in our `.env.sample` or you can just create your own network and attach all your containers as of: - -```bash -docker network create myownnetwork -docker network connect myownnetwork nginx-web -docker network connect myownnetwork nginx-gen -docker network connect myownnetwork nginx-letsencrypt -``` - -3. Ports - -If your service container runs on port 8545 you probably will need to add the `VIRTUAL_PORT` environment variable to your container, -in the `docker-compose.yml`, so it can be proxied, as of: - -```bash -parity - image: parity/parity:v1.8.9 - [...] - environment: - [...] - VIRTUAL_PORT: 8545 -``` - -Or as of below: - -```bash -docker run [...] -e VIRTUAL_PORT=8545 [...] -``` - -4. Restarting proxy container - -In some cases you will need to restart the proxy in order to read, as an example, the Basic Auth, if you set it after your service container is already up and running. So, the way I use to restart the proxy (NGINX) is as following, which has no downtime: - -```bash -docker exec -it ${NGINX_WEB} nginx -s reload -``` - -Where *${NGINX_WEB}* is your proxy container name, which in the original `.env` file is set as *nginx-web*. - - -## Testing nginx-proxy - -1. Run the script `test.sh` informing your domain already configured in your DNS to point out to your server as follow: - -```bash -./test.sh your.domain.com -``` - -or simply run: +3. πŸ§ͺ Test the proxy ```bash docker run -dit -e VIRTUAL_HOST=your.domain.com --network=webproxy --name test-web httpd:alpine ``` - -> If you want to test the Let's Encrypt certificate as well use `ssl_test.sh your.domain.com` - -Access your browser with your domain! - -To stop and remove your test container run our `stop.sh` script: - +or simply run: ```bash -./stop.sh +./test.sh your.domain.com ``` -Or simply run: - -```bash -docker stop test-web && docker rm test-web -``` +Update the lines above with your domain name which must have the DNS poiting to your public IP address in your server -## **PRODUCTION** ⚠️ [IMPORTANT] +## Video Tutorial -If you are using this project in production enviroment, check all license involved and consider the following recomendation: +I made a 5 minutes tutorial video to walk you through this project: -- [rootless docker](https://docs.docker.com/engine/security/rootless/) -- [docker compose files](https://docs.docker.com/compose/production/) +[![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=E9BtHVr_v9I) -## Other projects using nginx-proxy -Following are links to docker containers using this web proxy: -1. [docker-wordpress-letsencrypt](https://github.com/evertramos/docker-wordpress-letsencrypt) -2. [docker-portainer-letsencrypt](https://github.com/evertramos/docker-portainer-letsencrypt) -3. [docker-nextcloud-letsencrypt](https://github.com/evertramos/docker-nextcloud-letsencrypt) -4. [docker-registry-letsencrypt](https://github.com/evertramos/docker-registry-letsencrypt) -5. [gitlab-docker-letsencrypt](https://github.com/steevepay/gitlab-docker-letsencrypt) -6. [docker-webtrees-letsencrypt](https://github.com/mstroppel/docker-webtrees-letsencrypt) +[![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) -## Running this Proxy on a Synology NAS -Please checkout this [howto](https://github.com/evertramos/nginx-proxy-automation/blob/master/docs/HOWTO-Synlogy.md). +## Further information -## Credits -Without the projects below this proxy would be impossible: -- [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) by [@jwilder](https://github.com/jwilder) -- [docker-gen](https://github.com/jwilder/docker-gen) by [@jwilder](https://github.com/jwilder) -- [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) by [@JrCs](https://github.com/JrCs) +For more instalation details please [click here](/docs/). ## Supporting β™₯️ -In case you are willing to support this project, check: -- [Patreon (evertramos)](https://www.patreon.com/evertramos) -- [Open Collective (nginx-proxy-automation)](https://opencollective.com/nginx-proxy-automation) +[![Patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/evertramos) +[![image](https://img.shields.io/badge/picpay-21C25E?style=for-the-badge&logo=picpay&logoColor=white)](https://picpay.me/evert.ramos) -## List of all supporters -Please access the page [Supporters](https://github.com/evertramos/evertramos/blob/main/pages/supporters.md). +[List of all supporters](https://github.com/evertramos/evertramos/blob/main/pages/supporters.md). From 0e0a87e67fb3b9e8b6db07aacc45e10475706725 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 3 Aug 2021 01:15:13 -0300 Subject: [PATCH 121/158] Update README.md --- .github/README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/README.md b/.github/README.md index adfafd5d..531e543b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,8 +1,6 @@ # NGINX Proxy Automation πŸ”₯ -Automate your server with this proxy! ❀️ -

@@ -16,7 +14,7 @@ Automate your server with this proxy! ❀️

-## How to start +## How to start πŸ”° [![shell script](https://img.shields.io/badge/Shell_Script-121011?style=for-the-badge&logo=gnu-bash&logoColor=white)](https://github.com/evertramos) @@ -48,7 +46,7 @@ or simply run: Update the lines above with your domain name which must have the DNS poiting to your public IP address in your server -## Video Tutorial +## Video Tutorial πŸŽ₯ I made a 5 minutes tutorial video to walk you through this project: @@ -56,7 +54,7 @@ I made a 5 minutes tutorial video to walk you through this project: [![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) -## Further information +## Further information πŸ““ For more instalation details please [click here](/docs/). From 12cd5143570cdd1d3b98ca0a587656bf8579b5e3 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 3 Aug 2021 01:18:06 -0300 Subject: [PATCH 122/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 531e543b..0b729651 100644 --- a/.github/README.md +++ b/.github/README.md @@ -37,7 +37,7 @@ Update the email above with your real e-mail address 3. πŸ§ͺ Test the proxy ```bash -docker run -dit -e VIRTUAL_HOST=your.domain.com --network=webproxy --name test-web httpd:alpine +docker run -dit -e VIRTUAL_HOST=your.domain.com --network=proxy --name test-web httpd:alpine ``` or simply run: ```bash From 84a20fa9eb97c163f0da4f49d5ef8530237642bd Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 3 Aug 2021 01:18:35 -0300 Subject: [PATCH 123/158] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index e4d9ec8e..386e7d73 100644 --- a/docs/README.md +++ b/docs/README.md @@ -171,7 +171,7 @@ Where *${NGINX_WEB}* is your proxy container name, which in the original `.env` or simply run: ```bash -docker run -dit -e VIRTUAL_HOST=your.domain.com --network=webproxy --name test-web httpd:alpine +docker run -dit -e VIRTUAL_HOST=your.domain.com --network=proxy --name test-web httpd:alpine ``` > If you want to test the Let's Encrypt certificate as well use `ssl_test.sh your.domain.com` From 7b59f3ab8c34ca752626a5f18d2249cb58a61073 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 3 Aug 2021 01:26:11 -0300 Subject: [PATCH 124/158] Update README.md --- .github/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/README.md b/.github/README.md index 0b729651..ef6dca6b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -52,8 +52,10 @@ I made a 5 minutes tutorial video to walk you through this project: [![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=E9BtHVr_v9I) -[![NGINX-Proxy-Automation](https://img.youtube.com/vi/E9BtHVr_v9I/0.jpg)](https://www.youtube.com/watch?v=E9BtHVr_v9I) - +

+ +

+ ## Further information πŸ““ For more instalation details please [click here](/docs/). From 5d669ff178b77fd91b57a2116a9a5a12ca8f52c5 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 5 Aug 2021 10:35:15 -0300 Subject: [PATCH 125/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index ef6dca6b..37479e33 100644 --- a/.github/README.md +++ b/.github/README.md @@ -44,7 +44,7 @@ or simply run: ./test.sh your.domain.com ``` -Update the lines above with your domain name which must have the DNS poiting to your public IP address in your server +Use your own domain name when testing this proxy and make sure your DNS is correctly configured. ## Video Tutorial πŸŽ₯ From 753a8e95bd6cea5a27fa5f691a02ea3969d2a184 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 9 Aug 2021 19:55:28 -0300 Subject: [PATCH 126/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 37479e33..f9ac7f45 100644 --- a/.github/README.md +++ b/.github/README.md @@ -18,7 +18,7 @@ [![shell script](https://img.shields.io/badge/Shell_Script-121011?style=for-the-badge&logo=gnu-bash&logoColor=white)](https://github.com/evertramos) -1. Clone this repository using the option **_--recurse-submodules_** +1. Clone this repository using the option **_--recurse-submodules_** ⚠️ ```bash git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-automation.git proxy From 95c9ac7984b1c147f2fa44b8f94d051dc27a7d5c Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 10 Aug 2021 07:39:06 -0300 Subject: [PATCH 127/158] Launch of Server Automation Open source Server Automation - still under construction! --- .github/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index f9ac7f45..e7fd84a6 100644 --- a/.github/README.md +++ b/.github/README.md @@ -55,7 +55,13 @@ I made a 5 minutes tutorial video to walk you through this project:

- + +## Server Automation πŸš€ + +Make user you try our [Server Automation](https://github.com/evertramos/server-automation) + +[https://github.com/evertramos/server-automation](https://github.com/evertramos/server-automation) + ## Further information πŸ““ For more instalation details please [click here](/docs/). From d48b2477ed28cbda37738046079e35df219ba3e9 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 2 Sep 2021 07:11:04 -0300 Subject: [PATCH 128/158] #315 Fix sudoless actions in basescript and add ALLOW_RUN_WITH_SUDO option to nginx-proxy-automation --- .env.sample | 11 +++++++++++ basescript | 2 +- bin/.env | 2 +- bin/fresh-start.sh | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.env.sample b/.env.sample index f9331bc0..9c2f165b 100644 --- a/.env.sample +++ b/.env.sample @@ -8,6 +8,17 @@ # #----------------------------------------------------------------------- +#----------------------------------------------------------------------- +# +# Script requirements +# + +# PID file the running script +PID_FILE=.fresh_start.pid + +# Allow run commands with sudo if needed +ALLOW_RUN_WITH_SUDO=false + #----------------------------------------------------------------------- # # NGINX-Proxy containers/service diff --git a/basescript b/basescript index 9716afb7..9f1de1f1 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 9716afb7830e3791d6554fe821059fe3274c43f9 +Subproject commit 9f1de1f182d1d6f47ef931ee8d6145686718694e diff --git a/bin/.env b/bin/.env index c85f2c9d..46871255 100644 --- a/bin/.env +++ b/bin/.env @@ -57,4 +57,4 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # md5 checksum for .env and docker-compose.yml files # MD5_SUM_DOCKER_COMPOSE=11b79cee40db0714cb35d0bce182cf3e -MD5_SUM_ENV_SAMPLE=7a8b027dc2bf252a8c91d23f74e2bd2a +MD5_SUM_ENV_SAMPLE=2c7e33f99c31b958eb1f524090fe4fa1 diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 50ab85bc..39ffb8f1 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -515,7 +515,7 @@ done run_function check_local_env_file # Specific PID File if needs to run multiple scripts -NEW_PID_FILE=${PID_FILE_FRESH_INSTALL:-".fresh_start"} +NEW_PID_FILE=${PID_FILE_FRESH_INSTALL:-".fresh_start.pid"} # Run initial check function run_function starts_initial_check $NEW_PID_FILE From 6f0b72a9c70b054bd2ba53fa6a767a8ea152f557 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 2 Sep 2021 10:02:58 -0300 Subject: [PATCH 129/158] Remove '$' from the commands and add sudo options --- docs/README.md | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/docs/README.md b/docs/README.md index 386e7d73..b7e449f7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -43,7 +43,7 @@ Also, you will need to make sure you have: 1. Clone this repository **using the option _--recurse-submodules_**: ```bash -$ git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-automation.git proxy +git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-automation.git proxy ``` > Make sure you use the option '--recurse-submodules' once we use an external module in this project, please check @@ -54,8 +54,8 @@ $ git clone --recurse-submodules https://github.com/evertramos/nginx-proxy-autom 2. πŸš€ Run the script 'fresh_start.sh' ```bash -$ cd proxy/bin -$ ./fresh-start.sh +cd proxy/bin +./fresh-start.sh ``` This script will walk you through all config process. @@ -81,21 +81,21 @@ the default please update the option *'NETWORK'* in the examples below before ru - Simple site without Let's Encrypt certificate ```bash -$ docker run -d -e VIRTUAL_HOST=your.domain.com \ - --network=proxy \ - --name my_app \ - httpd:alpine +docker run -d -e VIRTUAL_HOST=your.domain.com \ + --network=proxy \ + --name my_app \ + httpd:alpine ``` - To have SSL in your web/app you must add the option `-e LETSENCRYPT_HOST=your.domain.com`, as follow: ```bash -$ docker run -d -e VIRTUAL_HOST=your.domain.com \ - -e LETSENCRYPT_HOST=your.domain.com \ - -e LETSENCRYPT_EMAIL=your.email@your.domain.com \ - --network=proxy \ - --name my_app \ - httpd:alpine +docker run -d -e VIRTUAL_HOST=your.domain.com \ + -e LETSENCRYPT_HOST=your.domain.com \ + -e LETSENCRYPT_EMAIL=your.email@your.domain.com \ + --network=proxy \ + --name my_app \ + httpd:alpine ``` > You donΒ΄t need to open port *443* in your container, the certificate validation is managed by the web proxy @@ -112,8 +112,8 @@ In order to be able to secure your virtual host with basic authentication, you m within `${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}` via: ```bash -$ sudo sh -c "echo -n '[username]:' >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" -$ sudo sh -c "openssl passwd -apr1 >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" +sudo sh -c "echo -n '[username]:' >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" +sudo sh -c "openssl passwd -apr1 >> ${NGINX_FILES_PATH}/htpasswd/${VIRTUAL_HOST}" ``` > Please replace the `${NGINX_FILES_PATH}` with real path to information, replace `[username]` with your username and `${VIRTUAL_HOST}` with your host's domain. You will be prompted for a password. @@ -159,6 +159,14 @@ docker exec -it ${NGINX_WEB} nginx -s reload Where *${NGINX_WEB}* is your proxy container name, which in the original `.env` file is set as *nginx-web*. +5. **sudo** options + +If you need to save the nginx-proxy data files in a folder which the user running 'fresh-start.sh' script does not have access, you might accomplish that using _sudo_. In order to allow the script to run some commands with _sudo_ you need to set _true_ to the variable ['ALLOW_RUN_WITH_SUDO'](https://github.com/evertramos/nginx-proxy-automation/blob/d48b2477ed28cbda37738046079e35df219ba3e9/.env.sample#L20) at '.env.sample' file **before** running fresh-start.sh script, as of: + +```bash +# Allow run commands with sudo if needed +ALLOW_RUN_WITH_SUDO=true +``` ## Testing nginx-proxy From d788df98e629262332a6eccf8c0febfbcccfaa03 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 6 Sep 2021 12:54:57 -0300 Subject: [PATCH 130/158] Add code contributors --- .github/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/README.md b/.github/README.md index e7fd84a6..ca89b51a 100644 --- a/.github/README.md +++ b/.github/README.md @@ -71,3 +71,7 @@ For more instalation details please [click here](/docs/). [![image](https://img.shields.io/badge/picpay-21C25E?style=for-the-badge&logo=picpay&logoColor=white)](https://picpay.me/evert.ramos) [List of all supporters](https://github.com/evertramos/evertramos/blob/main/pages/supporters.md). + +## Code Contributors + +[](https://github.com/evertramos/nginx-proxy-automation/graphs/contributors) From 663147f4edf9a24c6ad41299bea6c9b3836d9b52 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 6 Sep 2021 12:56:02 -0300 Subject: [PATCH 131/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index ca89b51a..5e7ad79b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -74,4 +74,4 @@ For more instalation details please [click here](/docs/). ## Code Contributors -[](https://github.com/evertramos/nginx-proxy-automation/graphs/contributors) +[](https://opencollective.com/nginx-proxy-automation) From d80f9e7b842e159d70eb32891c9387de34b750f7 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 6 Sep 2021 12:59:29 -0300 Subject: [PATCH 132/158] Remove open collective button --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 5e7ad79b..f7cb140c 100644 --- a/.github/README.md +++ b/.github/README.md @@ -74,4 +74,4 @@ For more instalation details please [click here](/docs/). ## Code Contributors -[](https://opencollective.com/nginx-proxy-automation) +[](https://opencollective.com/nginx-proxy-automation) From 9b9f7058b3563de0cec6ff481bb123450575ec32 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Mon, 6 Sep 2021 13:02:16 -0300 Subject: [PATCH 133/158] Remove Open Collective --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 4bd6c499..298fd08e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,7 +2,7 @@ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: evertramos -open_collective: nginx-proxy-automation +open_collective: # nginx-proxy-automation ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry From 41e9935b73059ff72d28569f6a9d834f61c43049 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 29 Sep 2021 11:07:09 -0300 Subject: [PATCH 134/158] #329 Update nginx-proxy images --- bin/.env | 8 ++++---- docker-compose.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/.env b/bin/.env index 46871255..2225f139 100644 --- a/bin/.env +++ b/bin/.env @@ -21,16 +21,16 @@ DEFAULT_NGINX_PROXY_IMAGE_VERSION="stable-alpine" # Docker-gen default image, version and service name # DEFAULT_DOCKER_GEN_SERVICE_NAME=docker-gen -DEFAULT_LETSENCRYPT_IMAGE_NAME="jrcs/letsencrypt-nginx-proxy-companion" -DEFAULT_LETSENCRYPT_IMAGE_VERSION="2.0" +DEFAULT_LETSENCRYPT_IMAGE_NAME="nginxproxy/docker-gen" +DEFAULT_LETSENCRYPT_IMAGE_VERSION="2.1" #----------------------------------------------------------------------- # # Letsencrypt-nginx-proxy-companion default image, version and service name # DEFAULT_LETSENCRYPT_SERVICE_NAME=letsencrypt-companion -DEFAULT_DOCKER_GEN_IMAGE_NAME="jwilder/docker-gen" -DEFAULT_DOCKER_GEN_IMAGE_VERSION="0.7.3" +DEFAULT_DOCKER_GEN_IMAGE_NAME="nginxproxy/acme-companion" +DEFAULT_DOCKER_GEN_IMAGE_VERSION="0.7.7" #----------------------------------------------------------------------- # diff --git a/docker-compose.yml b/docker-compose.yml index f8c428e7..43271496 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: max-file: ${NGINX_WEB_LOG_MAX_FILE:-10} nginx-proxy-automation-gen: - image: jwilder/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-latest} + image: nginxproxy/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-latest} command: -notify-sighup ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf container_name: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} restart: always @@ -48,7 +48,7 @@ services: max-file: ${NGINX_GEN_LOG_MAX_FILE:-10} nginx-proxy-automation-letsencrypt: - image: jrcs/letsencrypt-nginx-proxy-companion:${NGINX_PROXY_COMPANION_IMAGE_VERSION:-2.0} + image: nginxproxy/acme-companion:${NGINX_PROXY_COMPANION_IMAGE_VERSION:-2.0} container_name: ${LETS_ENCRYPT_SEVICE_NAME:-nginx-proxy-automation-letsencrypt} restart: always volumes: From 4879d7de27261cde73b2b184a498f29446c5fba6 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 29 Sep 2021 11:16:36 -0300 Subject: [PATCH 135/158] #329 Update nginx-proxy image and versions --- bin/.env | 8 ++++---- docker-compose.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/.env b/bin/.env index 2225f139..9bab47bf 100644 --- a/bin/.env +++ b/bin/.env @@ -21,16 +21,16 @@ DEFAULT_NGINX_PROXY_IMAGE_VERSION="stable-alpine" # Docker-gen default image, version and service name # DEFAULT_DOCKER_GEN_SERVICE_NAME=docker-gen -DEFAULT_LETSENCRYPT_IMAGE_NAME="nginxproxy/docker-gen" -DEFAULT_LETSENCRYPT_IMAGE_VERSION="2.1" +DEFAULT_DOCKER_GEN_IMAGE_NAME="nginxproxy/docker-gen" +DEFAULT_DOCKER_GEN_IMAGE_VERSION="0.7.7" #----------------------------------------------------------------------- # # Letsencrypt-nginx-proxy-companion default image, version and service name # DEFAULT_LETSENCRYPT_SERVICE_NAME=letsencrypt-companion -DEFAULT_DOCKER_GEN_IMAGE_NAME="nginxproxy/acme-companion" -DEFAULT_DOCKER_GEN_IMAGE_VERSION="0.7.7" +DEFAULT_LETSENCRYPT_IMAGE_NAME="nginxproxy/acme-companion" +DEFAULT_LETSENCRYPT_IMAGE_VERSION="2.1" #----------------------------------------------------------------------- # diff --git a/docker-compose.yml b/docker-compose.yml index 43271496..43e28537 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: max-file: ${NGINX_WEB_LOG_MAX_FILE:-10} nginx-proxy-automation-gen: - image: nginxproxy/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-latest} + image: nginxproxy/docker-gen:${DOCKER_GEN_IMAGE_VERSION:-0.7.7} command: -notify-sighup ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf container_name: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} restart: always @@ -48,7 +48,7 @@ services: max-file: ${NGINX_GEN_LOG_MAX_FILE:-10} nginx-proxy-automation-letsencrypt: - image: nginxproxy/acme-companion:${NGINX_PROXY_COMPANION_IMAGE_VERSION:-2.0} + image: nginxproxy/acme-companion:${NGINX_PROXY_COMPANION_IMAGE_VERSION:-2.1} container_name: ${LETS_ENCRYPT_SEVICE_NAME:-nginx-proxy-automation-letsencrypt} restart: always volumes: From 6500ded0ffcd072d82a68bcd5d23ec6b2f2194d6 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Wed, 29 Sep 2021 11:17:00 -0300 Subject: [PATCH 136/158] #329 Update nginx-proxy image and versions (checksum) --- bin/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/.env b/bin/.env index 9bab47bf..496d589f 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=11b79cee40db0714cb35d0bce182cf3e +MD5_SUM_DOCKER_COMPOSE=e431d5e4577b7f88ee430d8ce2a772e0 MD5_SUM_ENV_SAMPLE=2c7e33f99c31b958eb1f524090fe4fa1 From e11a9bf1c6de80edc42d6d3e9ba00a8188ff7bf0 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 28 Oct 2021 23:21:44 -0300 Subject: [PATCH 137/158] Update the network structure --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 43e28537..93fdfbba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -70,6 +70,6 @@ services: networks: default: - external: - name: ${NETWORK:-proxy} + external: true + name: ${NETWORK:-proxy} From 25bb58926e132e75256fd91bca00ea13a7835966 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 23 Nov 2021 10:06:32 -0300 Subject: [PATCH 138/158] Update checksum --- bin/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/.env b/bin/.env index 496d589f..b2feb00a 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=e431d5e4577b7f88ee430d8ce2a772e0 +MD5_SUM_DOCKER_COMPOSE=74f8a094210c8082cec06c3d3cde3f57 MD5_SUM_ENV_SAMPLE=2c7e33f99c31b958eb1f524090fe4fa1 From 578ea0b94ccc3a78c13d6c3e983d8e6e3fc31694 Mon Sep 17 00:00:00 2001 From: Rakshit Menpara <205111+deltasquare4@users.noreply.github.com> Date: Mon, 20 Dec 2021 17:34:41 +0530 Subject: [PATCH 139/158] fix fresh-start crash with recent docker-compose (#341) `networks..name` is only valid for compose v3.5 and above --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 93fdfbba..7d521dc8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: '3.5' services: nginx-proxy-automation-web: From 79f3608387293491091f9264cbcd0badfd87c39d Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 5 Feb 2022 20:03:11 -0300 Subject: [PATCH 140/158] Update README.md --- .github/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/README.md b/.github/README.md index f7cb140c..d019009a 100644 --- a/.github/README.md +++ b/.github/README.md @@ -48,9 +48,9 @@ Use your own domain name when testing this proxy and make sure your DNS is corre ## Video Tutorial πŸŽ₯ -I made a 5 minutes tutorial video to walk you through this project: +I made a tutorial video to walk you through this project: -[![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=E9BtHVr_v9I) +[![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=eiTivLeIkm0)

From 2020e9d50ebb88278f11f7c4d31abd5a78859fc9 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sat, 5 Feb 2022 20:03:55 -0300 Subject: [PATCH 141/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index d019009a..3c589b6a 100644 --- a/.github/README.md +++ b/.github/README.md @@ -53,7 +53,7 @@ I made a tutorial video to walk you through this project: [![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=eiTivLeIkm0)

- +

## Server Automation πŸš€ From 7aaa423c1fdb858d8067468c900aeeb9b9410730 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 6 Feb 2022 10:06:10 -0300 Subject: [PATCH 142/158] Update README.md --- .github/README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 3c589b6a..0c6f1e99 100644 --- a/.github/README.md +++ b/.github/README.md @@ -50,12 +50,21 @@ Use your own domain name when testing this proxy and make sure your DNS is corre I made a tutorial video to walk you through this project: -[![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=eiTivLeIkm0) +[![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/channel/UCN5wb0eA3ZLlvJNYo23qBRQ) + +### AWS EC2

+### OVH + +

+ +

+ + ## Server Automation πŸš€ Make user you try our [Server Automation](https://github.com/evertramos/server-automation) From d096f645416d83dff6e88be49ac5d19929380558 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 6 Feb 2022 10:06:36 -0300 Subject: [PATCH 143/158] Update README.md --- .github/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/README.md b/.github/README.md index 0c6f1e99..56efa763 100644 --- a/.github/README.md +++ b/.github/README.md @@ -55,16 +55,15 @@ I made a tutorial video to walk you through this project: ### AWS EC2

- +

### OVH

- +

- ## Server Automation πŸš€ Make user you try our [Server Automation](https://github.com/evertramos/server-automation) From 431d5753681dffc4cc5798df660bc6c056101c59 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 6 Feb 2022 10:27:32 -0300 Subject: [PATCH 144/158] Update README.md --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 56efa763..ef9d1bf5 100644 --- a/.github/README.md +++ b/.github/README.md @@ -55,7 +55,7 @@ I made a tutorial video to walk you through this project: ### AWS EC2

- +

### OVH From 8929d96b45c2170ca6895e4c4c198d304be1dcee Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 6 Feb 2022 12:13:10 -0300 Subject: [PATCH 145/158] Update README.md --- .github/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/README.md b/.github/README.md index ef9d1bf5..21816dc7 100644 --- a/.github/README.md +++ b/.github/README.md @@ -53,13 +53,16 @@ I made a tutorial video to walk you through this project: [![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/channel/UCN5wb0eA3ZLlvJNYo23qBRQ) ### AWS EC2 -

-### OVH +### Digital Ocean Droplet +

+ +

+### OVH

From 2875ea3ba936ffa30794e0c1de7e494584220aae Mon Sep 17 00:00:00 2001 From: Pathros Date: Sun, 13 Mar 2022 08:16:58 -0600 Subject: [PATCH 146/158] Docker rootless support (#311) * I added support for Docker Rootless. This has been possible by adding the possibility to bind the docker.sock to the user's current $XDG_RUNTIME_DIR, which is found in the user's .bashrc file, that he added after installing docker rootless, by following the instructions from the official documentation (https://docs.docker.com/engine/security/rootless/) to run the Docker Daemon as a non-root user. To achieve this, I made the following changes: 1) I added the DOCKER_HOST_ROOTLESS_PATH= variable inside the .env.sample file. 2) I updated in the two required lines of the docker-compose.yml file, the following: ${DOCKER_HOST_ROOTLESS_PATH:-/var/run/docker.sock} , instead of /var/run/docker.sock:/tmp/docker.sock:ro, so that this fixes the "Error: you need to share your Docker host socket with a volume at /var/run/docker.sock. Typically you should run your container with: '-v /var/run/docker.sock:/var/run/docker.sock:ro'" error when using docker rootless. 3) I attempted to update the MD5 of both the .env.sample & docker-compose.yml file [PLEASE CHECK] 4) I updated the usage text in the usage-fresh-start.sh file, so that the user can notice this optional flag: either "-dr" or "--docker-rootless" 5) I updated the update-env-new-site-variables.sh to update the .env DOCKER_HOST_ROOTLESS_PATH to set the user's current $XDG_RUNTIME_DIR, in case the "-dr" flag has been specified. Otherwise, this is left blank and no further action is done. 6) I updated the fresh-start.sh file to take into account the "-dr" flag. Shouldn't the "-dr" flag be specified, the programme should continue normally. * Fixed an important typo in docker-compose.yml * Updated the docker-compose.yml file md5 sum Co-authored-by: Evert Ramos --- .env.sample | 12 +++++++++++ bin/fresh-start.sh | 20 +++++++++++++++++++ .../update-env-new-site-variables.sh | 3 +++ bin/localscript/usage-fresh-start.sh | 5 +++++ docker-compose.yml | 4 ++-- 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/.env.sample b/.env.sample index 9c2f165b..cc05fc81 100644 --- a/.env.sample +++ b/.env.sample @@ -132,3 +132,15 @@ DEFAULT_EMAIL=mail@yourdomain.tld # https://github.com/nginx-proxy/nginx-proxy#default-host # DEFAULT_HOST= + +#----------------------------------------------------------------------- +# +# Docker Rootless +# +# In case you want to use this proxy on Docker Rootless (DR) and you also have followed +# the DR installation from the official documentation (https://docs.docker.com/engine/security/rootless/) +# Set the following value of the DOCKER_HOST variable that you got in the final info messages after executing +# the "$ dockerd-rootless-setuptool.sh install" command. +# For example DOCKER_HOST_PATH=$XDG_RUNTIME_DIR/docker.sock +# If you are not using Docker Rootless, leave this variable blank +DOCKER_HOST_ROOTLESS_PATH= \ No newline at end of file diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 39ffb8f1..9d2a8ce9 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -429,6 +429,16 @@ while [[ $# -gt 0 ]]; do shift 1 ;; + # Docker rootless support + -dr) + USE_DOCKER_ROOTLESS=true + shift 1 + ;; + --docker-rootless) + USE_DOCKER_ROOTLESS=true + shift 1 + ;; + # IPv4 options --ipv4-subnet=*) ARG_IPv4_SUBNET="${1#*=}" @@ -1121,6 +1131,16 @@ DOCKER_HTTPS=${ARG_DOCKER_HTTPS:-"443"} #----------------------------------------------------------------------- SSL_POLICY=${ARG_SSL_POLICY:-"Mozilla-Intermediate"} +#----------------------------------------------------------------------- +# Docker rootless support. Add the current user's docker.sock path (default: blank) +# Please read the official documentation of installing Docker Rootless: +# https://docs.docker.com/engine/security/rootless/ +#----------------------------------------------------------------------- +if [[ "$USE_DOCKER_ROOTLESS" == true ]]; then + # Get the current user's $XDG_RUNTIME_DIR and concat with the '/docker.sock' + DOCKER_HOST_ROOTLESS_PATH=`echo ${XDG_RUNTIME_DIR}/docker.sock` +fi + #----------------------------------------------------------------------- # Start actions! #----------------------------------------------------------------------- diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index 3a5d9d11..42b8c1a0 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -78,5 +78,8 @@ local_update_env_new_site_variables() # Default host [[ ! $ARG_DEFAULT_HOST == "" ]] && run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_HOST" "${ARG_DEFAULT_HOST}" + # Docker rootless support + run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_HOST_ROOTLESS_PATH" "$DOCKER_HOST_ROOTLESS_PATH" + return 0 } diff --git a/bin/localscript/usage-fresh-start.sh b/bin/localscript/usage-fresh-start.sh index 2493ec54..9496cb90 100755 --- a/bin/localscript/usage-fresh-start.sh +++ b/bin/localscript/usage-fresh-start.sh @@ -64,6 +64,7 @@ Usage: [--use-nginx-conf-files] [--update-nginx-template] [--yes] [--debug] + [--docker-rootless] Required -e | --default-email Default email address require to issue ssl @@ -131,6 +132,10 @@ Usage: --yes Set "yes" to all, use it with caution --debug Show script debug options --silent Hide all script message + -dr | --docker-rootless Add Docker rootless support by adding the + the current user's $XDG_RUNTIME_DIR and + concat with the '/docker.sock' in the + DOCKER_HOST_ROOTLESS_PATH .env file. -h | --help Display this help ${reset} diff --git a/docker-compose.yml b/docker-compose.yml index 7d521dc8..bc7fb1c9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,7 +39,7 @@ services: - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:ro - ${NGINX_FILES_PATH:-./data}/htpasswd:/etc/nginx/htpasswd:ro - - /var/run/docker.sock:/tmp/docker.sock:ro + - ${DOCKER_HOST_ROOTLESS_PATH:-/var/run/docker.sock}:/tmp/docker.sock:ro - ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro logging: driver: ${NGINX_GEN_LOG_DRIVER:-json-file} @@ -57,7 +57,7 @@ services: - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:rw - ${NGINX_FILES_PATH:-./data}/acme.sh:/etc/acme.sh - - /var/run/docker.sock:/var/run/docker.sock:ro + - ${DOCKER_HOST_ROOTLESS_PATH:-/var/run/docker.sock}:/var/run/docker.sock:ro environment: NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN_SEVICE_NAME:-nginx-proxy-automation-gen} NGINX_PROXY_CONTAINER: ${NGINX_WEB_SEVICE_NAME:-nginx-proxy-automation-web} From 3953465fe3c588a2ebcdb6cfd59b358ddd6721bc Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 17 Mar 2022 07:11:31 -0300 Subject: [PATCH 147/158] Fix dockerrootless env update --- bin/localscript/update-env-new-site-variables.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/localscript/update-env-new-site-variables.sh b/bin/localscript/update-env-new-site-variables.sh index 42b8c1a0..26336db6 100755 --- a/bin/localscript/update-env-new-site-variables.sh +++ b/bin/localscript/update-env-new-site-variables.sh @@ -79,7 +79,7 @@ local_update_env_new_site_variables() [[ ! $ARG_DEFAULT_HOST == "" ]] && run_function env_update_variable $LOCAL_FILE_PATH "DEFAULT_HOST" "${ARG_DEFAULT_HOST}" # Docker rootless support - run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_HOST_ROOTLESS_PATH" "$DOCKER_HOST_ROOTLESS_PATH" + [[ "$USE_DOCKER_ROOTLESS" == true ]] && run_function env_update_variable $LOCAL_FILE_PATH "DOCKER_HOST_ROOTLESS_PATH" "$DOCKER_HOST_ROOTLESS_PATH" return 0 } From 5b66f76f29a58f2928e6b1092c66869466a11146 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Thu, 17 Mar 2022 07:12:50 -0300 Subject: [PATCH 148/158] Update checksum --- bin/.env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/.env b/bin/.env index b2feb00a..4f178d9f 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=74f8a094210c8082cec06c3d3cde3f57 -MD5_SUM_ENV_SAMPLE=2c7e33f99c31b958eb1f524090fe4fa1 +MD5_SUM_DOCKER_COMPOSE=54590c26c4f3d0ce52ef9ea4268d1408 +MD5_SUM_ENV_SAMPLE=c790c227c850cd2be25d1b071f31f6b3 From 3356364836555c6aa191b5550ae6a2ce8d094cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Helfensd=C3=B6rfer?= Date: Mon, 24 Oct 2022 12:55:18 +0200 Subject: [PATCH 149/158] Update README.md (#361) --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 21816dc7..0d8daba8 100644 --- a/.github/README.md +++ b/.github/README.md @@ -75,7 +75,7 @@ Make user you try our [Server Automation](https://github.com/evertramos/server-a ## Further information πŸ““ -For more instalation details please [click here](/docs/). +For more installation details please [click here](/docs/). ## Supporting β™₯️ [![Patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/evertramos) From 069539186f3e820d2e4516bcd324cb98ad909512 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 22 Nov 2022 08:01:29 -0300 Subject: [PATCH 150/158] Update basescript to latest version --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index 9f1de1f1..13f71c28 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 9f1de1f182d1d6f47ef931ee8d6145686718694e +Subproject commit 13f71c28c8adbd8777944ca11b923c28bd735967 From 56d1c5b29d1bd5a8b3b5e0b18e89b7d6588df381 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 22 Nov 2022 08:01:52 -0300 Subject: [PATCH 151/158] Update nginxproxy version --- bin/.env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/.env b/bin/.env index 4f178d9f..3438caf5 100644 --- a/bin/.env +++ b/bin/.env @@ -22,7 +22,7 @@ DEFAULT_NGINX_PROXY_IMAGE_VERSION="stable-alpine" # DEFAULT_DOCKER_GEN_SERVICE_NAME=docker-gen DEFAULT_DOCKER_GEN_IMAGE_NAME="nginxproxy/docker-gen" -DEFAULT_DOCKER_GEN_IMAGE_VERSION="0.7.7" +DEFAULT_DOCKER_GEN_IMAGE_VERSION="0.9" #----------------------------------------------------------------------- # @@ -30,7 +30,7 @@ DEFAULT_DOCKER_GEN_IMAGE_VERSION="0.7.7" # DEFAULT_LETSENCRYPT_SERVICE_NAME=letsencrypt-companion DEFAULT_LETSENCRYPT_IMAGE_NAME="nginxproxy/acme-companion" -DEFAULT_LETSENCRYPT_IMAGE_VERSION="2.1" +DEFAULT_LETSENCRYPT_IMAGE_VERSION="2.2" #----------------------------------------------------------------------- # From 9ca40901ebf84104e9dcf7a268aca47342a907ae Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 22 Nov 2022 08:03:09 -0300 Subject: [PATCH 152/158] Skip tag listing and image check --- bin/fresh-start.sh | 57 +++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 9d2a8ce9..4a637398 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -899,7 +899,7 @@ NGINX_PROXY_IMAGE_VERSION=${ARG_NGINX_PROXY_IMAGE_VERSION:-$LOCAL_DEFAULT_NGINX_ #fi # Final check image a version with dockerhub -[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME $NGINX_PROXY_IMAGE_VERSION +#[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_NGINX_PROXY_IMAGE_NAME $NGINX_PROXY_IMAGE_VERSION #----------------------------------------------------------------------- # Let's Encrypt image version @@ -912,12 +912,21 @@ NGINX_PROXY_IMAGE_VERSION=${ARG_NGINX_PROXY_IMAGE_VERSION:-$LOCAL_DEFAULT_NGINX_ LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME=${DEFAULT_LETSENCRYPT_IMAGE_NAME:-null} LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION=${DEFAULT_LETSENCRYPT_IMAGE_VERSION:-null} if [[ $ARG_LETSENCRYPT_IMAGE_VERSION == "" ]] && [[ ! "$REPLY_YES" == true ]]; then - # Get user's response - run_function dockerhub_list_tags $LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME - run_function select_one_option "${DOCKERHUB_LIST_TAGS[*]}" "Please select a tag for the image '$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME' (the list below comes from https://hub.docker.com):" - [[ $SELECT_ONE_OPTION_NAME == "" ]] && echowarning "Once you did not select any option, '$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION' will be used." - LETSENCRYPT_IMAGE_VERSION=${SELECT_ONE_OPTION_NAME:-$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION} + # ------- + # docker hub api v2 does not allow to get tags from personal repos without login + # @todo - fix this with user login + # ------- + + LETSENCRYPT_IMAGE_VERSION=${LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION} + + + # Get user's response (COMMENTED - TO BE FIXED) +# run_function dockerhub_list_tags $LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME +# run_function select_one_option "${DOCKERHUB_LIST_TAGS[*]}" "Please select a tag for the image '$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME' (the list below comes from https://hub.docker.com):" +# +# [[ $SELECT_ONE_OPTION_NAME == "" ]] && echowarning "Once you did not select any option, '$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION' will be used." +# LETSENCRYPT_IMAGE_VERSION=${SELECT_ONE_OPTION_NAME:-$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION} else LETSENCRYPT_IMAGE_VERSION=${ARG_LETSENCRYPT_IMAGE_VERSION:-$LOCAL_DEFAULT_LETSENCRYPT_IMAGE_VERSION} fi @@ -926,8 +935,13 @@ if [[ "$LETSENCRYPT_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_LETSENCRYPT_ echoerror "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" fi -# Final check image a version with dockerhub -[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME $LETSENCRYPT_IMAGE_VERSION +# ------- +# docker hub api v2 does not allow to get tags from personal repos without login +# @todo - fix this with user login +# ------- + +# Final check image a version with dockerhub (COMMENTED - TO BE FIXED) +#[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_LETSENCRYPT_IMAGE_NAME $LETSENCRYPT_IMAGE_VERSION #----------------------------------------------------------------------- # docker-gen image version @@ -940,12 +954,18 @@ fi LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME=${DEFAULT_DOCKER_GEN_IMAGE_NAME:-null} LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION=${DEFAULT_DOCKER_GEN_IMAGE_VERSION:-null} if [[ $ARG_DOCKER_GEN_IMAGE_VERSION == "" ]] && [[ ! "$REPLY_YES" == true ]]; then - # Get user's response - run_function dockerhub_list_tags $LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME false - run_function select_one_option "${DOCKERHUB_LIST_TAGS[*]}" "Please select a tag for the image '$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME' (the list below comes from https://hub.docker.com):" - - [[ $SELECT_ONE_OPTION_NAME == "" ]] && echowarning "Once you did not select any option, '$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION' will be used." - DOCKER_GEN_IMAGE_VERSION=${SELECT_ONE_OPTION_NAME:-$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION} + # ------- + # docker hub api v2 does not allow to get tags from personal repos without login + # @todo - fix this with user login + # ------- + +# # Get user's response (COMMENTED - TO BE FIXED) +# run_function dockerhub_list_tags $LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME false +# run_function select_one_option "${DOCKERHUB_LIST_TAGS[*]}" "Please select a tag for the image '$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME' (the list below comes from https://hub.docker.com):" +# +# [[ $SELECT_ONE_OPTION_NAME == "" ]] && echowarning "Once you did not select any option, '$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION' will be used." +# DOCKER_GEN_IMAGE_VERSION=${SELECT_ONE_OPTION_NAME:-$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION} + DOCKER_GEN_IMAGE_VERSION=${ARG_DOCKER_GEN_IMAGE_VERSION:-$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION} else DOCKER_GEN_IMAGE_VERSION=${ARG_DOCKER_GEN_IMAGE_VERSION:-$LOCAL_DEFAULT_DOCKER_GEN_IMAGE_VERSION} fi @@ -954,8 +974,13 @@ if [[ "$DOCKER_GEN_IMAGE_VERSION" == null ]] || [[ "$LOCAL_DEFAULT_DOCKER_GEN_IM echoerror "It seems there is no default image or version, please check the .env file at '$SCRIPT_PATH'" fi -# Final check image a version with dockerhub -[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME $DOCKER_GEN_IMAGE_VERSION +# ------- +# docker hub api v2 does not allow to get tags from personal repos without login +# @todo - fix this with user login +# ------- + +# Final check image a version with dockerhub (COMMENTED - TO BE FIXED) +#[[ "$SKIP_DOCKER_IMAGE_CHECK" != true ]] && [[ ! "$REPLY_YES" == true ]] && local_check_docker_hub_image_version $LOCAL_DEFAULT_DOCKER_GEN_IMAGE_NAME $DOCKER_GEN_IMAGE_VERSION #----------------------------------------------------------------------- # IP address (IPv4) From 4b20a9b19789b58af051b52c9e4380de21b16e07 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 22 Nov 2022 08:04:20 -0300 Subject: [PATCH 153/158] Update checksum --- bin/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/.env b/bin/.env index 3438caf5..2afd001f 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=54590c26c4f3d0ce52ef9ea4268d1408 +MD5_SUM_DOCKER_COMPOSE=e44c0284665509135da1b8b2d8ffebd5 MD5_SUM_ENV_SAMPLE=c790c227c850cd2be25d1b071f31f6b3 From d7a63060310e73ecf9140add63e2a91c103b86d6 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Tue, 22 Nov 2022 08:06:39 -0300 Subject: [PATCH 154/158] Update checksum --- bin/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/.env b/bin/.env index 2afd001f..3438caf5 100644 --- a/bin/.env +++ b/bin/.env @@ -56,5 +56,5 @@ REPLACE_LETSENCRYPT_SERVICE_NAME="nginx-proxy-automation-letsencrypt" # # md5 checksum for .env and docker-compose.yml files # -MD5_SUM_DOCKER_COMPOSE=e44c0284665509135da1b8b2d8ffebd5 +MD5_SUM_DOCKER_COMPOSE=54590c26c4f3d0ce52ef9ea4268d1408 MD5_SUM_ENV_SAMPLE=c790c227c850cd2be25d1b071f31f6b3 From 302edd6c06f6f99fde3dbc0b90a119cb0e5da232 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 27 Nov 2022 10:14:50 -0300 Subject: [PATCH 155/158] Update basescript log permissions --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index 13f71c28..40d4b9ba 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 13f71c28c8adbd8777944ca11b923c28bd735967 +Subproject commit 40d4b9ba11b17c36699510e12969de6899125734 From b8cb8501cc368b5de0289b4bc1e8d2b0bc367308 Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 27 Nov 2022 10:22:26 -0300 Subject: [PATCH 156/158] Update docker compose to newest version --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index 40d4b9ba..c2b581aa 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit 40d4b9ba11b17c36699510e12969de6899125734 +Subproject commit c2b581aa4f31e6de87ed6389d697545c07862b29 From 2deda16f98a11aeba7bd2ac77ec84a0bed82ddaf Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 27 Nov 2022 10:29:00 -0300 Subject: [PATCH 157/158] Fix missing space in docker compose command --- bin/fresh-start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/fresh-start.sh b/bin/fresh-start.sh index 4a637398..e2410b51 100755 --- a/bin/fresh-start.sh +++ b/bin/fresh-start.sh @@ -613,7 +613,7 @@ local_check_docker_hub_image_version() { } #----------------------------------------------------------------------- -# Check if the docker-compose is already running +# Check if the docker compose is already running #----------------------------------------------------------------------- LOCAL_DOCKER_COMPOSE_FILE_FULL_PATH="$SCRIPT_PATH/../ " run_function docker_compose_check_service_exists $LOCAL_DOCKER_COMPOSE_FILE_FULL_PATH From 0c3a78af89fdd5dc95327ddb1ee9a66f5097098a Mon Sep 17 00:00:00 2001 From: Evert Ramos Date: Sun, 27 Nov 2022 10:29:10 -0300 Subject: [PATCH 158/158] update basescript --- basescript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basescript b/basescript index c2b581aa..d223a5f4 160000 --- a/basescript +++ b/basescript @@ -1 +1 @@ -Subproject commit c2b581aa4f31e6de87ed6389d697545c07862b29 +Subproject commit d223a5f41324f163baa793de6b8b221cdad84b58