Skip to content

Commit

Permalink
refactor: apply clickhouse proxy ansible configs
Browse files Browse the repository at this point in the history
  • Loading branch information
DecFox committed Dec 18, 2024
1 parent 01302a4 commit fe40deb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
22 changes: 12 additions & 10 deletions ansible/deploy-clickhouse-proxy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
## - name: Deploy clickhouse proxy
## hosts:
## - clickhouseproxy.dev.ooni.io
## roles:
## - role: bootstrap
## - role: nginx
## tags: nginx
## - role: clickhouse_proxy
## vars:
## clickhouse_url: "" # fetch from AWS secrets
- name: Deploy clickhouse proxy
hosts:
- clickhouseproxy.dev.ooni.io
become: true
roles:
- role: bootstrap
- role: nginx
tags: nginx
- role: clickhouse_proxy
vars:
clickhouse_url: "clickhouse3.prod.ooni.io"
clickhouse_port: 9000
6 changes: 3 additions & 3 deletions ansible/deploy-clickhouse.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
- name: Deploy oonidata clickhouse hosts
hosts:
# - notebook.ooni.org
# - data1.htz-fsn.prod.ooni.nu
# - data2.htz-fsn.prod.ooni.nu
- notebook.ooni.org
- data1.htz-fsn.prod.ooni.nu
- data2.htz-fsn.prod.ooni.nu
- data3.htz-fsn.prod.ooni.nu
become: true
tags:
Expand Down
3 changes: 3 additions & 0 deletions ansible/inventory
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ data3.htz-fsn.prod.ooni.nu

[ghs-ams]
openvpn-server1.ooni.io

[aws-proxy]
clickhouseproxy.dev.ooni.io
1 change: 1 addition & 0 deletions ansible/roles/bootstrap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

- name: install systemd-resolved
tags: resolved
ignore_errors: yes # some ubuntu hosts do not have the systemd-resolved package
ansible.builtin.apt:
install_recommends: no
cache_valid_time: 86400
Expand Down
9 changes: 9 additions & 0 deletions ansible/roles/clickhouse_proxy/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
---
- name: Create the modules-enabled directory if not exists
tags: webserv
ansible.builtin.file:
path: /etc/nginx/modules-enabled
state: directory
mode: 0755
owner: root
group: root

- name: Add stream nginx config
tags: webserv
template:
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/clickhouse_proxy/templates/99-stream.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
stream {
upstream clickhouse_backend {
server {{ clickhouse_url }};
server {{ clickhouse_url }}:{{ clickhouse_port }};
}

server {
Expand Down

0 comments on commit fe40deb

Please sign in to comment.