Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ansible/deploy-airflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
vars:
airflow_public_fqdn: "airflow.prod.ooni.io"
tls_cert_dir: /var/lib/dehydrated/certs
event_detector_panel_domain: detector-panel.prod.ooni.io
ssl_domains:
Comment thread
aagbsn marked this conversation as resolved.
- "data1.htz-fsn.prod.ooni.nu"
- "airflow.prod.ooni.io"
- "detector-panel.prod.ooni.io"
detector_panel_passwd: "{{ lookup('amazon.aws.aws_ssm', '/oonidevops/secrets/detector_panel_passwd', profile='oonidevops_user_prod') }}"
10 changes: 10 additions & 0 deletions ansible/roles/oonidata_airflow/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@
ansible.builtin.systemd_service:
name: nginx
state: reloaded

- name: reload systemd
ansible.builtin.systemd:
daemon_reload: true

- name: restart detector-panel
ansible.builtin.systemd:
name: detector-panel.service
state: restarted
enabled: true
28 changes: 27 additions & 1 deletion ansible/roles/oonidata_airflow/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

- name: "Install pipeline with pip"
ansible.builtin.shell:
cmd: "{{ miniconda_install_dir }}/bin/pip install --upgrade /opt/airflow/oonidata/oonipipeline/"
cmd: "{{ miniconda_install_dir }}/bin/pip install --upgrade '/opt/airflow/oonidata/oonipipeline/[analysis]'"
chdir: "{{ miniconda_install_dir }}"
become_user: miniconda
tags:
Expand Down Expand Up @@ -97,3 +97,29 @@
tags:
- oonidata
- config

# Event detector panel
- name: Deploy detector-panel systemd unit
ansible.builtin.template:
src: templates/detector-panel.service
dest: /etc/systemd/system/detector-panel.service
owner: root
mode: '0644'
notify:
- reload systemd
- restart detector-panel
tags:
- detector_panel

- name: Setup event detector password file and ensure permissions are set
community.general.htpasswd:
path: "/etc/ooni/detector_panel_passwd"
name: admin
password: "{{ detector_panel_passwd }}"
owner: root
group: "nginx"
mode: 0640
notify:
- reload nginx
tags:
- detector_panel
14 changes: 14 additions & 0 deletions ansible/roles/oonidata_airflow/templates/detector-panel.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=OONI Pipeline Events Panel
After=network.target

[Service]
Type=simple
ExecStart=/opt/miniconda/bin/python -m oonipipeline.main events-panel --port 8501
Restart=on-failure
RestartSec=5
User=oonipipeline
WorkingDirectory=/opt/miniconda

[Install]
WantedBy=multi-user.target
27 changes: 27 additions & 0 deletions ansible/roles/oonidata_airflow/templates/nginx-airflow.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,30 @@ server {
proxy_buffering off;
}
}

server {
listen 443 ssl http2;
include /etc/nginx/ssl_intermediate.conf;
ssl_certificate /var/lib/dehydrated/certs/{{inventory_hostname}}/fullchain.pem;
ssl_certificate_key /var/lib/dehydrated/certs/{{inventory_hostname}}/privkey.pem;
Comment thread
aagbsn marked this conversation as resolved.
Outdated
ssl_trusted_certificate /var/lib/dehydrated/certs/{{inventory_hostname}}/chain.pem;
server_name {{ event_detector_panel_domain }};
access_log /var/log/nginx/{{ event_detector_panel_domain }}.access.log;
error_log /var/log/nginx/{{ event_detector_panel_domain }}.log warn;

location / {
auth_basic "Administrator's Area";
auth_basic_user_file /etc/ooni/detector_panel_passwd;
proxy_pass http://127.0.0.1:8501;
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;
}
}
12 changes: 12 additions & 0 deletions tf/environments/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1752,3 +1752,15 @@ resource "aws_route53_record" "jumphost_alias" {
module.ooni_jumphost.aws_instance_public_dns
]
}

resource "aws_route53_record" "detector_panel_alias" {
zone_id = local.dns_zone_ooni_io
name = "detector-panel.${local.environment}.ooni.io"
type = "A"
ttl = 300

records = [
# Airflow host
"142.132.254.225"
]
}
Loading