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

Aggregator ansible #1387

Merged
merged 80 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
4172aa6
infra: add ansible scripts and services
JuArce Oct 21, 2024
d45921f
fix: stage ansible
JuArce Oct 29, 2024
f0777fb
chore: update ansible scripts
JuArce Oct 30, 2024
f98ccac
WIP: Inventory with groups
klaus993 Oct 31, 2024
3ebf895
Adapt rust playbook to new way of passing user
klaus993 Oct 31, 2024
01ea554
Adapt eigenlayer-cli playbook to new way of passing user
klaus993 Oct 31, 2024
dbdf94a
Merge remote-tracking branch 'origin/staging' into 1344-ci-improve-se…
klaus993 Oct 31, 2024
d17162d
Adapt go playbook to new way of passing user
klaus993 Oct 31, 2024
d44ac44
Adapt rust playbook to new way of passing user
klaus993 Oct 31, 2024
f640339
Adapt setup playbook to new way of passing user
klaus993 Oct 31, 2024
497cf0f
chore: update ansible and batcher service
JuArce Oct 31, 2024
405b611
Add enable linger
klaus993 Oct 31, 2024
a12924f
Adapt aggregator playbook to new way of passing user
klaus993 Oct 31, 2024
b1ac303
WIP: add compile all FFIs task
klaus993 Oct 31, 2024
0fb1117
Merge branch 'refs/heads/1344-ci-improve-servers-setup' into batcher_…
JuArce Nov 1, 2024
ba159ce
chore: move playbooks to playbooks directory
JuArce Nov 1, 2024
23e3741
chore: add config files to ansible scripts
JuArce Nov 1, 2024
9816bef
ci: add caddy and wallet
JuArce Nov 4, 2024
64242f3
ci: add make targets
JuArce Nov 5, 2024
590bd7e
ci: add README.md
JuArce Nov 5, 2024
1697986
nit
JuArce Nov 5, 2024
cdbd2d4
nit
JuArce Nov 5, 2024
e1b4b04
ci: improve imported playbooks run
JuArce Nov 5, 2024
88ca83a
ci: deploy operator with ansible
JuArce Nov 5, 2024
ab51d4f
fix: undo aggregator.yaml changes
JuArce Nov 5, 2024
077cccc
fix: undo aggregator.yaml changes
JuArce Nov 5, 2024
a4ea64a
fix: remove service variables
JuArce Nov 5, 2024
e399e17
fix: pr comments
JuArce Nov 5, 2024
56f3377
fix: use become: true instead of sudo
JuArce Nov 5, 2024
3ada0e3
fix: do not override ini files if already exists
JuArce Nov 5, 2024
879cb70
Merge branch 'refs/heads/staging' into 1344-ci-improve-servers-setup
JuArce Nov 5, 2024
8dbb94e
Merge branch 'refs/heads/1344-ci-improve-servers-setup' into batcher_…
JuArce Nov 5, 2024
4722a45
ci: ansible setup for batcher (#1371)
JuArce Nov 5, 2024
08b8b61
Merge branch 'refs/heads/1344-ci-improve-servers-setup' into operator…
JuArce Nov 5, 2024
dbdd119
ci: aggregator ansible.
samoht9277 Nov 6, 2024
c4f3a0f
Merge branch '1344-ci-improve-servers-setup' into aggregator_ansible
samoht9277 Nov 6, 2024
1fcbd67
added newline to batcher file.
samoht9277 Nov 6, 2024
f1febe3
nit
JuArce Nov 5, 2024
8bb62d0
Added config files for template.
samoht9277 Nov 6, 2024
572e5e7
Added config files for template.
samoht9277 Nov 6, 2024
25bb0ec
Removed gcc.
samoht9277 Nov 6, 2024
ee54e95
Removed newline.
samoht9277 Nov 6, 2024
e3471fd
ci: register operator in eigenlayer
JuArce Nov 6, 2024
d02a272
ci: stake weth after register operator in eigenlayer
JuArce Nov 7, 2024
c66905d
nit
JuArce Nov 7, 2024
c463534
fix: missing new lines
JuArce Nov 7, 2024
45c27b7
docs: update README for operator deploy
JuArce Nov 7, 2024
668eba8
nit
JuArce Nov 7, 2024
51d3745
nit
JuArce Nov 7, 2024
65c88fd
Added ini and templates for aggregator, still needs documentation.
samoht9277 Nov 7, 2024
237465f
Added minor improvments and bug fixes.
samoht9277 Nov 11, 2024
e7ac964
Merged with operator_ansible branch.
samoht9277 Nov 11, 2024
ab20eee
Added docs.
samoht9277 Nov 11, 2024
2c39ff1
docs: update operator ansible README.md
JuArce Nov 11, 2024
781e2bf
Merged docs.
samoht9277 Nov 11, 2024
fbd5cbd
Fixed typo.
samoht9277 Nov 11, 2024
5ee24d1
Added table for default values, removed unnecessary variables inside …
samoht9277 Nov 12, 2024
c934220
Merge branch 'refs/heads/staging' into 1344-ci-improve-servers-setup
JuArce Nov 12, 2024
7172bdd
docs: update ansible README.md
JuArce Nov 12, 2024
f83f955
Fixed missing ansible parameters.
samoht9277 Nov 12, 2024
b89b054
Reverted service file deletion.
samoht9277 Nov 12, 2024
a7298af
docs: add explanation for batcher variables
JuArce Nov 12, 2024
f13e57a
fix: address comments from review
JuArce Nov 13, 2024
84b88de
Merge branch '1344-ci-improve-servers-setup' into aggregator_ansible
samoht9277 Nov 13, 2024
a1d5e4e
Added fixes from comments on github.
samoht9277 Nov 13, 2024
c629459
Merge branch 'aggregator_ansible' of github.com:yetanotherco/aligned_…
samoht9277 Nov 13, 2024
0f11936
Merge branch 'staging' into aggregator_ansible
samoht9277 Nov 13, 2024
4c20f64
Replaced ansible_user to app.
samoht9277 Nov 14, 2024
7b9d1af
Revert "Replaced ansible_user to app."
samoht9277 Nov 14, 2024
89efcce
Merge branch 'aggregator_ansible' of github.com:yetanotherco/aligned_…
samoht9277 Nov 14, 2024
cc30c1a
Replaced ansible_user to app.
samoht9277 Nov 14, 2024
3287934
Fixed typo in readme.
samoht9277 Nov 14, 2024
91e8f54
Added missing creating env on readme.
samoht9277 Nov 14, 2024
8e8407d
Added metrics_ip_port_address variable.
samoht9277 Nov 14, 2024
b1ed4b3
Added metrics_ip_port_address variable to documentation.
samoht9277 Nov 14, 2024
2136817
Fix indentation in table
klaus993 Nov 14, 2024
37e7ea2
Fix indentation in table
klaus993 Nov 14, 2024
2640755
Add newline at end of files
klaus993 Nov 14, 2024
69cb7b5
Remove duplicated task
klaus993 Nov 14, 2024
58c5f86
Delete infra/ansible/playbooks/templates/config-files/env-aggregator.j2
JuArce Nov 14, 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
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,20 @@ ansible_batcher_deploy: ## Deploy the Batcher. Parameters: INVENTORY, KEYSTORE
-i $(INVENTORY) \
-e "keystore_path=$(KEYSTORE)"

ansible_aggregator_create_env: ## Create empty variables files for the Aggregator deploy
@cp -n infra/ansible/playbooks/ini/config-aggregator.ini.example infra/ansible/playbooks/ini/config-aggregator.ini
@echo "Config files for the Aggregator created in infra/ansible/playbooks/ini"
@echo "Please complete the values and run make ansible_aggregator_deploy"

ansible_aggregator_deploy: ## Deploy the Operator. Parameters: INVENTORY
@if [ -z "$(INVENTORY)" ] || [ -z "$(ECDSA_KEYSTORE)" ] || [ -z "$(BLS_KEYSTORE)" ]; then \
echo "Error: INVENTORY, ECDSA_KEYSTORE, BLS_KEYSTORE must be set."; \
exit 1; \
fi
@ansible-playbook infra/ansible/playbooks/aggregator.yaml \
samoht9277 marked this conversation as resolved.
Show resolved Hide resolved
-i $(INVENTORY) \
-e "ecdsa_keystore_path=$(ECDSA_KEYSTORE)" \
-e "bls_keystore_path=$(BLS_KEYSTORE)"

ansible_operator_create_env: ## Create empty variables files for the Operator deploy
@cp -n infra/ansible/playbooks/ini/config-operator.ini.example infra/ansible/playbooks/ini/config-operator.ini
Expand Down
68 changes: 50 additions & 18 deletions infra/ansible/README.md

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions infra/ansible/playbooks/aggregator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
- 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.10.2
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: Copy ECDSA keystore to server
copy:
src: '{{ ecdsa_keystore_path }}'
dest: /home/{{ ansible_user }}/.keystores/aggregator.ecdsa
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'

- name: Copy BLS keystore to server
copy:
src: '{{ bls_keystore_path }}'
dest: /home/{{ ansible_user }}/.keystores/aggregator.bls
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'

- 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') }}"
MarcosNicolau marked this conversation as resolved.
Show resolved Hide resolved
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:
JuArce marked this conversation as resolved.
Show resolved Hide resolved
name: aggregator
state: started
enabled: true
scope: user
1 change: 0 additions & 1 deletion infra/ansible/playbooks/batcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
telemetry_ip_port_address: "{{ lookup('ini', 'telemetry_ip_port_address', file='ini/config-batcher.ini') }}"
batcher_replacement_private_key: "{{ lookup('ini', 'batcher_replacement_private_key', file='ini/config-batcher.ini') }}"


- name: Upload env file for batcher
template:
src: config-files/env-batcher.j2
Expand Down
14 changes: 14 additions & 0 deletions infra/ansible/playbooks/ini/config-aggregator.ini.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[global]
aligned_layer_deployment_config_file_path=
eigen_layer_deployment_config_file_path=
eth_rpc_url=
eth_rpc_url_fallback=
eth_ws_url=
eth_ws_url_fallback=
ecdsa_private_key_store_path=
ecdsa_private_key_store_password=
bls_private_key_store_path=
bls_private_key_store_password=
enable_metrics=
metrics_ip_port_address=
telemetry_ip_port_address=
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Common variables for all the services
# 'production' only prints info and above. 'development' also prints debug
environment: "production"
aligned_layer_deployment_config_file_path: "{{ aligned_layer_deployment_config_file_path }}"
eigen_layer_deployment_config_file_path: "{{ eigen_layer_deployment_config_file_path }}"
eth_rpc_url: "{{ eth_rpc_url }}"
eth_rpc_url_fallback: "{{ eth_rpc_url_fallback }}"
eth_ws_url: "{{ eth_ws_url }}"
eth_ws_url_fallback: "{{ eth_ws_url_fallback }}"
eigen_metrics_ip_port_address: "localhost:9090"

## ECDSA Configurations
ecdsa:
private_key_store_path: "{{ ecdsa_private_key_store_path }}"
private_key_store_password: "{{ ecdsa_private_key_store_password }}"

## BLS Configurations
bls:
private_key_store_path: "{{ bls_private_key_store_path }}"
private_key_store_password: "{{ bls_private_key_store_password }}"

## Aggregator Configurations
aggregator:
server_ip_port_address: localhost:8090
bls_public_key_compendium_address:
avs_service_manager_address:
enable_metrics: {{ enable_metrics }}
metrics_ip_port_address: "{{ metrics_ip_port_address }}"
telemetry_ip_port_address: "{{ telemetry_ip_port_address }}"
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
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)
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
15 changes: 15 additions & 0 deletions infra/ansible/playbooks/templates/services/aggregator.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=Aggregator
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/{{ ansible_user }}/repos/aggregator/aligned_layer/aggregator
ExecStart=/home/{{ ansible_user }}/repos/aggregator/aligned_layer/build/aligned-aggregator --config /home/{{ ansible_user }}/config/config-aggregator.yaml
Restart=always
RestartSec=1
StartLimitBurst=100
LimitNOFILE=100000

[Install]
WantedBy=multi-user.target
6 changes: 3 additions & 3 deletions infra/ansible/stage_inventory.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
aggregator:
hosts:
aligned-holesky-aggregator-1:
ansible_host: aligned-ansible
ansible_user: admin
app_user: app
ansible_host: aligned-holesky-stage-1-aggregator
admin_user: admin
ansible_user: app
samoht9277 marked this conversation as resolved.
Show resolved Hide resolved
ansible_python_interpreter: /usr/bin/python3
batcher:
hosts:
Expand Down