feat!: Expose consensus debug port, restart EN on config file change (#42)
Some checks failed
Release / Release (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Ansible lint (push) Has been cancelled

## What 

Subj

## Why 

QoL

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Documentation comments have been added / updated.
This commit is contained in:
Igor Borodin
2025-04-25 16:54:26 +02:00
committed by GitHub
parent 17d9ecd1ce
commit 5d8aaa769d
6 changed files with 54 additions and 23 deletions

View File

@ -54,6 +54,13 @@
msg: "Variable '{{ item }}' is empty"
when: vars[item] == ""
with_items: "{{ en_required_variables }}"
- name: "Verify consensus debug port configuration"
ansible.builtin.fail:
msg: "Cannot expose consensus debug port (expose_consensus_debug_port=true) if it is not enabled (enable_consensus_debug_port=false)."
when:
- enable_consensus
- expose_consensus_debug_port
- not enable_consensus_debug_port
- name: Create main configs
ansible.builtin.template:
@ -67,6 +74,8 @@
dest: "{{ configuration_directory }}/external_node.env"
- src: "templates/postgres.env.j2"
dest: "{{ configuration_directory }}/postgres.env"
loop_control:
label: "{{ item.dest }}"
- name: Create restore script
register: restore_dump_script
@ -99,6 +108,7 @@
src: "templates/consensus_config.yaml.j2"
dest: "{{ configuration_directory }}/consensus_config.yaml"
mode: '0644'
notify: Restart external-node service
- name: Decrypt consensus_secrets
when: enable_consensus
@ -107,24 +117,17 @@
dest: "{{ configuration_directory }}/consensus_secrets.yaml"
decrypt: true
mode: '0600'
notify: Restart external-node service
- name: Run docker-compose without monitoring
when: not enable_monitoring
ansible.builtin.shell:
cmd: nohup docker compose -f docker-compose.yaml up -d </dev/null >/dev/null 2>&1 &
chdir: "{{ configuration_directory }}"
changed_when: false
- name: Set docker compose files list
ansible.builtin.set_fact:
docker_compose_files: "{{ ['docker-compose.yaml'] + (['monitoring.yaml'] if enable_monitoring else []) }}"
- name: Run docker-compose with monitoring
when: enable_monitoring and (not restore_dump_script.changed)
ansible.builtin.shell:
cmd: nohup docker compose -f monitoring.yaml -f docker-compose.yaml up -d </dev/null >/dev/null 2>&1 &
chdir: "{{ configuration_directory }}"
changed_when: false
- name: Run docker-compose with monitoring with recreation
when: enable_monitoring and restore_dump_script.changed
ansible.builtin.shell:
cmd: nohup docker compose -f monitoring.yaml -f docker-compose.yaml up -d --force-recreate </dev/null >/dev/null 2>&1 &
chdir: "{{ configuration_directory }}"
changed_when: false
- name: Run docker compose services (non-blocking)
community.docker.docker_compose_v2:
project_src: "{{ configuration_directory }}"
files: "{{ docker_compose_files }}"
state: present
pull: "{{ docker_pull_policy | default('missing') }}"
recreate: "{{ 'always' if restore_dump_script.changed else 'auto' }}"
wait: false