added an example

This commit is contained in:
tomg10
2024-03-22 01:35:00 +01:00
parent 281068a752
commit 69435131f7
8 changed files with 65 additions and 6 deletions

View File

@ -14,7 +14,9 @@ This role has been tested on:
## Usage
Minimal required variables that has to be set:
For a very simple minimal working example, see example_playbooks directory
Minimal required variables that have to be set:
```yaml
database_name: ""

View File

@ -22,10 +22,6 @@ postgres_arguments:
- -c
- max_connections=256
- -c
- shared_buffers=47616MB
- -c
- effective_cache_size=142848MB
- -c
- maintenance_work_mem=2GB
- -c
- checkpoint_completion_target=0.9

View File

@ -0,0 +1,23 @@
# Mainnet Snapshots Recovery playbook
This directory is simple example how to set up EN using this role. It comes with snapshots recovery enabled by default.\
**Note that for simplicity it's using postgres database
with a very unsecure password and the EN is just started on the same machine**
To run this playbook, first install dependencies
```shell
ansible-galaxy install -r requirements.yml
```
and then you can run the playbook using
```shell
ansible-playbook playbook.yml -i hosts.ini -K
```
To see logs you can use
```shell
docker logs en-external_node-1
```

View File

@ -0,0 +1,2 @@
[local]
localhost ansible_connection=local

View File

@ -0,0 +1,15 @@
- hosts: all
become: true
vars:
database_name: "zksync_ext_node_mainnet"
database_username: "postgres"
database_password: "notsecurepassword"
eth_l1_url: "https://ethereum-rpc.publicnode.com"
main_node_url: "https://zksync2-mainnet.zksync.io"
l1_chain_id: "1"
l2_chain_id: "324"
enable_snapshots_recovery: true
snapshots_bucket_base_url: "zksync-era-mainnet-external-node-snapshots"
roles:
- external_node

View File

@ -0,0 +1,13 @@
---
roles:
- name: geerlingguy.docker
src: https://github.com/geerlingguy/ansible-role-docker
version: "7.1.0"
- name: external_node
src: https://github.com/matter-labs/ansible-en-role
version: "v3.0.0"
collections:
- name: community.general
version: 8.4.0

View File

@ -2,7 +2,7 @@
dependencies:
- src: geerlingguy.docker
version: "7.1.0"
when: docker_install
when: docker_install_compose
galaxy_info:
role_name: external_node

View File

@ -47,7 +47,11 @@ services:
- {{ argument }}
{% endfor %}
external_node:
{% if not external_node_raw_docker_tag %}
image: "matterlabs/external-node:v{{ external_node_version }}"
{% else %}
image: "matterlabs/external-node:{{ external_node_raw_docker_tag }}"
{% endif %}
restart: unless-stopped
depends_on:
postgres:
@ -103,3 +107,7 @@ services:
env_file:
- "external_node.env"
- "postgres.env"
{% if enable_snapshots_recovery %}
command:
- --enable-snapshots-recovery
{% endif %}