Update to start without working upstream
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
version: '3.4'
|
version: '3.4'
|
||||||
|
|
||||||
project: ssl_nginx
|
name: ssl_nginx
|
||||||
|
|
||||||
services:
|
services:
|
||||||
certbot:
|
certbot:
|
||||||
@@ -14,6 +14,7 @@ services:
|
|||||||
- letsencrypt:/etc/letsencrypt
|
- letsencrypt:/etc/letsencrypt
|
||||||
depends_on:
|
depends_on:
|
||||||
- nginx
|
- nginx
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
container_name: 'global-nginx'
|
container_name: 'global-nginx'
|
||||||
@@ -26,6 +27,7 @@ services:
|
|||||||
- 443:443
|
- 443:443
|
||||||
networks:
|
networks:
|
||||||
- hosting_net
|
- hosting_net
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
ssl:
|
ssl:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ COPY servers.json /servers.json
|
|||||||
COPY domains.txt /domains.txt
|
COPY domains.txt /domains.txt
|
||||||
COPY nginx.conf /nginx.conf
|
COPY nginx.conf /nginx.conf
|
||||||
|
|
||||||
RUN python /add_servers.py --nginx /nginx.conf --domains_list_txt /domains.txt --servers_config_json server.json --certificates_path /ssl
|
RUN python /add_servers.py --nginx /nginx.conf --domains_list_txt /domains.txt --servers_config_json servers.json --certificates_path /ssl
|
||||||
|
|
||||||
|
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import sys
|
|||||||
REDIRECT_TEMPLATE = "\n".join(
|
REDIRECT_TEMPLATE = "\n".join(
|
||||||
(
|
(
|
||||||
"\tlocation / {{",
|
"\tlocation / {{",
|
||||||
"\t\tproxy_pass {redirection_host}/;",
|
"\t\tresolver 127.0.0.11 valid=30s;",
|
||||||
|
"\t\tset $host_{i} {redirection_host};",
|
||||||
|
"\t\tproxy_pass $host_{i}/;",
|
||||||
"\t\tinclude proxy_common.conf;",
|
"\t\tinclude proxy_common.conf;",
|
||||||
"\t}}",
|
"\t}}",
|
||||||
)
|
)
|
||||||
@@ -57,7 +59,7 @@ class Server:
|
|||||||
if self.options is None:
|
if self.options is None:
|
||||||
self.options = []
|
self.options = []
|
||||||
|
|
||||||
def format(self, indent: str = " ", base_indent: int = 1) -> str:
|
def format(self, i: int, indent: str = " ", base_indent: int = 1) -> str:
|
||||||
"""Format server to place inside nginx.conf"""
|
"""Format server to place inside nginx.conf"""
|
||||||
res = (indent * base_indent) + (
|
res = (indent * base_indent) + (
|
||||||
SERVER_HTTPS_TEMPLATE if self.certificate is not None else SERVER_HTTP_TEMPLATE
|
SERVER_HTTPS_TEMPLATE if self.certificate is not None else SERVER_HTTP_TEMPLATE
|
||||||
@@ -67,7 +69,7 @@ class Server:
|
|||||||
redirection=(
|
redirection=(
|
||||||
REDIRECT_TEMPLATE.replace("\n", "\n" + indent * base_indent)
|
REDIRECT_TEMPLATE.replace("\n", "\n" + indent * base_indent)
|
||||||
.replace("\t", indent)
|
.replace("\t", indent)
|
||||||
.format(redirection_host=self.redirect)
|
.format(i=i, redirection_host=self.redirect)
|
||||||
if self.redirect is not None
|
if self.redirect is not None
|
||||||
else ""
|
else ""
|
||||||
),
|
),
|
||||||
@@ -190,7 +192,7 @@ def main() -> None:
|
|||||||
Server(domain, None, domain if not args.http_only else None, certificates_path=args.certificates_path)
|
Server(domain, None, domain if not args.http_only else None, certificates_path=args.certificates_path)
|
||||||
)
|
)
|
||||||
|
|
||||||
nginx_servers_part = "\n\n".join(server.format() for server in nginx_servers)
|
nginx_servers_part = "\n\n".join(server.format(i) for i, server in enumerate(nginx_servers))
|
||||||
|
|
||||||
print(f"Using following servers part for nginx.conf:\n\n{nginx_servers_part}")
|
print(f"Using following servers part for nginx.conf:\n\n{nginx_servers_part}")
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ COPY server_common.conf /etc/nginx/server_common.conf
|
|||||||
COPY --from=builder /nginx.conf /etc/nginx/nginx.conf
|
COPY --from=builder /nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY domains.txt /domains.txt
|
COPY domains.txt /domains.txt
|
||||||
|
|
||||||
RUN echo "(sleep 30 && killall nginx) &" > /entrypoint && \
|
RUN echo "(sleep 60 && killall nginx) &" > /entrypoint && \
|
||||||
echo "cp /domains.txt /ssl/domains.txt" >> /entrypoint && \
|
echo "cp /domains.txt /ssl/domains.txt" >> /entrypoint && \
|
||||||
echo "nginx -g 'daemon off;'" >> /entrypoint && \
|
echo "nginx -g 'daemon off;'" >> /entrypoint && \
|
||||||
echo "nginx" >> /entrypoint
|
echo "nginx" >> /entrypoint
|
||||||
|
|||||||
@@ -27,4 +27,6 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
ssl:
|
ssl:
|
||||||
|
name: ssl_nginx_ssl
|
||||||
letsencrypt:
|
letsencrypt:
|
||||||
|
name: ssl_nginx_letsencrypt
|
||||||
|
|||||||
Reference in New Issue
Block a user