-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for nginx reverse proxy
- Loading branch information
Showing
8 changed files
with
85 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
dependencies: | ||
- nginx-buster | ||
- nginx | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tls_cert_dir: /var/lib/dehydrated/certs | ||
airflow_public_fqdn: "{{ inventory_hostname }}" | ||
certbot_domains_extra: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- name: Reload nginx | ||
ansible.builtin.systemd_service: | ||
name: nginx | ||
state: reloaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
- ansible.builtin.include_role: | ||
name: ooni.airflow_role | ||
tags: | ||
- oonidata | ||
- airflow | ||
vars: | ||
airflow_webserver_host: "127.0.0.1" | ||
airflow_webserver_port: 8080 | ||
airflow_webserver_base_url: "https://{{ airflow_public_fqdn }}/airflow" | ||
|
||
- ansible.builtin.include_role: | ||
name: nginx | ||
tags: | ||
- oonidata | ||
- nginx | ||
|
||
- ansible.builtin.include_role: | ||
name: dehydrated | ||
tags: | ||
- oonidata | ||
- dehydrated | ||
vars: | ||
ssl_domains: "{{ [ airflow_public_fqdn ] + certbot_domains_extra }}" | ||
|
||
- name: Setup airflow nginx config | ||
ansible.builtin.template: | ||
src: nginx-airflow.j2 | ||
dest: /etc/nginx/sites-enabled/02-airflow | ||
owner: root | ||
mode: "0655" | ||
notify: | ||
- Reload nginx | ||
tags: | ||
- oonidata | ||
- config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# ansible-managed in ooni/devops.git | ||
|
||
map $http_upgrade $connection_upgrade { | ||
default upgrade; | ||
'' close; | ||
} | ||
|
||
server { | ||
listen 443 ssl http2; | ||
|
||
include /etc/nginx/ssl_intermediate.conf; | ||
|
||
ssl_certificate {{ tls_cert_dir }}/{{ airflow_public_fqdn }}/fullchain.pem; | ||
ssl_certificate_key {{ tls_cert_dir }}/{{ airflow_public_fqdn }}/privkey.pem; | ||
ssl_trusted_certificate {{ tls_cert_dir }}/{{ airflow_public_fqdn }}/chain.pem; | ||
|
||
server_name _; | ||
access_log /var/log/nginx/{{ airflow_public_fqdn }}.access.log; | ||
error_log /var/log/nginx/{{ airflow_public_fqdn }}.log warn; | ||
|
||
add_header Access-Control-Allow-Origin *; | ||
|
||
## Airflow reverse proxy | ||
location /airflow { | ||
proxy_pass http://127.0.0.1:8080; | ||
|
||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
|
||
client_max_body_size 100M; | ||
|
||
# WebSocket support | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $connection_upgrade; | ||
proxy_set_header X-Scheme $scheme; | ||
proxy_buffering off; | ||
} | ||
} |