Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dashmate for seeds #535

Merged
merged 13 commits into from
Aug 28, 2023
17 changes: 5 additions & 12 deletions ansible/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,16 @@
- name: Set node variables for seed nodes
ansible.builtin.set_fact:
node: "{{ seed_nodes[inventory_hostname] }}"
mode: "seed"
tags: always
when: inventory_hostname in seed_nodes
roles:
- role: dash_cli
- role: dashd
dashd_listen: true
dashd_zmq: true
dashd_indexes: true
tags:
- dashd
- role: mn_evo_services
tags:
- evo
when: evo_services
- role: dashmate
- role: mn_status_report
- role: elastic_beats
core_container_name: dashd
abci_logs_path: "{{ mn_evo_services_path }}/logs"
core_container_name: core
abci_logs_path: "{{ dashmate_logs_dir }}"

- name: Set up core on masternodes
hosts: masternodes
Expand Down
5 changes: 0 additions & 5 deletions ansible/group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ governance_proposal_count: 2
# Disk space allocated for swap file on each host
swap_space: 2G

# MN Evo Services

mn_evo_services_compose_project_name: mn_evo_services
mn_evo_services_path: '{{ dashd_home }}/{{ mn_evo_services_compose_project_name }}'

# Elastic

elastic_username: elastic
Expand Down
34 changes: 33 additions & 1 deletion ansible/roles/dashmate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Dashmate Config Changed: {{ is_dashmate_config_changed }}\n"
chdir: '{{ dashmate_cwd }}'
register: dashmate_restart
when:
- dashmate_start_platform.skipped and dashmate_start.skipped
- not dashmate_start_platform.changed and not dashmate_start.changed
- is_core_images_updated or is_dashmate_package_changed or is_dashmate_config_changed
changed_when: dashmate_restart.rc == 0

Expand All @@ -269,6 +269,38 @@ Dashmate Config Changed: {{ is_dashmate_config_changed }}\n"
chdir: '{{ dashmate_cwd }}'
changed_when: build_dashmate_helper.rc == 0

# In the seed mode, we are disabling some services that are not necessary to run on the node
strophy marked this conversation as resolved.
Show resolved Hide resolved
# We are shutting down dapi, envoy, and other services, leaving only core & tenderdash running

- name: Pull started services list
ansible.builtin.command: "{{ dashmate_cmd }} status services --format=json"
become: true
become_user: dashmate
changed_when: started_dashmate_services.rc == 0
args:
chdir: '{{ dashmate_cwd }}'
register: started_dashmate_services
when: mode == 'seed'

- name: Extract tenderdash and core container ids
ansible.builtin.set_fact:
containers_to_stop: >-
{{
started_dashmate_services.stdout |
from_json |
json_query('[?service!=`dashmate_helper`&&service!=`core`&&service!=`drive_tenderdash`]') |
map(attribute='containerId') |
list
}}
when: mode == 'seed'

- name: Stop all services except Core and Tenderdash
community.docker.docker_container:
name: "{{ item }}"
state: stopped
when: mode == 'seed'
loop: "{{ containers_to_stop }}"

# TODO Convenient tasks until we have this functionality in dashmate
# - name: Replace parameters in tenderdash config
# ansible.builtin.lineinfile:
Expand Down
5 changes: 3 additions & 2 deletions ansible/roles/dashmate/templates/dashmate.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"privateKey": {% if dashd_sporkkey is defined %}"{{ dashd_sporkkey }}"{% else %}null{% endif %}
},
"masternode": {
"enable": {% if node is defined %}true{% else %}false{% endif %},
"enable": {% if node is defined and node['operator'] is defined %}true{% else %}false{% endif %},
"operator": {
"privateKey": {% if node is defined%}"{{ node.operator.private_key }}"{% else %}null{% endif %}
"privateKey": {% if node is defined and node['operator'] is defined %}"{{ node.operator.private_key }}"{% else %}null{% endif %}
}
},
"miner": {
Expand Down Expand Up @@ -148,6 +148,7 @@
}
},
"tenderdash": {
"mode": {% if mode is defined and mode == 'seed' %}"seed"{% else %}"validator"{% endif %},
"docker": {
"image": "{{ tendermint_image }}"
},
Expand Down
17 changes: 1 addition & 16 deletions ansible/roles/kill_platform/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,7 @@
ansible.builtin.import_role:
name: dashmate
tasks_from: destroy_platform
when: inventory_hostname in groups["hp_masternodes"]

- name: Remove platform docker containers and volumes
community.docker.docker_compose:
project_src: '{{ mn_evo_services_path }}'
state: absent
remove_volumes: false
when:
- inventory_hostname not in groups["hp_masternodes"]

- name: Delete platform dir
ansible.builtin.file:
state: absent
path: '{{ mn_evo_services_path }}'
when:
- inventory_hostname not in groups["hp_masternodes"]
when: inventory_hostname in groups["hp_masternodes"] or inventory_hostname in groups["seeds"]

- name: Remove any remaining docker data
community.docker.docker_prune:
Expand Down
71 changes: 0 additions & 71 deletions ansible/roles/mn_evo_services/tasks/main.yml

This file was deleted.

39 changes: 0 additions & 39 deletions ansible/roles/mn_evo_services/tasks/tendermint.yml

This file was deleted.

1 change: 0 additions & 1 deletion ansible/roles/mn_evo_services/templates/.env.j2

This file was deleted.

53 changes: 0 additions & 53 deletions ansible/roles/mn_evo_services/templates/dapi-envoy.yaml.j2

This file was deleted.

This file was deleted.

Loading