17 Commits

Author SHA1 Message Date
13ef869339 Merge pull request #31 from matter-labs/add-replication-vars
Some checks are pending
Release / Release (push) Waiting to run
feat: Added optional postgres replication
2024-11-19 16:35:45 +01:00
cfbaed74f0 Added replication flags 2024-11-19 16:28:13 +01:00
6f1e025785 Added replication flags 2024-11-19 16:26:57 +01:00
f347a9173e feat: Added optional postgres replication 2024-11-19 16:12:31 +01:00
2bf98e9273 feat: Added optional postgres replication 2024-11-19 16:11:28 +01:00
dde435ca95 Merge pull request #30 from matter-labs/fix-snapshot-conf
feat: Bump default EN version, fix snapshot recovery config
2024-10-02 17:23:55 +02:00
8d085aa960 dedup 2024-10-02 17:21:47 +02:00
b85a7d5c65 feat: Bump default EN version, fix snapshot recovery config 2024-10-02 17:18:15 +02:00
6a3c8cb263 Merge pull request #28 from matter-labs/ya-zkd-1817-upgrade-external-nodes-on-hetzner5
fix: Route all consensus traffic to the docker port.
2024-08-13 13:57:35 +02:00
ed4feb99bc fix: Route all consensus traffic to the docker port. 2024-08-13 13:56:28 +02:00
605525c7ba Merge pull request #27 from matter-labs/ya-zkd-1817-upgrade-external-nodes-on-hetzner4
feat: Add traefik configuration for consensus TCP port, open it in firewall
2024-08-13 13:36:58 +02:00
5bdeb0fcfa feat: Add traefik configuration for consensus TCP port, open it in
firewall
2024-08-13 13:32:10 +02:00
bf186104d4 Merge pull request #26 from matter-labs/ya-zkd-1817-upgrade-external-nodes-on-hetzner3
fix: Correct path and file names for consensus
2024-08-12 17:33:38 +02:00
493e5ceffc fix: Correct path and file names for consensus 2024-08-12 17:31:25 +02:00
7a77daacf3 Merge pull request #25 from matter-labs/ya-zkd-1817-upgrade-external-nodes-on-hetzner2
fix: Correct task names
2024-08-12 17:10:16 +02:00
8290a1cd9b Yaml lint 2024-08-12 15:32:48 +02:00
191ebeced5 fix: Correct task names 2024-08-12 14:55:50 +02:00
4 changed files with 68 additions and 14 deletions

View File

@ -11,7 +11,7 @@ docker_compose_version: "v2.23.0"
# Versions of External Node and 3rd party components
traefik_version: 2.11
postgres_version: 14
external_node_version: 24.16.0
external_node_version: 24.26.0
external_node_raw_docker_tag: ""
vmagent_version: 1.100.1
cadvisor_version: 0.47.2
@ -56,6 +56,11 @@ postgres_arguments:
- max_parallel_maintenance_workers=4
- -c
- checkpoint_timeout=1800
enable_postgres_replication: false
# IP address of the interface replication
postgres_replications_arguments: []
postgres_replication_bind_address: ""
postgres_replica_address: ""
# Enable TLS for traefik
enable_tls: false

View File

@ -49,6 +49,23 @@
source: "{{ loadbalancer_ip | mandatory }}"
jump: ACCEPT
- name: Allow consensus port traffic from any IP
when: enable_consensus
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_port: "{{ consensus_port }}"
jump: ACCEPT
- name: Allow postgres replication traffic from replica only
when: enable_postgres_replication
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_port: 5432
source: "{{ postgres_replica_address }}"
jump: ACCEPT
- name: Set default policy to DROP
ansible.builtin.iptables:
chain: INPUT

View File

@ -32,13 +32,28 @@
- l2_chain_id
- l1_chain_id
- name: "Verify that required variables for replication is set"
when: enable_postgres_replication
ansible.builtin.assert:
that:
- required_var != ""
fail_msg: "{{ postgress_replication_required_var }} needs to be set for the role for postgres replication to work"
success_msg: "Required variable for postgres replication {{ postgress_replication_required_var }} isn't empty"
loop_control:
loop_var: postgress_replication_required_var
with_items:
- enable_postgres_replication
- postgres_replication_bind_address
- postgres_replica_address
- postgres_replications_arguments
- name: Check required en vars empty
ansible.builtin.fail:
msg: "Variable '{{ item }}' is empty"
when: vars[item] == ""
with_items: "{{ en_required_variables }}"
- name: Copy main configs
- name: Create main configs
ansible.builtin.template:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
@ -51,7 +66,7 @@
- src: "templates/postgres.env.j2"
dest: "{{ configuration_directory }}/postgres.env"
- name: Copy restore script
- name: Create restore script
register: restore_dump_script
ansible.builtin.template:
src: 'templates/restore_dump.sh.j2'
@ -64,7 +79,7 @@
when: enable_monitoring and ( vars[item] == "" )
with_items: "{{ monitoring_required_variables }}"
- name: Copy monitoring configs
- name: Create monitoring configs
when: enable_monitoring
ansible.builtin.template:
src: '{{ item.src }}'
@ -76,7 +91,7 @@
- src: "templates/vmagent-config.yml.j2"
dest: "{{ configuration_directory }}/vmagent-config.yml"
- name: Copy main configs
- name: Create consensus config
when: enable_consensus
ansible.builtin.template:
src: "templates/consensus_config.yaml.j2"
@ -88,7 +103,7 @@
ansible.builtin.copy:
src: "{{ consensus_secrets_file }}"
dest: "{{ configuration_directory }}/consensus_secrets.yaml"
decrypt: yes
decrypt: true
mode: '0600'
- name: Run docker-compose without monitoring

View File

@ -8,10 +8,13 @@ services:
- "--log.level=INFO"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.external_node_health.address=:3080"
- "--entryPoints.web.address=:80"
- "--entryPoints.external_node_health.address=:3080"
{% if enable_consensus %}
- "--entryPoints.external_node_consensus.address=:{{ consensus_port }}"
{% endif %}
{% if enable_tls %}
- "--entrypoints.websecure.address=:443"
- "--entryPoints.websecure.address=:443"
- "--certificatesresolvers.en_resolver.acme.tlschallenge=true"
- "--certificatesresolvers.en_resolver.acme.storage=/letsencrypt/acme.json"
- "--certificatesresolvers.myresolver.acme.email={{ acme_email }}"
@ -40,12 +43,23 @@ services:
- ./restore_dump.sh:/docker-entrypoint-initdb.d/restore_dump.sh
env_file:
- postgres.env
{% if enable_postgres_replication %}
environment:
POSTGRES_HOST_AUTH_METHOD: "host replication replicator {{ postgres_replica_address }}/32 md5"
ports:
- "{{ postgres_replication_interface }}:5432:5432"
{% endif %}
command:
- postgres
- -c
{% for argument in postgres_arguments %}
- {{ argument }}
{% endfor %}
{% if enable_postgres_replication %}
{% for repl_argument in postgres_replications_arguments %}
- {{ repl_argument }}
{% endfor %}
{% endif %}
external_node:
{% if not external_node_raw_docker_tag %}
image: "matterlabs/external-node:v{{ external_node_version }}"
@ -76,6 +90,12 @@ services:
{% if enable_basic_auth %}
- "traefik.http.routers.external_node_main.middlewares=external_node_auth"
- "traefik.http.middlewares.external_node_auth.basicauth.users={{ basic_auth_secret }}"
{% endif %}
{% if enable_consensus %}
- "traefik.tcp.services.external_node_consensus.loadbalancer.server.port={{ consensus_port }}"
- "traefik.tcp.routers.external_node_consensus.rule=HostSNI(`*`)"
- "traefik.tcp.routers.external_node_consensus.entrypoints=external_node_consensus"
- "traefik.tcp.routers.external_node_consensus.service=external_node_consensus"
{% endif %}
expose:
- {{ rpc_http_port }}
@ -101,7 +121,7 @@ services:
RUST_LOG: {{ rust_log }}
{% if enable_consensus %}
EN_CONSENSUS_CONFIG_PATH: /etc/consensus_config.yaml
EN_CONSENSUS_SECRETS_PATH: /run/secrets/consensus_secrets.yaml
EN_CONSENSUS_SECRETS_PATH: /run/secrets/consensus_secrets
{% endif %}
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:{{ healthcheck_port }}/health" ]
@ -112,15 +132,12 @@ services:
volumes:
- "{{ storage_directory }}/db:/db"
{% if enable_consensus %}
- "consensus_config.yaml:/etc/consensus_config.yaml"
- "{{ configuration_directory }}/consensus_config.yaml:/etc/consensus_config.yaml"
{% endif %}
env_file:
- "external_node.env"
- "postgres.env"
command:
{% if enable_snapshots_recovery %}
- --enable-snapshots-recovery
{% endif %}
{% if enable_consensus %}
- --enable-consensus
secrets: