Browse Source

first commit

master
Christoph Haas 10 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 @@
data
.env*
!.env.sample
.DS_Store

+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 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
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
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 @@
#
# [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
#

server_tokens off;

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

@@ -0,0 +1,7 @@
#
# [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
#

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

+ 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 @@
#!/bin/bash
#
# Basic scripts
#

# 1. Check if .env file exists
check_env_file() {
if [ -e .env ]; then
source .env
else
echo
echo "Please set up your .env file before starting your enviornment."
echo
exit 1
fi
}



+ 42
- 0
scripts/update.sh View File

@@ -0,0 +1,42 @@
#!/bin/bash

#
# This scrip update the web proxy without downtime
#
# 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
echo "Please set up your .env file before starting your enviornment."
echo
exit 1
fi

# 2. Update your repo
git pull
git checkout master

# 3. Check if your env files has the same line numbers
if [ "$(wc -l .env | cut -f1 -d' ')" != "$(wc -l .env.sample | cut -f1 -d' ')" ]; then
echo
echo "The sample .env are different from the your current .env file."
echo "Please update your .env file to continue."
echo "It must has the same lines of the sample env file."
echo
echo "If you keep receiving this message please check the number of line of both files"
echo
fi

# 3. Download the latest version of nginx.tmpl
curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > nginx.tmpl

# 4. Update containers without downtime
docker-compose up -d --no-deps --build nginx-web
docker-compose up -d --no-deps --build nginx-gen
docker-compose up -d --no-deps --build nginx-letsencrypt

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

+ 25
- 0
test_start_ssl.sh View File

@@ -0,0 +1,25 @@
#!/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

+ 6
- 0
test_stop.sh View File

@@ -0,0 +1,6 @@
#!/bin/bash

# Stop and remove test enviornment
docker stop test-web && docker rm test-web

exit 0

Loading…
Cancel
Save