Merge pull request #13 from matter-labs/additional-env-vars-en-container

feat: Ability to pass additional env vars to EN container
This commit is contained in:
Igor Borodin
2024-04-02 16:15:46 +02:00
committed by GitHub
6 changed files with 29 additions and 10 deletions

View File

@ -27,9 +27,10 @@ Describe what actually happened.
#### 🖥️ Environment
Any relevant environment details like:
* Ansible version
* Operating system
* External node version
* External Node version
#### 📋 Additional Context

View File

@ -5,7 +5,7 @@ sovereignty! We welcome contributions from anyone on the internet, and are grate
## Ways to contribute
There are many ways to contribute to the external node role:
There are many ways to contribute to the External Node role:
1. Open issues: if you find a bug, have something you believe needs to be fixed, or have an idea for a feature, please
open an issue.

View File

@ -28,6 +28,15 @@ l1_chain_id: ""
l2_chain_id: ""
```
Additional arbitrary environment variables can be passed to External Node container:
```yaml
additional_env_vars:
- { name: "EN_ADDITIONAL_VAR1", value: "Value1" }
- { name: "EN_ADDITIONAL_VAR2", value: "Value2" }
- { name: "EN_ADDITIONAL_VAR3", value: "Value3" }
```
Please refer to [External Node docs](https://github.com/matter-labs/zksync-era/tree/main/docs/guides/external-node/prepared_configs) to find values for different zkSync Era chains.
If you want to use monitoring (which we highly recommend), you have to change these variables:
@ -75,7 +84,6 @@ We recommend using pgtune [online](https://pgtune.leopard.in.ua/) or [self-hoste
If you want to use basic auth for inbound requests, you have to change next variables:
```yaml
# Enable basic auth for external node
enable_basic_auth: true
basic_auth_secret: "htpasswd-generated-secret"
```
@ -104,7 +112,7 @@ Skip this step if you are recovering from a snapshot!
4. Run ansible-playbook using this role. We recommend encrypting next variables with ansible-vault or some another way:
```
```yaml
database_username
database_password
eth_l1_url
@ -117,6 +125,7 @@ vm_auth_password
## Snapshots Recovery
example config enabling recovery from a snapshot
```yaml
- enable_snapshots_recovery: true
- snapshots_bucket_base_url: "zksync-era-mainnet-external-node-snapshots"

View File

@ -8,7 +8,7 @@ docker_install_compose: true
docker_version: "25.0.3"
docker_compose_version: "v2.23.0"
# Versions of external node and 3rd party components
# Versions of External Node and 3rd party components
traefik_version: 2.11
postgres_version: 14
external_node_version: 21.0.2
@ -61,7 +61,7 @@ enable_tls: false
acme_email: ""
domain_name: ""
# Enable basic auth for external node
# Enable basic auth for External Node
enable_basic_auth: false
basic_auth_secret: ""
@ -72,7 +72,7 @@ force_pg_restore: false
enable_snapshots_recovery: false
snapshots_bucket_base_url: ""
# External node and database options
# External Node and database options
database_name: ""
database_username: ""
database_password: ""
@ -86,6 +86,9 @@ healthcheck_port: 3081
metrics_port: 3082
rust_log: zksync_external_node=info,zksync_core=info,zksync_core::sync_layer=info,zksync_server=info,zksync_prover=info,zksync_contract_verifier=info,zksync_dal=info,zksync_eth_client=info,zksync_storage=info,zksync_db_manager=info,zksync_merkle_tree=info,zksync_state=info,zksync_utils=info,zksync_types=info,loadnext=info,dev_ticker=info,vm=info,block_sizes_test=info,zksync_verification_key_generator_and_server=info,zksync_object_store=info,setup_key_generator_and_server=info,zksync_circuit_synthesizer=info,zksync_queued_job_processor=info,zksync_health_check=info
# Additional env vars passed to External Node
additional_env_vars: []
# Monitoring options section
enable_monitoring: false
node_name: ""

View File

@ -7,7 +7,7 @@ dependencies:
galaxy_info:
role_name: external_node
author: matter-labs
description: External node setup
description: External Node setup
license: "license (MIT, APACHE)"
min_ansible_version: "2.13.9"
platforms:

View File

@ -9,3 +9,9 @@ EN_SNAPSHOTS_OBJECT_STORE_BUCKET_BASE_URL="{{ snapshots_bucket_base_url | mandat
{% endif %}
DATABASE_URL="postgres://{{ database_username | mandatory }}:{{ database_password | mandatory }}@postgres/{{ database_name | mandatory }}"
{% if additional_env_vars is defined and additional_env_vars|length > 0 %}
{% for env_var in additional_env_vars %}
{{ env_var.name }}="{{ env_var.value }}"
{% endfor %}
{% endif %}