Skip to content

Commit ebc1e24

Browse files
committed
Frontend cluster deployment functional.
1 parent 6a87930 commit ebc1e24

File tree

19 files changed

+140
-77
lines changed

19 files changed

+140
-77
lines changed

inventory

playbooks/api_nsfw_server.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
- name: Gather facts from frontend nodes
3+
hosts: frontend
4+
gather_facts: true
5+
tags: nsfw_server
26
- name: NSFW server
37
hosts: nsfw_server
48
become: true

playbooks/api_nyats.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
- name: Gather facts from frontend nodes
3+
hosts: frontend
4+
gather_facts: true
5+
tags: nyats
26
- name: NYATS (thumbnailer)
37
hosts: nyats
48
tags: nyats

playbooks/api_pinservice.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
- name: Gather facts for ipfs nodes
2+
- name: Gather facts from ipfs and frontend nodes
33
gather_facts: true
4-
hosts: ipfs
4+
hosts: ipfs:frontend
55
tags: node_server
66
- name: Pin service
77
hosts: pinservice

playbooks/api_search.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
---
2+
- name: Gather facts from frontend nodes
3+
gather_facts: true
4+
hosts: frontend
5+
tags: search_api
26
- name: Search API
37
hosts: search_api
4-
tags: ipfs-search-api
8+
tags: search_api
59
become: true
610
serial:
711
- 1

playbooks/group_vars/all.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ influxdb_backup_destination: "{{ storagebox_mountpoint }}/influxdb"
2121
influxdb_backup_user: "{{ lookup('env', 'USER') }}"
2222
influxdb_backup_bucket: "telegraf"
2323
storagebox_mountpoint_group: "{{ lookup('env', 'USER') }}"
24-
domain_name: "dwebsearch.org"
2524
nsfw_server_port: 3432
2625
nsfw_server_version: e903037676d4b721e67f6d2273b8a193a0a21bd7
2726
node_branch: node_16.x

playbooks/setup_01_inventory.yml

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,17 @@
2222
tags: generate_vlan_ip
2323
roles:
2424
- role: setup/generate_vlan_ip
25-
- name: Create group of hosts without IPFS peer id
26-
hosts: ipfs
27-
gather_facts: false
28-
tags: generate_ipfs_key
29-
tasks:
30-
- name: Create group for VLAN-less hosts
31-
group_by:
32-
key: "{% if ipfs_peer_id is defined %}hasipfspeerid{% else %}noipfspeerid{% endif %}"
33-
- name: Generate IPFS keys
34-
hosts: noipfspeerid
35-
gather_facts: false
36-
tags: generate_ipfs_key
37-
roles:
38-
- role: setup/generate_ipfs_key
39-
- name: Explicitly gather facts
40-
hosts: all
41-
gather_facts: false
42-
tags:
43-
- dns
44-
- reverse_dns
45-
tasks:
46-
- name: Gather facts
47-
gather_facts:
4825
- name: Configure DNS
4926
hosts: all
27+
tags: dns
28+
gather_facts: true
5029
roles:
5130
- role: setup/cloudflare_dns
5231
tags: dns
53-
- role: setup/hetzner_reverse_dns
54-
tags: reverse_dns
32+
- name: Configure Hetzner robot reverse DNS
33+
hosts: hetzner
34+
tags: reverse_dns
35+
gather_facts: true
36+
roles:
37+
- role: setup/hetzner_robot_reverse_dns
38+
# TODO: Hcloud reverse DNS

playbooks/setup_02_hetzner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# roles:
1212
# - hetzner_add_to_switch
1313
- name: Install OS image
14-
hosts: all # TODO: Filter by machines in rescue mode
14+
hosts: hetzner # TODO: Filter by machines in rescue mode
1515
remote_user: root
1616
ignore_unreachable: true
1717
roles:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
---
22
frontend_install_path: /usr/local/libexec/ipfs-search/frontend
3+
frontend_cache_path: /etc/nginx/cache
Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
---
2-
- name: Gather facts from backend nodes
3-
setup:
4-
delegate_to: "{{ item }}"
5-
delegate_facts: true
6-
when: hostvars[item]['ansible_default_ipv4'] is not defined
7-
loop: "{{ groups['backend'] }}"
8-
ignore_unreachable: true
92
- name: Install nginx configuration
103
template:
114
src: nginx-frontend.conf.j2
@@ -18,3 +11,22 @@
1811
src: /etc/nginx/sites-available/frontend.conf
1912
state: link
2013
notify: Reload nginx
14+
- name: Create cache directory
15+
file:
16+
path: "{{ frontend_cache_path }}"
17+
state: directory
18+
owner: www-data
19+
group: www-data
20+
mode: 0755
21+
- name: Flush handlers
22+
meta: flush_handlers
23+
- name: Ensure HTTP and HTTPS are listening
24+
wait_for:
25+
port: "{{ item }}"
26+
loop:
27+
- 80
28+
- 443
29+
timeout: 30
30+
- name: Test API call
31+
uri:
32+
url: "https://{{ api_server_name }}/v1/search?q=test"

0 commit comments

Comments
 (0)