-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: JuArce <[email protected]> Co-authored-by: Klaus Lungwitz <[email protected]>
- Loading branch information
1 parent
d7bcec1
commit f5ded52
Showing
8 changed files
with
244 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') }}" | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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= |
32 changes: 32 additions & 0 deletions
32
infra/ansible/playbooks/templates/config-files/config-aggregator.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
15
infra/ansible/playbooks/templates/services/aggregator.service.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters