Use nginx as reverse proxy on walker, removing traefik
SSL coming soon
This commit is contained in:
parent
a7eb372899
commit
a3baf8be1e
25
ansible/files/nginx-docker.conf
Normal file
25
ansible/files/nginx-docker.conf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
http2 on;
|
||||||
|
|
||||||
|
server_name {{ server_name }};
|
||||||
|
set $upstream {{ upstream }};
|
||||||
|
|
||||||
|
ssl_certificate {{ ssl_cert_path }}/fullchain.pem;
|
||||||
|
ssl_certificate_key {{ ssl_cert_path }}/key.pem;
|
||||||
|
ssl_trusted_certificate {{ ssl_cert_path }}/cert.pem;
|
||||||
|
include includes/ssl.conf;
|
||||||
|
|
||||||
|
include includes/docker-resolver.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://$upstream;
|
||||||
|
|
||||||
|
{%- if location_extra is defined +%}
|
||||||
|
{{ location_extra }}
|
||||||
|
{%- endif +%}
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +1,4 @@
|
|||||||
restic_backup_locations:
|
restic_backup_locations:
|
||||||
- /opt
|
- /opt
|
||||||
|
|
||||||
|
nginx_https_redirect: true
|
||||||
|
@ -52,7 +52,6 @@
|
|||||||
|
|
||||||
- hosts:
|
- hosts:
|
||||||
- pve-docker
|
- pve-docker
|
||||||
- walker
|
|
||||||
roles:
|
roles:
|
||||||
- traefik
|
- traefik
|
||||||
|
|
||||||
@ -101,12 +100,13 @@
|
|||||||
- hosts: walker
|
- hosts: walker
|
||||||
roles:
|
roles:
|
||||||
- nebula
|
- nebula
|
||||||
|
- coredns
|
||||||
|
- nginx
|
||||||
- plausible
|
- plausible
|
||||||
- restic
|
- restic
|
||||||
- commento
|
- commento
|
||||||
- website
|
- website
|
||||||
- remark42
|
- remark42
|
||||||
- coredns
|
|
||||||
|
|
||||||
- hosts: jellyfin
|
- hosts: jellyfin
|
||||||
roles:
|
roles:
|
||||||
|
@ -8,10 +8,7 @@ services:
|
|||||||
- db
|
- db
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
- traefik
|
- coredns
|
||||||
labels:
|
|
||||||
- traefik.enable=true
|
|
||||||
- traefik.http.routers.commento.rule=Host(`commento.theorangeone.net`)
|
|
||||||
environment:
|
environment:
|
||||||
- COMMENTO_POSTGRES=postgres://commento:commento@db:5432/commento?sslmode=disable
|
- COMMENTO_POSTGRES=postgres://commento:commento@db:5432/commento?sslmode=disable
|
||||||
- COMMENTO_ORIGIN=https://commento.theorangeone.net
|
- COMMENTO_ORIGIN=https://commento.theorangeone.net
|
||||||
@ -37,5 +34,5 @@ services:
|
|||||||
- POSTGRES_USER=commento
|
- POSTGRES_USER=commento
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik:
|
coredns:
|
||||||
external: true
|
external: true
|
||||||
|
@ -18,3 +18,15 @@
|
|||||||
validate: docker-compose -f %s config
|
validate: docker-compose -f %s config
|
||||||
notify: restart commento
|
notify: restart commento
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
|
- name: Install nginx config
|
||||||
|
template:
|
||||||
|
src: files/nginx-docker.conf
|
||||||
|
dest: /etc/nginx/http.d/commento.conf
|
||||||
|
mode: "0644"
|
||||||
|
notify: reload nginx
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
server_name: commento.theorangeone.net
|
||||||
|
upstream: commento-commento-1.docker:8080
|
||||||
|
ssl_cert_path: /etc/nginx/ssl/theorangeone.net
|
||||||
|
@ -9,8 +9,8 @@ services:
|
|||||||
- "{{ private_ip }}:5353:53/udp"
|
- "{{ private_ip }}:5353:53/udp"
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
- traefik
|
- coredns
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik:
|
coredns:
|
||||||
external: true
|
external: true
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
- name: Create network
|
||||||
|
docker_network:
|
||||||
|
name: coredns
|
||||||
|
internal: true
|
||||||
|
become: true
|
||||||
|
|
||||||
- name: Create install directory
|
- name: Create install directory
|
||||||
file:
|
file:
|
||||||
path: /opt/coredns
|
path: /opt/coredns
|
||||||
|
@ -1 +1,2 @@
|
|||||||
nginx_https_redirect: false
|
nginx_https_redirect: false
|
||||||
|
docker_resolver_address: "{{ private_ip }}:5353"
|
||||||
|
2
ansible/roles/nginx/files/includes/docker-resolver.conf
Normal file
2
ansible/roles/nginx/files/includes/docker-resolver.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
resolver {{ docker_resolver_address }} valid=2s;
|
||||||
|
resolver_timeout 5s;
|
@ -46,9 +46,9 @@
|
|||||||
- name: Copy config files
|
- name: Copy config files
|
||||||
template:
|
template:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "/etc/nginx/includes/{{ item | basename }}"
|
dest: /etc/nginx/includes/{{ item | basename }}
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
with_fileglob: 'files/includes/*.conf'
|
with_fileglob: files/includes/*.conf
|
||||||
become: true
|
become: true
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
|
@ -10,20 +10,7 @@ services:
|
|||||||
- clickhouse
|
- clickhouse
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
- traefik
|
- coredns
|
||||||
labels:
|
|
||||||
- traefik.enable=true
|
|
||||||
- traefik.http.routers.plausible.rule=Host(`plausible.theorangeone.net`)
|
|
||||||
- traefik.http.services.plausible-plausible.loadbalancer.server.port=8000 # https://github.com/plausible/analytics/pull/237
|
|
||||||
|
|
||||||
- traefik.http.routers.plausible-embed.rule=Host(`elbisualp.theorangeone.net`)
|
|
||||||
- traefik.http.routers.plausible-embed.service=plausible-plausible
|
|
||||||
|
|
||||||
# https://github.com/plausible/analytics/pull/340
|
|
||||||
- traefik.http.middlewares.plausible-index.replacepathregex.regex=/js/index.js
|
|
||||||
- traefik.http.middlewares.plausible-index.replacepathregex.replacement=/js/plausible.js
|
|
||||||
- traefik.http.routers.plausible-embed.middlewares=plausible-index
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
- SECRET_KEY_BASE={{ vault_plausible_secret_key }}
|
- SECRET_KEY_BASE={{ vault_plausible_secret_key }}
|
||||||
- SIGNING_SALT={{ vault_plausible_signing_salt }}
|
- SIGNING_SALT={{ vault_plausible_signing_salt }}
|
||||||
@ -66,5 +53,5 @@ services:
|
|||||||
- POSTGRES_USER=plausible
|
- POSTGRES_USER=plausible
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik:
|
coredns:
|
||||||
external: true
|
external: true
|
||||||
|
@ -34,3 +34,17 @@
|
|||||||
validate: docker-compose -f %s config
|
validate: docker-compose -f %s config
|
||||||
notify: restart plausible
|
notify: restart plausible
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
|
- name: Install nginx config
|
||||||
|
template:
|
||||||
|
src: files/nginx-docker.conf
|
||||||
|
dest: /etc/nginx/http.d/plausible.conf
|
||||||
|
mode: "0644"
|
||||||
|
notify: reload nginx
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
server_name: plausible.theorangeone.net elbisualp.theorangeone.net
|
||||||
|
upstream: plausible-plausible-1.docker:8000
|
||||||
|
ssl_cert_path: /etc/nginx/ssl/theorangeone.net
|
||||||
|
location_extra: |
|
||||||
|
rewrite ^/js/index.js$ /js/plausible.js last;
|
||||||
|
@ -30,12 +30,9 @@ services:
|
|||||||
<<: *website
|
<<: *website
|
||||||
user: root
|
user: root
|
||||||
command: /app/etc/entrypoints/nginx
|
command: /app/etc/entrypoints/nginx
|
||||||
labels:
|
|
||||||
- traefik.enable=true
|
|
||||||
- traefik.http.routers.website.rule=Host(`theorangeone.net`) || Host(`jakehoward.tech`)
|
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
- traefik
|
- coredns
|
||||||
depends_on:
|
depends_on:
|
||||||
- django
|
- django
|
||||||
|
|
||||||
@ -85,5 +82,5 @@ services:
|
|||||||
- SENTRY_DSN={{ vault_spotify_sentry_dsn }}
|
- SENTRY_DSN={{ vault_spotify_sentry_dsn }}
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik:
|
coredns:
|
||||||
external: true
|
external: true
|
||||||
|
@ -18,3 +18,17 @@
|
|||||||
validate: docker-compose -f %s config
|
validate: docker-compose -f %s config
|
||||||
notify: restart website
|
notify: restart website
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
|
- name: Install nginx config
|
||||||
|
template:
|
||||||
|
src: files/nginx-docker.conf
|
||||||
|
dest: /etc/nginx/http.d/website.conf
|
||||||
|
mode: "0644"
|
||||||
|
notify: reload nginx
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
server_name: theorangeone.net
|
||||||
|
upstream: website-nginx-1.docker:8000
|
||||||
|
ssl_cert_path: /etc/nginx/ssl/theorangeone.net
|
||||||
|
location_extra: |
|
||||||
|
more_set_headers "Server: $upstream_http_server";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user