remove old conf before generation, dynamic DNS for PHP and reverse proxy and swarm fixes in quickstart guide
This commit is contained in:
parent
3cedc0ae13
commit
0be1da18a6
|
@ -43,7 +43,7 @@ http {
|
|||
tcp_nodelay on;
|
||||
|
||||
# load mime types and set default one
|
||||
include /etc/nginx/mime.types;
|
||||
include /etc/nginx/mime-types.conf;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# write logs to local syslog
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
location ~ \.php$ {
|
||||
{% if REMOTE_PHP != "" +%}
|
||||
fastcgi_pass {{ REMOTE_PHP }}:9000;
|
||||
set $backend "{{ REMOTE_PHP }}:9000";
|
||||
fastcgi_pass $backend;
|
||||
{% elif LOCAL_PHP != "" +%}
|
||||
fastcgi_pass unix:{{ LOCAL_PHP }};
|
||||
{% endif %}
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
{% set headers = all[k.replace("URL", "HEADERS")] if k.replace("URL", "HEADERS") in all else "" %}
|
||||
location {{ url }} {% raw %}{{% endraw +%}
|
||||
etag off;
|
||||
proxy_pass {{ host }};
|
||||
set $backend "{{ host }}";
|
||||
proxy_pass $backend;
|
||||
{% if USE_AUTHELIA == "yes" +%}
|
||||
include {{ NGINX_PREFIX }}authelia-auth-request.conf;
|
||||
{% endif %}
|
||||
|
|
|
@ -126,7 +126,7 @@ $ docker service create \
|
|||
--name myservice \
|
||||
--network services-net \
|
||||
--constraint node.role==worker \
|
||||
-l bunkerized-nginx.SERVER_NAME=www.example.com \
|
||||
-l bunkerized-nginx.SERVER_NAME=www.example.com \
|
||||
-l bunkerized-nginx.USE_REVERSE_PROXY=yes \
|
||||
-l bunkerized-nginx.REVERSE_PROXY_URL=/ \
|
||||
-l bunkerized-nginx.REVERSE_PROXY_HOST=http://myservice \
|
||||
|
@ -142,7 +142,7 @@ services:
|
|||
myservice:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
myservice:
|
||||
services-net:
|
||||
aliases:
|
||||
- myservice
|
||||
deploy:
|
||||
|
@ -409,7 +409,9 @@ services:
|
|||
myservice:
|
||||
image: php:fpm
|
||||
networks:
|
||||
- services-net
|
||||
services-net:
|
||||
aliases:
|
||||
- myservice
|
||||
volumes:
|
||||
- /shared/www/www.example.com:/app
|
||||
deploy:
|
||||
|
@ -662,7 +664,7 @@ $ docker service create \
|
|||
--name myapp1 \
|
||||
--network services-net \
|
||||
--constraint node.role==worker \
|
||||
-l bunkerized-nginx.SERVER_NAME=app1.example.com \
|
||||
-l bunkerized-nginx.SERVER_NAME=app1.example.com \
|
||||
-l bunkerized-nginx.USE_REVERSE_PROXY=yes \
|
||||
-l bunkerized-nginx.REVERSE_PROXY_URL=/ \
|
||||
-l bunkerized-nginx.REVERSE_PROXY_HOST=http://myapp1 \
|
||||
|
@ -672,7 +674,7 @@ $ docker service create \
|
|||
--constraint node.role==worker \
|
||||
--network services-net \
|
||||
--mount type=bind,source=/shared/www/app2.example.com,destination=/app \
|
||||
-l bunkerized-nginx.SERVER_NAME=app2.example.com \
|
||||
-l bunkerized-nginx.SERVER_NAME=app2.example.com \
|
||||
-l bunkerized-nginx.REMOTE_PHP=myapp2 \
|
||||
-l bunkerized-nginx.REMOTE_PHP_PATH=/app \
|
||||
php:fpm
|
||||
|
@ -687,7 +689,9 @@ services:
|
|||
myapp1:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- services-net
|
||||
services-net:
|
||||
aliases:
|
||||
- myapp1
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
|
@ -701,7 +705,9 @@ services:
|
|||
myapp2:
|
||||
image: php:fpm
|
||||
networks:
|
||||
- services-net
|
||||
services-net:
|
||||
aliases:
|
||||
- myapp2
|
||||
volumes:
|
||||
- /shared/www/app2.example.com:/app
|
||||
deploy:
|
||||
|
|
11
gen/main.py
11
gen/main.py
|
@ -50,10 +50,13 @@ if __name__ == "__main__" :
|
|||
configurator.load_variables(variables)
|
||||
config = configurator.get_config()
|
||||
|
||||
# TODO : find a proper way to remove old sites
|
||||
env_list = glob.glob(args.output + "/**/*.env", recursive=True)
|
||||
for env in env_list :
|
||||
os.remove(env)
|
||||
# Remove old files
|
||||
files = glob.glob(args.output + "/*")
|
||||
for file in files :
|
||||
if file.endswith(".conf") and os.path.isfile(file) :
|
||||
os.remove(file)
|
||||
elif os.path.isdir(file) :
|
||||
shutil.rmtree(file, ignore_errors=False)
|
||||
|
||||
# Generate the files from templates and config
|
||||
templator = Templator(config, args.templates, args.output, args.target)
|
||||
|
|
Loading…
Reference in New Issue