Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ansible config to make backend-hel as the primary test server #117

Merged
merged 32 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3f47921
Retrieve digital ocean token from parameter store
hellais Nov 25, 2024
2638566
Change ECS cluster instance sizes
hellais Nov 25, 2024
fee97f3
Add support for deploying oonibackend proxy nginx proxy
hellais Nov 25, 2024
0a0eea9
Change default task memory
hellais Nov 25, 2024
a019a3c
Fix duplicate service name
hellais Nov 25, 2024
301e16a
Drop backendproxy
hellais Nov 25, 2024
cc72935
Point oonifindings to oonidata branch
hellais Nov 25, 2024
f5b0e13
Add clickhouseproxy setup
hellais Nov 25, 2024
57dda33
Add clickhouse proxy nftable rules
hellais Nov 25, 2024
7512a3b
Add extra path rules for oonidata endpoint
hellais Nov 26, 2024
94338ad
Fix labeling of reverse proxy
hellais Nov 26, 2024
b6866f3
Fix typo
hellais Nov 26, 2024
96657f9
Bump up size of ecs_cluster
hellais Nov 26, 2024
534a8a6
Use readonly user password
hellais Nov 26, 2024
1ef8815
Add ssm permission to service task
hellais Nov 26, 2024
7a1d062
Add scripts related to migrating backend-fsn tables over to cluster
hellais Nov 27, 2024
10e596e
Add more schema updates
hellais Nov 28, 2024
118030f
Don't setup node_exporter as part of bootstrap role
hellais Dec 3, 2024
3ed88c0
refactor: add base files for backend-hel deployment
DecFox Dec 4, 2024
d5ef17e
remove instances of ams-pg and replace test with backend-hel
DecFox Dec 4, 2024
0a8be55
Re-organization of monitoring
hellais Dec 4, 2024
1b1a6b5
Align job_name
hellais Dec 4, 2024
4612457
rollback node job name
hellais Dec 4, 2024
dd45abe
Merge branch 'oonidata' into refactor/ansible-backend
hellais Dec 4, 2024
797161b
Rename backend deploy role
hellais Dec 4, 2024
427b248
Reformat
hellais Dec 4, 2024
04dbf7b
cleanup extra roles
DecFox Dec 5, 2024
b4f5580
Drop discontinued hosts from monitoring
hellais Dec 6, 2024
7d33f55
Add backend reverse proxy to prod tf
hellais Dec 6, 2024
6e99269
Deploy oonibackendproxy
hellais Dec 6, 2024
2db24ad
Point reverse proxy to backend-fsn
hellais Dec 6, 2024
07b145e
refactor: add base-backend to deployer notebook
DecFox Dec 6, 2024
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
13 changes: 13 additions & 0 deletions ansible/deploy-clickhouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- name: Deploy oonidata clickhouse hosts
hosts:
- notebook.ooni.org
- data1.htz-fsn.prod.ooni.nu
#- data2.htz-fsn.prod.ooni.nu
- data3.htz-fsn.prod.ooni.nu
become: true
tags:
- clickhouse
roles:
- prometheus_node_exporter
- oonidata_clickhouse
12 changes: 12 additions & 0 deletions ansible/deploy-monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Update monitoring config
hosts: monitoring.ooni.org
become: true
tags:
- monitoring
roles:
- prometheus
- prometheus_blackbox_exporter
- prometheus_alertmanager


20 changes: 20 additions & 0 deletions ansible/deploy-ooni-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- hosts: backend-hel.ooni.org
roles:
- role: bootstrap
- role: nftables
- role: nginx
tags: nginx
vars:
nginx_user: "www-data"
- role: dehydrated
tags: dehydrated
expand: yes
vars:
ssl_domains:
# with dehydrated the first entry is the cert FQDN
# and the other ones are alternative names
- "backend-hel.ooni.org"
- role: ooni-backend
vars:
ssl_domain: backend-hel.ooni.org
22 changes: 22 additions & 0 deletions ansible/deploy-tier0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
- name: Include monitoring playbook
ansible.builtin.import_playbook: deploy-monitoring.yml

- name: Include ooni-backend playbook
ansible.builtin.import_playbook: deploy-ooni-backend.yml

- name: Include clickhouse playbook
ansible.builtin.import_playbook: deploy-clickhouse.yml

- name: Deploy oonidata worker nodes
hosts:
- data1.htz-fsn.prod.ooni.nu
become: true
tags:
- oonidata_worker
roles:
- oonidata
vars:
enable_jupyterhub: false
enable_oonipipeline_worker: true
clickhouse_url: "clickhouse://write:{{ lookup('amazon.aws.aws_ssm', '/oonidevops/secrets/clickhouse_write_password', profile='oonidevops_user_prod') | hash('sha256') }}@clickhouse1.prod.ooni.io/ooni"
25 changes: 25 additions & 0 deletions ansible/deploy-tier2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- name: Setup OpenVPN server
hosts: openvpn-server1.ooni.io
become: true
remote_user: root
roles:
- ssh_users

- name: Deploy notebook host
hosts: notebook.ooni.org
become: true
tags:
- notebook
vars:
enable_oonipipeline_worker: false
roles:
- oonidata

# commented out due to the fact it requires manual config of ~/.ssh/config
#- name: Setup codesign box
# hosts: codesign-box
# become: true
# remote_user: ubuntu
# roles:
# - codesign_box
20 changes: 14 additions & 6 deletions ansible/group_vars/all/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ ssh_users:
agrabeli:
login: agrabeli
comment: Maria Xynou
keys: ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDD0JSwM+t3Uz9lS3Mjoz9oo4vOToWyzboZhYQbP8JY5HvFtAvWanWHnUBO91t6hkgKIMiUqhdCJn26fqkhSGe/bRBaFUocOmuyfcmZoRdi0qzAskmycJsj/w6vWR4x6MYkmJvSeI/MGxjEFt4s2MfOG1tP8CBLUYft9qUleeJa7Jln8c+xbnqB7YngaI190icQHE9NuIB2CXvzbmo3tLtHNMagEwI7VoBDj6mxzTxBd9JhuhF4w5uGxxm0Gp1hzk+15obNnaBS+Anr7jXz8FPwwxCH+XhBZxB1PPpcIayKrf9iLyGtwmhkdDoWCqYAr1mue3LxFso+TZF4bwE4Cjt1 agrabelh@agrabelh"]
keys:
[
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDD0JSwM+t3Uz9lS3Mjoz9oo4vOToWyzboZhYQbP8JY5HvFtAvWanWHnUBO91t6hkgKIMiUqhdCJn26fqkhSGe/bRBaFUocOmuyfcmZoRdi0qzAskmycJsj/w6vWR4x6MYkmJvSeI/MGxjEFt4s2MfOG1tP8CBLUYft9qUleeJa7Jln8c+xbnqB7YngaI190icQHE9NuIB2CXvzbmo3tLtHNMagEwI7VoBDj6mxzTxBd9JhuhF4w5uGxxm0Gp1hzk+15obNnaBS+Anr7jXz8FPwwxCH+XhBZxB1PPpcIayKrf9iLyGtwmhkdDoWCqYAr1mue3LxFso+TZF4bwE4Cjt1 agrabelh@agrabelh",
]
art:
login: art
comment: Arturo Filasto
keys: ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJsibU0nsQFFIdolD1POzXOws4VetV0ZNByINRzY8Hx0 arturo@ooni.org"]
keys:
[
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJsibU0nsQFFIdolD1POzXOws4VetV0ZNByINRzY8Hx0 arturo@ooni.org",
]
majakomel:
login: majakomel
comment: Maja Komel
Expand All @@ -23,7 +29,9 @@ ssh_users:
keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDBXprrutdT6AhrV9hWBKjyzq6RqGmCBWpWxi3qwJyRcBJfkiEYKV9QWl3H0g/Sg9JzLd9lWG2yfAai7cyBAT4Ih0+OhwQ0V7wkhBn4YkNjs7d4BGPHjuLIywS9VtmiyH7VafikMjmqPLL/uPBIbRrx9RuSfLkAuN9XFZpVmqzWY8ePpcRCvnG6ucPxEY8o+4j5nfTrgxSaIT31kH16/PFJe07tn1SZjxZE4sZTz/p9xKt6s8HXmlP3RdnXSpXWmH8ZwYDrNhkcH8m6mC3giiqSKThFdwvQVflRRvn9pAlUOhy6KIBtAt1KobVJtOCPrrkcLhQ1C+2P9wKhfYspCGrScFGnrUqumLxPpwlqILxJvmgqGAtkm8Ela9f2D9sEv8CUv5x9XptZKlyRhtOLixvLYoJlwfXXnmXa8T1pg8+4063BhHUOu/bg0InpSp3hdscOfk0R8FtDlXnn6COwbPXynIt4PxzIxD/WQhP0ymgH3ky6ClB5wRBVhOqYvxQw32n2QFS9A5ocga+nATiOE7BTOufgmDCA/OIXfJ/GukXRaMCBsvlx7tObHS1LOMt0I+WdoOEjI0ARUrFzwoiTrs9QYmd922e7S35EnheT3JjnCTjebJrCNtwritUy8vjsN/M27wJs7MAXleT7drwXXnm+3xYrH+4KQ+ru0dxMe1zfBw== aanorbel@gmail.com"

admin_usernames: [ art, mehul ]
root_usernames: [ art, mehul ]
non_admin_usernames: [ ]
deactivated_usernames: [ sbs, federico, sarath ]
admin_usernames: [art, mehul]
root_usernames: [art, mehul]
non_admin_usernames: []
deactivated_usernames: [sbs, federico, sarath]

prometheus_metrics_password: "{{ lookup('amazon.aws.aws_secret', 'oonidevops/ooni_services/prometheus_metrics_password', profile='oonidevops_user_prod') }}"
22 changes: 21 additions & 1 deletion ansible/group_vars/clickhouse/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ nftables_clickhouse_allow:
ip: 168.119.7.188
- fqdn: notebook.ooni.org
ip: 138.201.19.39
- fqdn: clickhouseproxy.dev.ooni.io
ip: "{{ lookup('dig', 'clickhouseproxy.dev.ooni.io/A') }}"

nftables_zookeeper_allow:
- fqdn: data1.htz-fsn.prod.ooni.nu
Expand All @@ -24,7 +26,7 @@ clickhouse_config:
max_connections: 4096
keep_alive_timeout: 3
max_concurrent_queries: 100
max_server_memory_usage: 0
max_server_memory_usage: 21001001000
max_thread_pool_size: 10000
max_server_memory_usage_to_ram_ratio: 0.9
total_memory_profiler_step: 4194304
Expand Down Expand Up @@ -154,6 +156,10 @@ clickhouse_distributed_ddl:
clickhouse_default_profiles:
default:
readonly: 2
max_memory_usage: 11001001000
use_uncompressed_cache: 0
load_balancing: random
max_partitions_per_insert_block: 100
readonly:
readonly: 1
write:
Expand Down Expand Up @@ -194,3 +200,17 @@ clickhouse_default_quotas:
result_rows: 0
read_rows: 0
execution_time: 0

clickhouse_prometheus:
endpoint: "/metrics"
port: 9363
metrics: true
events: true
asynchronous_metrics: true
status_info: true

prometheus_nginx_proxy_config:
- location: /metrics/node_exporter
proxy_pass: http://127.0.0.1:8100/metrics
- location: /metrics/clickhouse
proxy_pass: http://127.0.0.1:9363/metrics
24 changes: 13 additions & 11 deletions ansible/inventory
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
[all]
# This requires manual setup of ~/.ssh/config
#codesign-box
[all:children]
htz-fsn
ghs-ams

[prod]
data.ooni.org
oonidata.ooni.org
monitoring.ooni.org
openvpn-server1.ooni.io
## Role tags

[clickhouse]
notebook.ooni.org
data1.htz-fsn.prod.ooni.nu
data2.htz-fsn.prod.ooni.nu
data3.htz-fsn.prod.ooni.nu

[dev]
oonidatatest.ooni.nu
## Location tags

[clickhouse]
[htz-fsn]
data.ooni.org
monitoring.ooni.org
notebook.ooni.org
data1.htz-fsn.prod.ooni.nu
data2.htz-fsn.prod.ooni.nu
data3.htz-fsn.prod.ooni.nu

[ghs-ams]
openvpn-server1.ooni.io
63 changes: 4 additions & 59 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,8 @@
tags:
- bootstrap

- name: Update monitoring config
hosts: monitoring.ooni.org
become: true
tags:
- monitoring
roles:
- prometheus
- prometheus_blackbox_exporter
- prometheus_alertmanager

- name: Setup OpenVPN server
hosts: openvpn-server1.ooni.io
become: true
remote_user: root
roles:
- ssh_users

- name: Deploy oonidata clickhouse hosts
hosts:
- data1.htz-fsn.prod.ooni.nu
#- data2.htz-fsn.prod.ooni.nu
- data3.htz-fsn.prod.ooni.nu
- notebook.ooni.org
become: true
tags:
- clickhouse
roles:
#- tailnet
- oonidata_clickhouse

- name: Deploy oonidata worker nodes
hosts:
- data1.htz-fsn.prod.ooni.nu
become: true
tags:
- oonidata_worker
roles:
- oonidata
vars:
enable_jupyterhub: false
enable_oonipipeline_worker: true
clickhouse_url: "clickhouse://write:{{ lookup('amazon.aws.aws_ssm', '/oonidevops/secrets/clickhouse_write_password', profile='oonidevops_user_prod') | hash('sha256') }}@clickhouse1.prod.ooni.io/ooni"

- name: Deploy notebook host
hosts: notebook.ooni.org
become: true
tags:
- notebook
vars:
enable_oonipipeline_worker: false
roles:
- oonidata
- name: Include tier0 playbook
ansible.builtin.import_playbook: deploy-tier0.yml

# commented out due to the fact it requires manual config of ~/.ssh/config
#- name: Setup codesign box
# hosts: codesign-box
# become: true
# remote_user: ubuntu
# roles:
# - codesign_box
- name: Include tier2 playbook
ansible.builtin.import_playbook: deploy-tier2.yml
1 change: 0 additions & 1 deletion ansible/requirements.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
- src: willshersystems.sshd
- src: nginxinc.nginx
- src: geerlingguy.certbot
- src: geerlingguy.node_exporter
- src: artis3n.tailscale
- src: https://github.com/idealista/clickhouse_role
scm: git
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/base-backend/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Configure base host based on backend hosts
15 changes: 15 additions & 0 deletions ansible/roles/base-backend/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- name: reload nftables
tags: nftables
ansible.builtin.systemd_service:
name: nftables
state: reloaded

- name: restart chrony
ansible.builtin.systemd:
name: chrony.service
state: restarted

- name: restart netdata
ansible.builtin.systemd:
name: netdata.service
state: restarted
6 changes: 6 additions & 0 deletions ansible/roles/base-backend/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
dependencies:
- role: adm
become: false
remote_user: root
gather_facts: false
Loading
Loading