.
continuous-integration/drone/push Build was killed Details

This commit is contained in:
Giles Bradshaw 2020-05-03 18:16:25 +01:00
parent 2f47d1a3f8
commit 9969e56150
4 changed files with 155 additions and 214 deletions

View File

@ -15,10 +15,10 @@ services:
- SERVER_NAME=${GIT_DOMAIN} - SERVER_NAME=${GIT_DOMAIN}
- PROXY_PASS=http://gitea:3000/ - PROXY_PASS=http://gitea:3000/
- BLOG_PROXY_PASS=http://ghost:2368/ - BLOG_PROXY_PASS=http://ghost:2368/
- CHAT_PROXY_PASS=http://chat:3000 - CHAT_PROXY_PASS=http://chat:3000/
- REMOTE_PROXY_PASS=http://guacamole:8080/guacamole/ - REMOTE_PROXY_PASS=http://guacamole:8080/guacamole/
- DRONE_PROXY_PASS=http://drone-server:8080/ - DRONE_PROXY_PASS=http://drone-server:8080/
- REGISTRY_PROXY_PASS=http://registry-1:5000 - REGISTRY_PROXY_PASS=http://registry-1:5000/
- PORTAINER_PROXY_PASS=http://portainer:9000/ - PORTAINER_PROXY_PASS=http://portainer:9000/
- PORTAINER_LOCATION=/portainer/ - PORTAINER_LOCATION=/portainer/
- GIT_LOCATION=/git/ - GIT_LOCATION=/git/

View File

@ -1,3 +1,4 @@
FROM staticfloat/nginx-certbot FROM staticfloat/nginx-certbot
COPY nginx.conf /etc/nginx/nginx.conf
COPY run.sh / COPY run.sh /
CMD sh /run.sh CMD sh /run.sh

View File

@ -1,220 +1,158 @@
## Set a variable to help us decide if we need to add the ## Set a variable to help us decide if we need to add the
## 'Docker-Distribution-Api-Version' header. ## 'Docker-Distribution-Api-Version' header.
## The registry always sets this header. ## The registry always sets this header.
## In the case of nginx performing auth, the header is unset ## In the case of nginx performing auth, the header is unset
## since nginx is auth-ing before proxying. ## since nginx is auth-ing before proxying.
map ${DOLLAR}upstream_http_docker_distribution_api_version ${DOLLAR}docker_distribution_api_version { map ${DOLLAR}upstream_http_docker_distribution_api_version ${DOLLAR}docker_distribution_api_version {
'' 'registry/2.0'; '' 'registry/2.0';
} }
server { server {
resolver 127.0.0.11 valid=30s; ## internal docker dns # resolver 127.0.0.11 valid=30s; ## internal docker dns
#listen [::]:3011 default ipv6only=on; ## listen for ipv6 #listen [::]:3011 default ipv6only=on; ## listen for ipv6
listen 80; listen 80;
client_header_timeout 120s; client_header_timeout 120s;
client_body_timeout 120s; client_body_timeout 120s;
client_max_body_size 200m; client_max_body_size 200m;
# save logs here
server_name ${SERVER_NAME};
location / {
return 301 https://${DOLLAR}host${DOLLAR}request_uri;
}
}
# save logs here server {
# resolver 127.0.0.11 valid=30s; ## internal docker dns
#listen [::]:3011 default ipv6only=on; ## listen for ipv6
# listen 444
listen 5000 ssl;
# this should allow large docs
client_header_timeout 120s;
client_body_timeout 120s;
client_max_body_size 200m;
ssl_certificate /etc/letsencrypt/live/${SERVER_NAME}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${SERVER_NAME}/privkey.pem;
# save logs here
#access_log /var/log/nginx/access.log compression;
server_name ${SERVER_NAME};
server_name ${SERVER_NAME}; location / {
proxy_pass ${DRONE_PROXY_PASS};
}
location / { }
return 301 https://${DOLLAR}host${DOLLAR}request_uri; server {
} # resolver 127.0.0.11 valid=30s; ## internal docker dns
#listen [::]:3011 default ipv6only=on; ## listen for ipv6
# listen 444
listen 5001 ssl;
# this should allow large docs
client_header_timeout 120s;
client_body_timeout 120s;
client_max_body_size 0;
ssl_certificate /etc/letsencrypt/live/${SERVER_NAME}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${SERVER_NAME}/privkey.pem;
# save logs here
#access_log /var/log/nginx/access.log compression;
# Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
# required to avoid HTTP 411: see Issue #1486 (https://github.com/moby/moby/issues/1486)
chunked_transfer_encoding on;
server_name ${SERVER_NAME};
location /v2/ {
# Do not allow connections from docker 1.5 and earlier
# docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents
if (${DOLLAR}http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
} }
add_header 'Docker-Distribution-Api-Version' ${DOLLAR}docker_distribution_api_version always;
proxy_set_header Host ${DOLLAR}http_host;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto ${DOLLAR}scheme;
proxy_buffering off;
proxy_pass ${REGISTRY_PROXY_PASS};
}
}
server { server {
resolver 127.0.0.11 valid=30s; ## internal docker dns # resolver 127.0.0.11 valid=30s; ## internal docker dns
#listen [::]:3011 default ipv6only=on; ## listen for ipv6 #listen [::]:3011 default ipv6only=on; ## listen for ipv6
# listen 444 # listen 444
listen 5000 ssl; listen 443 ssl;
# this should allow large docs # this should allow large docs
client_header_timeout 120s; client_header_timeout 120s;
client_body_timeout 120s; client_body_timeout 120s;
client_max_body_size 200m; client_max_body_size 0;
ssl_certificate /etc/letsencrypt/live/${SERVER_NAME}/fullchain.pem; ssl_certificate /etc/letsencrypt/live/${SERVER_NAME}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${SERVER_NAME}/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/${SERVER_NAME}/privkey.pem;
# save logs here # save logs here
#access_log /var/log/nginx/access.log compression; #access_log /var/log/nginx/access.log compression;
server_name ${SERVER_NAME}; # Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
location / { # required to avoid HTTP 411: see Issue #1486 (https://github.com/moby/moby/issues/1486)
proxy_pass ${DRONE_PROXY_PASS}; chunked_transfer_encoding on;
}
}
server {
resolver 127.0.0.11 valid=30s; ## internal docker dns
#listen [::]:3011 default ipv6only=on; ## listen for ipv6
# listen 444
listen 5001 ssl;
# this should allow large docs
client_header_timeout 120s;
client_body_timeout 120s;
client_max_body_size 0;
ssl_certificate /etc/letsencrypt/live/${SERVER_NAME}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${SERVER_NAME}/privkey.pem;
# save logs here
#access_log /var/log/nginx/access.log compression;
server_name ${SERVER_NAME};
# Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html location ~ ${GIT_LOCATION}(.*) {
ssl_protocols TLSv1.1 TLSv1.2; resolver 127.0.0.11 ipv6=off valid=30s; ## internal docker dns
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; set ${DOLLAR}upstream ${PROXY_PASS}${DOLLAR}1${DOLLAR}is_args${DOLLAR}args;
ssl_prefer_server_ciphers on; proxy_pass ${DOLLAR}upstream;
ssl_session_cache shared:SSL:10m; }
location ~ ${CHAT_LOCATION}sockjs(.*) {
# required to avoid HTTP 411: see Issue #1486 (https://github.com/moby/moby/issues/1486) resolver 127.0.0.11 ipv6=off valid=30s; ## internal docker dns
chunked_transfer_encoding on; set ${DOLLAR}upstream ${CHAT_PROXY_PASS}chat/sockjs${DOLLAR}1${DOLLAR}is_args${DOLLAR}args;
proxy_pass ${DOLLAR}upstream;
server_name ${SERVER_NAME}; proxy_http_version 1.1;
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
proxy_set_header Connection "Upgrade";
location /v2/ { proxy_set_header Host ${DOLLAR}host;
# Do not allow connections from docker 1.5 and earlier proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
# docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
if (${DOLLAR}http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) { proxy_set_header X-Forward-Proto http;
return 404; proxy_set_header X-Nginx-Proxy true;
} proxy_redirect off;
add_header 'Docker-Distribution-Api-Version' ${DOLLAR}docker_distribution_api_version always; }
location ~ ${CHAT_LOCATION}(.*) {
proxy_set_header Host ${DOLLAR}http_host; resolver 127.0.0.11 ipv6=off valid=30s; ## internal docker dns
proxy_set_header X-Real-IP ${DOLLAR}remote_addr; set ${DOLLAR}upstream ${CHAT_PROXY_PASS}chat/${DOLLAR}1${DOLLAR}is_args${DOLLAR}args;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for; proxy_pass ${DOLLAR}upstream;
proxy_set_header X-Forwarded-Proto ${DOLLAR}scheme; }
proxy_buffering off; location ~ ${REMOTE_LOCATION}websocket-tunnel(.*) {
proxy_pass ${REGISTRY_PROXY_PASS}; resolver 127.0.0.11 ipv6=off valid=30s; ## internal docker dns
set ${DOLLAR}upstream ${REMOTE_PROXY_PASS}websocket-tunnel${DOLLAR}1${DOLLAR}is_args${DOLLAR}args;
} proxy_pass ${DOLLAR}upstream;
} proxy_http_version 1.1;
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
server { proxy_set_header Connection "Upgrade";
resolver 127.0.0.11 valid=30s; ## internal docker dns proxy_set_header Host ${DOLLAR}host;
#listen [::]:3011 default ipv6only=on; ## listen for ipv6 proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
# listen 444 proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
listen 443 ssl; proxy_set_header X-Forward-Proto http;
# this should allow large docs proxy_set_header X-Nginx-Proxy true;
client_header_timeout 120s; proxy_redirect off;
client_body_timeout 120s; }
client_max_body_size 0; location ~ ${REMOTE_LOCATION}(.*) {
ssl_certificate /etc/letsencrypt/live/${SERVER_NAME}/fullchain.pem; resolver 127.0.0.11 ipv6=off valid=30s; ## internal docker dns
ssl_certificate_key /etc/letsencrypt/live/${SERVER_NAME}/privkey.pem; set ${DOLLAR}upstream ${REMOTE_PROXY_PASS}${DOLLAR}1${DOLLAR}is_args${DOLLAR}args;
# save logs here proxy_pass ${DOLLAR}upstream;
#access_log /var/log/nginx/access.log compression; }
location ~ ${BLOG_LOCATION}(.*) {
resolver 127.0.0.11 ipv6=off valid=30s; ## internal docker dns
# Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html proxy_set_header Host ${DOLLAR}http_host;
ssl_protocols TLSv1.1 TLSv1.2; proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
ssl_prefer_server_ciphers on; proxy_set_header X-Forwarded-Proto ${DOLLAR}scheme;
ssl_session_cache shared:SSL:10m; proxy_buffering off;
set ${DOLLAR}upstream ${BLOG_PROXY_PASS}${DOLLAR}1${DOLLAR}is_args${DOLLAR}args;
# required to avoid HTTP 411: see Issue #1486 (https://github.com/moby/moby/issues/1486) proxy_pass ${DOLLAR}upstream;
chunked_transfer_encoding on; }
}
server_name ${SERVER_NAME};
# root /www/data;
location ${GIT_LOCATION} {
set ${DOLLAR}upstream ${PROXY_PASS};
proxy_pass ${DOLLAR}upstream;
}
location ${BLOG_LOCATION} {
proxy_set_header Host ${DOLLAR}http_host;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto ${DOLLAR}scheme;
proxy_buffering off;
set ${DOLLAR}upstream ${BLOG_PROXY_PASS};
proxy_pass ${DOLLAR}upstream;
}
location ${PORTAINER_LOCATION} {
proxy_set_header Host ${DOLLAR}http_host;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto ${DOLLAR}scheme;
proxy_buffering off;
set ${DOLLAR}upstream ${PORTAINER_PROXY_PASS};
proxy_pass ${DOLLAR}upstream;
}
location ${CHAT_LOCATION}sockjs {
set ${DOLLAR}upstream ${CHAT_PROXY_PASS}/chat/sockjs;
proxy_pass ${DOLLAR}upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host ${DOLLAR}host;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
location ${CHAT_LOCATION}sockjs/ {
set ${DOLLAR}upstream ${CHAT_PROXY_PASS}/chat/sockjs;
proxy_pass ${DOLLAR}upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host ${DOLLAR}host;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
location ${CHAT_LOCATION} {
set ${DOLLAR}upstream ${CHAT_PROXY_PASS};
proxy_pass ${DOLLAR}upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host ${DOLLAR}http_host;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
location ${REMOTE_LOCATION}websocket-tunnel {
set ${DOLLAR}upstream ${REMOTE_PROXY_PASS}websocket-tunnel;
proxy_pass ${DOLLAR}upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host ${DOLLAR}host;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
location ${REMOTE_LOCATION}websocket-tunnel/ {
set ${DOLLAR}upstream ${REMOTE_PROXY_PASS}websocket-tunnel/;
proxy_pass ${DOLLAR}upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade ${DOLLAR}http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host ${DOLLAR}host;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
location ${REMOTE_LOCATION} {
set ${DOLLAR}upstream ${REMOTE_PROXY_PASS};
proxy_pass ${DOLLAR}upstream;
}
}

View File

@ -1,3 +1,4 @@
user nginx; user nginx;
worker_processes 1; worker_processes 1;
@ -16,7 +17,8 @@ http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"'
'"$proxy_host" "$upstream_addr"';
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;