Browse Source

first commit

master
Christoph Haas 5 months ago
commit
5e3dcd47ca
17 changed files with 1156 additions and 0 deletions
  1. 95
    0
      .env.sample
  2. 4
    0
      .gitignore
  3. 21
    0
      LICENSE
  4. 261
    0
      README.md
  5. 50
    0
      conf.d/realip.conf
  6. 7
    0
      conf.d/servertokens.conf
  7. 7
    0
      conf.d/uploadsize.conf
  8. 77
    0
      docker-compose-multiple-networks.yml
  9. 65
    0
      docker-compose.yml
  10. 27
    0
      docs/HOWTO-Synlogy.md
  11. 361
    0
      nginx.tmpl
  12. 18
    0
      scripts/base.sh
  13. 42
    0
      scripts/update.sh
  14. 68
    0
      start.sh
  15. 22
    0
      test_start.sh
  16. 25
    0
      test_start_ssl.sh
  17. 6
    0
      test_stop.sh

+ 95
- 0
.env.sample
File diff suppressed because it is too large
View File


+ 4
- 0
.gitignore View File

@@ -0,0 +1,4 @@
1
+data
2
+.env*
3
+!.env.sample
4
+.DS_Store

+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
1
+MIT License
2
+
3
+Copyright (c) 2017 Evert Ramos
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+SOFTWARE.

+ 261
- 0
README.md
File diff suppressed because it is too large
View File


+ 50
- 0
conf.d/realip.conf
File diff suppressed because it is too large
View File


+ 7
- 0
conf.d/servertokens.conf View File

@@ -0,0 +1,7 @@
1
+#
2
+# [WARNING] To enable this files you need to uncomment USE_NGINX_CONF_FILES=true in .env file
3
+#
4
+# [WARNING] Also, read all the comments in .env about NGINX use special conf files
5
+#
6
+
7
+server_tokens off;

+ 7
- 0
conf.d/uploadsize.conf View File

@@ -0,0 +1,7 @@
1
+#
2
+# [WARNING] To enable this files you need to uncomment USE_NGINX_CONF_FILES=true in .env file
3
+#
4
+# [WARNING] Also, read all the comments in .env about NGINX use special conf files
5
+#
6
+
7
+client_max_body_size 100m;

+ 77
- 0
docker-compose-multiple-networks.yml
File diff suppressed because it is too large
View File


+ 65
- 0
docker-compose.yml
File diff suppressed because it is too large
View File


+ 27
- 0
docs/HOWTO-Synlogy.md View File

@@ -0,0 +1,27 @@
1
+## Port mapping
2
+Synology default installs a web server on port 80 blocking certificate generation. 
3
+
4
+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:
5
+
6
+#
7
+# Set the local exposed ports for http and https - this will allow you to run with a legacy web 
8
+# server already installed for local use
9
+#
10
+# NOTE: For this to function your internet router must forward the official ports to the mapped ports - 
11
+#       in this example external port 80 to docker host 81 and external port 443 to docker host 444
12
+#
13
+DOCKER_HTTP=81
14
+DOCKER_HTTPS=444
15
+
16
+## File permissions
17
+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)
18
+
19
+mkdir -p data/certs
20
+mkdir data/htpasswd
21
+mkdir data/conf.d
22
+mkdir data/vhost.d
23
+mkdir data/html
24
+chgrp -R 101 data
25
+chmod -R g+rwx data
26
+
27
+Contributed by https://github.com/nicolailang/

+ 361
- 0
nginx.tmpl
File diff suppressed because it is too large
View File


+ 18
- 0
scripts/base.sh View File

@@ -0,0 +1,18 @@
1
+#!/bin/bash
2
+#
3
+# Basic scripts
4
+#
5
+
6
+# 1. Check if .env file exists
7
+check_env_file() {
8
+    if [ -e .env ]; then
9
+        source .env
10
+    else
11
+        echo
12
+        echo "Please set up your .env file before starting your enviornment."
13
+        echo
14
+        exit 1
15
+    fi
16
+}
17
+
18
+

+ 42
- 0
scripts/update.sh View File

@@ -0,0 +1,42 @@
1
+#!/bin/bash
2
+
3
+#
4
+# This scrip update the web proxy without downtime
5
+#
6
+# Source: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
7
+#
8
+
9
+# 1. Check if .env file exists
10
+if [ -e .env ]; then
11
+    source .env
12
+else 
13
+    echo 
14
+    echo "Please set up your .env file before starting your enviornment."
15
+    echo 
16
+    exit 1
17
+fi
18
+
19
+# 2. Update your repo
20
+git pull
21
+git checkout master
22
+
23
+# 3. Check if your env files has the same line numbers
24
+if [ "$(wc -l .env | cut -f1 -d' ')" != "$(wc -l .env.sample | cut -f1 -d' ')" ]; then
25
+    echo
26
+    echo "The sample .env are different from the your current .env file."
27
+    echo "Please update your .env file to continue."
28
+    echo "It must has the same lines of the sample env file."
29
+    echo
30
+    echo "If you keep receiving this message please check the number of line of both files"
31
+    echo
32
+fi
33
+
34
+# 3. Download the latest version of nginx.tmpl
35
+curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > nginx.tmpl
36
+
37
+# 4. Update containers without downtime
38
+docker-compose up -d --no-deps --build nginx-web
39
+docker-compose up -d --no-deps --build nginx-gen
40
+docker-compose up -d --no-deps --build nginx-letsencrypt
41
+
42
+exit 0

+ 68
- 0
start.sh
File diff suppressed because it is too large
View File


+ 22
- 0
test_start.sh View File

@@ -0,0 +1,22 @@
1
+#!/bin/bash
2
+
3
+# Set up your DOMAIN
4
+if [ $# -eq 0 ]; then
5
+    echo "Please inform your domain name to test your proxy."
6
+    echo "./test_start.sh $1"
7
+    exit 1
8
+else
9
+    DOMAIN=$1
10
+fi
11
+
12
+# Read your .env file
13
+source .env
14
+
15
+# Testing your proxy
16
+if [ -z ${SERVICE_NETWORK+X} ]; then
17
+    docker run -d -e VIRTUAL_HOST=$DOMAIN --network=$NETWORK --name test-web httpd:alpine
18
+else
19
+    docker run -d -e VIRTUAL_HOST=$DOMAIN --network=$SERVICE_NETWORK --name test-web httpd:alpine
20
+fi
21
+
22
+exit 0

+ 25
- 0
test_start_ssl.sh View File

@@ -0,0 +1,25 @@
1
+#!/bin/bash
2
+
3
+NAME=test-web
4
+
5
+
6
+# Set up your DOMAIN
7
+if [ $# -eq 0 ]; then
8
+    echo "Please inform your domain name to test your proxy."
9
+    echo "./test_start_ssl.sh $1"
10
+    exit 1
11
+else
12
+    DOMAIN=$1
13
+fi
14
+
15
+# Read your .env file
16
+source .env
17
+
18
+# Testing your proxy
19
+if [ -z ${SERVICE_NETWORK+X} ]; then
20
+    docker run -d -e VIRTUAL_HOST=$DOMAIN -e LETSENCRYPT_HOST=$DOMAIN --network=$NETWORK --name $NAME httpd:alpine
21
+else
22
+    docker run -d -e VIRTUAL_HOST=$DOMAIN -e LETSENCRYPT_HOST=$DOMAIN --network=$SERVICE_NETWORK --name $NAME httpd:alpine
23
+fi
24
+
25
+exit 0

+ 6
- 0
test_stop.sh View File

@@ -0,0 +1,6 @@
1
+#!/bin/bash
2
+
3
+# Stop and remove test enviornment
4
+docker stop test-web && docker rm test-web 
5
+
6
+exit 0

Loading…
Cancel
Save