-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathaggregator.yaml
More file actions
102 lines (90 loc) · 3.95 KB
/
aggregator.yaml
File metadata and controls
102 lines (90 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
- name: Run setup playbook
ansible.builtin.import_playbook: setup.yaml
vars:
host: aggregator
- name: Run go playbook
ansible.builtin.import_playbook: go.yaml
vars:
host: aggregator
- hosts: aggregator
vars:
service: "aggregator"
tasks:
- name: Update apt and install required system packages
become: true
apt:
pkg:
- pkg-config
- libssl-dev
state: latest
update_cache: true
vars:
ansible_ssh_user: "{{ admin_user }}"
- name: Create directories for each service if do not exist
file:
path: /home/{{ ansible_user }}/repos/{{ service }}
state: directory
mode: '0755'
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'
loop:
- aggregator
- name: Clone Aligned repository
git:
repo: https://github.com/yetanotherco/aligned_layer.git
dest: /home/{{ ansible_user }}/repos/{{ service }}/aligned_layer
version: v0.20.0
loop:
- aggregator
- name: Set permissions for cloned repository
file:
path: /home/{{ ansible_user }}/repos/{{ service }}/aligned_layer
mode: '0755'
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'
recurse: yes
- name: Build aggregator
shell:
chdir: /home/{{ ansible_user }}/repos/aggregator/aligned_layer/
cmd: /usr/local/go/bin/go build -o /home/{{ ansible_user }}/repos/aggregator/aligned_layer/build/aligned-aggregator /home/{{ ansible_user }}/repos/aggregator/aligned_layer/aggregator/cmd/main.go
- name: Upload config file for aggregator
template:
src: config-files/config-aggregator.yaml.j2
dest: "/home/{{ ansible_user }}/config/config-aggregator.yaml"
vars:
aligned_layer_deployment_config_file_path: "{{ lookup('ini', 'aligned_layer_deployment_config_file_path', file='ini/config-aggregator.ini') }}"
eigen_layer_deployment_config_file_path: "{{ lookup('ini', 'eigen_layer_deployment_config_file_path', file='ini/config-aggregator.ini') }}"
eth_rpc_url: "{{ lookup('ini', 'eth_rpc_url', file='ini/config-aggregator.ini') }}"
eth_rpc_url_fallback: "{{ lookup('ini', 'eth_rpc_url_fallback', file='ini/config-aggregator.ini') }}"
eth_ws_url: "{{ lookup('ini', 'eth_ws_url', file='ini/config-aggregator.ini') }}"
eth_ws_url_fallback: "{{ lookup('ini', 'eth_ws_url_fallback', file='ini/config-aggregator.ini') }}"
ecdsa_private_key_store_path: "{{ lookup('ini', 'ecdsa_private_key_store_path', file='ini/config-aggregator.ini') }}"
ecdsa_private_key_store_password: "{{ lookup('ini', 'ecdsa_private_key_store_password', file='ini/config-aggregator.ini') }}"
bls_private_key_store_path: "{{ lookup('ini', 'bls_private_key_store_path', file='ini/config-aggregator.ini') }}"
bls_private_key_store_password: "{{ lookup('ini', 'bls_private_key_store_password', file='ini/config-aggregator.ini') }}"
enable_metrics: "{{ lookup('ini', 'enable_metrics', file='ini/config-aggregator.ini') }}"
metrics_ip_port_address: "{{ lookup('ini', 'metrics_ip_port_address', file='ini/config-aggregator.ini') }}"
telemetry_ip_port_address: "{{ lookup('ini', 'telemetry_ip_port_address', file='ini/config-aggregator.ini') }}"
- name: Allow access to tcp port 8090
become: true
ufw:
rule: allow
port: 8090
proto: tcp
vars:
ansible_ssh_user: "{{ admin_user }}"
- name: Create systemd services directory
file:
path: "/home/{{ ansible_user }}/.config/systemd/user/"
state: directory
- name: Add service to systemd
template:
src: services/aggregator.service.j2
dest: "/home/{{ ansible_user }}/.config/systemd/user/aggregator.service"
force: no
- name: Start aggregator service
systemd_service:
name: aggregator
state: started
enabled: true
scope: user