Skip to content

Commit f5ded52

Browse files
samoht9277JuArceklaus993
authored
Aggregator ansible (#1387)
Co-authored-by: JuArce <[email protected]> Co-authored-by: Klaus Lungwitz <[email protected]>
1 parent d7bcec1 commit f5ded52

File tree

8 files changed

+244
-22
lines changed

8 files changed

+244
-22
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,20 @@ ansible_batcher_deploy: ## Deploy the Batcher. Parameters: INVENTORY, KEYSTORE
11771177
-i $(INVENTORY) \
11781178
-e "keystore_path=$(KEYSTORE)"
11791179

1180+
ansible_aggregator_create_env: ## Create empty variables files for the Aggregator deploy
1181+
@cp -n infra/ansible/playbooks/ini/config-aggregator.ini.example infra/ansible/playbooks/ini/config-aggregator.ini
1182+
@echo "Config files for the Aggregator created in infra/ansible/playbooks/ini"
1183+
@echo "Please complete the values and run make ansible_aggregator_deploy"
1184+
1185+
ansible_aggregator_deploy: ## Deploy the Operator. Parameters: INVENTORY
1186+
@if [ -z "$(INVENTORY)" ] || [ -z "$(ECDSA_KEYSTORE)" ] || [ -z "$(BLS_KEYSTORE)" ]; then \
1187+
echo "Error: INVENTORY, ECDSA_KEYSTORE, BLS_KEYSTORE must be set."; \
1188+
exit 1; \
1189+
fi
1190+
@ansible-playbook infra/ansible/playbooks/aggregator.yaml \
1191+
-i $(INVENTORY) \
1192+
-e "ecdsa_keystore_path=$(ECDSA_KEYSTORE)" \
1193+
-e "bls_keystore_path=$(BLS_KEYSTORE)"
11801194

11811195
ansible_operator_create_env: ## Create empty variables files for the Operator deploy
11821196
@cp -n infra/ansible/playbooks/ini/config-operator.ini.example infra/ansible/playbooks/ini/config-operator.ini

infra/ansible/README.md

Lines changed: 50 additions & 18 deletions
Large diffs are not rendered by default.
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
- name: Run setup playbook
2+
ansible.builtin.import_playbook: setup.yaml
3+
vars:
4+
host: aggregator
5+
6+
- name: Run go playbook
7+
ansible.builtin.import_playbook: go.yaml
8+
vars:
9+
host: aggregator
10+
11+
- hosts: aggregator
12+
vars:
13+
service: "aggregator"
14+
15+
tasks:
16+
- name: Update apt and install required system packages
17+
become: true
18+
apt:
19+
pkg:
20+
- pkg-config
21+
- libssl-dev
22+
state: latest
23+
update_cache: true
24+
vars:
25+
ansible_ssh_user: "{{ admin_user }}"
26+
27+
- name: Create directories for each service if do not exist
28+
file:
29+
path: /home/{{ ansible_user }}/repos/{{ service }}
30+
state: directory
31+
mode: '0755'
32+
owner: '{{ ansible_user }}'
33+
group: '{{ ansible_user }}'
34+
loop:
35+
- aggregator
36+
37+
- name: Clone Aligned repository
38+
git:
39+
repo: https://github.com/yetanotherco/aligned_layer.git
40+
dest: /home/{{ ansible_user }}/repos/{{ service }}/aligned_layer
41+
version: v0.10.2
42+
loop:
43+
- aggregator
44+
45+
- name: Set permissions for cloned repository
46+
file:
47+
path: /home/{{ ansible_user }}/repos/{{ service }}/aligned_layer
48+
mode: '0755'
49+
owner: '{{ ansible_user }}'
50+
group: '{{ ansible_user }}'
51+
recurse: yes
52+
53+
- name: Copy ECDSA keystore to server
54+
copy:
55+
src: '{{ ecdsa_keystore_path }}'
56+
dest: /home/{{ ansible_user }}/.keystores/aggregator.ecdsa
57+
owner: '{{ ansible_user }}'
58+
group: '{{ ansible_user }}'
59+
60+
- name: Copy BLS keystore to server
61+
copy:
62+
src: '{{ bls_keystore_path }}'
63+
dest: /home/{{ ansible_user }}/.keystores/aggregator.bls
64+
owner: '{{ ansible_user }}'
65+
group: '{{ ansible_user }}'
66+
67+
- name: Build aggregator
68+
shell:
69+
chdir: /home/{{ ansible_user }}/repos/aggregator/aligned_layer/
70+
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
71+
72+
- name: Upload config file for aggregator
73+
template:
74+
src: config-files/config-aggregator.yaml.j2
75+
dest: "/home/{{ ansible_user }}/config/config-aggregator.yaml"
76+
vars:
77+
aligned_layer_deployment_config_file_path: "{{ lookup('ini', 'aligned_layer_deployment_config_file_path', file='ini/config-aggregator.ini') }}"
78+
eigen_layer_deployment_config_file_path: "{{ lookup('ini', 'eigen_layer_deployment_config_file_path', file='ini/config-aggregator.ini') }}"
79+
eth_rpc_url: "{{ lookup('ini', 'eth_rpc_url', file='ini/config-aggregator.ini') }}"
80+
eth_rpc_url_fallback: "{{ lookup('ini', 'eth_rpc_url_fallback', file='ini/config-aggregator.ini') }}"
81+
eth_ws_url: "{{ lookup('ini', 'eth_ws_url', file='ini/config-aggregator.ini') }}"
82+
eth_ws_url_fallback: "{{ lookup('ini', 'eth_ws_url_fallback', file='ini/config-aggregator.ini') }}"
83+
ecdsa_private_key_store_path: "{{ lookup('ini', 'ecdsa_private_key_store_path', file='ini/config-aggregator.ini') }}"
84+
ecdsa_private_key_store_password: "{{ lookup('ini', 'ecdsa_private_key_store_password', file='ini/config-aggregator.ini') }}"
85+
bls_private_key_store_path: "{{ lookup('ini', 'bls_private_key_store_path', file='ini/config-aggregator.ini') }}"
86+
bls_private_key_store_password: "{{ lookup('ini', 'bls_private_key_store_password', file='ini/config-aggregator.ini') }}"
87+
enable_metrics: "{{ lookup('ini', 'enable_metrics', file='ini/config-aggregator.ini') }}"
88+
metrics_ip_port_address: "{{ lookup('ini', 'metrics_ip_port_address', file='ini/config-aggregator.ini') }}"
89+
telemetry_ip_port_address: "{{ lookup('ini', 'telemetry_ip_port_address', file='ini/config-aggregator.ini') }}"
90+
91+
- name: Allow access to tcp port 8090
92+
become: true
93+
ufw:
94+
rule: allow
95+
port: 8090
96+
proto: tcp
97+
vars:
98+
ansible_ssh_user: "{{ admin_user }}"
99+
100+
- name: Create systemd services directory
101+
file:
102+
path: "/home/{{ ansible_user }}/.config/systemd/user/"
103+
state: directory
104+
105+
- name: Add service to systemd
106+
template:
107+
src: services/aggregator.service.j2
108+
dest: "/home/{{ ansible_user }}/.config/systemd/user/aggregator.service"
109+
force: no
110+
111+
- name: Start aggregator service
112+
systemd_service:
113+
name: aggregator
114+
state: started
115+
enabled: true
116+
scope: user

infra/ansible/playbooks/batcher.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
telemetry_ip_port_address: "{{ lookup('ini', 'telemetry_ip_port_address', file='ini/config-batcher.ini') }}"
9898
batcher_replacement_private_key: "{{ lookup('ini', 'batcher_replacement_private_key', file='ini/config-batcher.ini') }}"
9999

100-
101100
- name: Upload env file for batcher
102101
template:
103102
src: config-files/env-batcher.j2
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[global]
2+
aligned_layer_deployment_config_file_path=
3+
eigen_layer_deployment_config_file_path=
4+
eth_rpc_url=
5+
eth_rpc_url_fallback=
6+
eth_ws_url=
7+
eth_ws_url_fallback=
8+
ecdsa_private_key_store_path=
9+
ecdsa_private_key_store_password=
10+
bls_private_key_store_path=
11+
bls_private_key_store_password=
12+
enable_metrics=
13+
metrics_ip_port_address=
14+
telemetry_ip_port_address=
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Common variables for all the services
2+
# 'production' only prints info and above. 'development' also prints debug
3+
environment: "production"
4+
aligned_layer_deployment_config_file_path: "{{ aligned_layer_deployment_config_file_path }}"
5+
eigen_layer_deployment_config_file_path: "{{ eigen_layer_deployment_config_file_path }}"
6+
eth_rpc_url: "{{ eth_rpc_url }}"
7+
eth_rpc_url_fallback: "{{ eth_rpc_url_fallback }}"
8+
eth_ws_url: "{{ eth_ws_url }}"
9+
eth_ws_url_fallback: "{{ eth_ws_url_fallback }}"
10+
eigen_metrics_ip_port_address: "localhost:9090"
11+
12+
## ECDSA Configurations
13+
ecdsa:
14+
private_key_store_path: "{{ ecdsa_private_key_store_path }}"
15+
private_key_store_password: "{{ ecdsa_private_key_store_password }}"
16+
17+
## BLS Configurations
18+
bls:
19+
private_key_store_path: "{{ bls_private_key_store_path }}"
20+
private_key_store_password: "{{ bls_private_key_store_password }}"
21+
22+
## Aggregator Configurations
23+
aggregator:
24+
server_ip_port_address: localhost:8090
25+
bls_public_key_compendium_address:
26+
avs_service_manager_address:
27+
enable_metrics: {{ enable_metrics }}
28+
metrics_ip_port_address: "{{ metrics_ip_port_address }}"
29+
telemetry_ip_port_address: "{{ telemetry_ip_port_address }}"
30+
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
31+
garbage_collector_tasks_age: 20 #The age of tasks that will be removed by the GC, in blocks. Suggested value for prod: '216000' (30 days)
32+
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=Aggregator
3+
After=network.target
4+
5+
[Service]
6+
Type=simple
7+
WorkingDirectory=/home/{{ ansible_user }}/repos/aggregator/aligned_layer/aggregator
8+
ExecStart=/home/{{ ansible_user }}/repos/aggregator/aligned_layer/build/aligned-aggregator --config /home/{{ ansible_user }}/config/config-aggregator.yaml
9+
Restart=always
10+
RestartSec=1
11+
StartLimitBurst=100
12+
LimitNOFILE=100000
13+
14+
[Install]
15+
WantedBy=multi-user.target

infra/ansible/stage_inventory.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
aggregator:
22
hosts:
33
aligned-holesky-aggregator-1:
4-
ansible_host: aligned-ansible
5-
ansible_user: admin
6-
app_user: app
4+
ansible_host: aligned-holesky-stage-1-aggregator
5+
admin_user: admin
6+
ansible_user: app
77
ansible_python_interpreter: /usr/bin/python3
88
batcher:
99
hosts:

0 commit comments

Comments
 (0)