Skip to content

Commit 58074fb

Browse files
authored
refactor: rename go_node to dingo (#183)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 6e38879 commit 58074fb

File tree

9 files changed

+198
-198
lines changed

9 files changed

+198
-198
lines changed

roles/go_node/README.md renamed to roles/dingo/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
go_node
1+
dingo
22
=========
33

44
This role deploys a Blink Labs Go Cardano node instance.
@@ -36,7 +36,7 @@ passed in as parameters) is always nice for users too:
3636
- hosts: servers
3737
tasks:
3838
- include_role:
39-
name: blinklabs.cardano.go_node
39+
name: blinklabs.cardano.dingo
4040
```
4141
4242
License

roles/dingo/defaults/main.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
# Install method
3+
dingo_install_method: 'docker'
4+
5+
# Cardano node version
6+
dingo_version: '0.1.6'
7+
8+
# Cardano network
9+
dingo_network: mainnet
10+
11+
# Base host directory for node data
12+
dingo_dir: /opt/cardano
13+
14+
# Config directory for host/container
15+
dingo_config_dir: '{{ dingo_dir }}/config'
16+
dingo_config_container_dir: '{{ dingo_config_dir }}'
17+
18+
# DB directory for host/container
19+
dingo_db_dir: '{{ dingo_dir }}/data'
20+
dingo_db_container_dir: '{{ dingo_db_dir }}'
21+
22+
# IPC directory for host/container
23+
dingo_ipc_dir: '{{ dingo_dir }}/ipc'
24+
dingo_ipc_container_dir: '{{ dingo_ipc_dir }}'
25+
26+
# Topology directory for host/container
27+
dingo_topology_dir: '{{ dingo_config_dir }}'
28+
dingo_topology_container_dir: '{{ dingo_topology_dir }}'
29+
30+
# Block producer keys directory for host/container
31+
dingo_keys_dir: '{{ dingo_config_dir }}/keys'
32+
dingo_keys_container_dir: '{{ dingo_keys_dir }}'
33+
34+
# User/group for file/directory ownership
35+
dingo_user: root
36+
dingo_group: root
37+
38+
# Docker image
39+
dingo_docker_image: 'ghcr.io/blinklabs-io/dingo:{{ dingo_version }}'
40+
41+
# Docker container name
42+
dingo_docker_container_name: node
43+
44+
# Port for host/container
45+
dingo_container_port: 3001
46+
dingo_port: '{{ dingo_container_port }}'
47+
48+
# Metrics port for host/container
49+
dingo_metrics_container_port: 12798
50+
dingo_metrics_port: '{{ dingo_metrics_container_port }}'
51+
52+
# Socket file name
53+
dingo_socket_name: node.socket
54+
55+
# Config
56+
dingo_manage_config: false # this currently controls mounting only
57+
dingo_config_file: '{{ dingo_config_container_dir }}/{{ dingo_network }}/config.json'
58+
59+
# Topology
60+
dingo_manage_topology: false
61+
dingo_topology_file: '{{ dingo_topology_container_dir }}/{{ dingo_network }}/topology.json'
62+
dingo_topology_use_ledger_after_slot: 128908821
63+
dingo_topology_localroots: []
64+
dingo_topology_publicroots: []
65+
# Adjust for non-mainnet deployments
66+
dingo_topology_bootstrap_peers:
67+
- address: 'backbone.cardano.iog.io'
68+
port: 3001
69+
- address: 'backbone.mainnet.emurgornd.com'
70+
port: 3001
71+
- address: 'backbone.mainnet.cardanofoundation.org'
72+
port: 3001
73+
74+
# Install chrony
75+
chrony_enabled: true
76+
77+
# Mithril configuration
78+
dingo_restore_snapshot: true
79+
dingo_snapshot_digest: 'latest'
80+
81+
# Block Producer (also controls mounts for keys)
82+
dingo_block_producer: false
83+
dingo_shelley_kes_key: '{{ dingo_keys_container_dir }}/kes.skey'
84+
dingo_shelley_opcert: '{{ dingo_keys_container_dir }}/node.cert'
85+
dingo_shelley_vrf_key: '{{ dingo_keys_container_dir }}/vrf.skey'
File renamed without changes.

roles/dingo/tasks/docker.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
- name: Initialize dingo_docker_volumes fact
3+
set_fact:
4+
dingo_docker_volumes: '{{ dingo_docker_volumes | default([]) + [item] }}'
5+
loop:
6+
- '{{ dingo_ipc_dir }}:{{ dingo_ipc_container_dir }}'
7+
- '{{ dingo_db_dir }}:{{ dingo_db_container_dir }}'
8+
9+
- name: Add config to dingo_docker_volumes fact
10+
set_fact:
11+
dingo_docker_volumes: '{{ dingo_docker_volumes | default([]) + [item] }}'
12+
loop:
13+
- '{{ dingo_config_file }}:{{ dingo_config_file }}'
14+
when: dingo_manage_config
15+
16+
- name: Add topology to dingo_docker_volumes fact
17+
set_fact:
18+
dingo_docker_volumes: '{{ dingo_docker_volumes | default([]) + [item] }}'
19+
loop:
20+
- '{{ dingo_topology_file }}:{{ dingo_topology_file }}'
21+
when: dingo_manage_topology
22+
23+
- name: Add keys to dingo_docker_volumes fact
24+
set_fact:
25+
dingo_docker_volumes: '{{ dingo_docker_volumes | default([]) + [item] }}'
26+
loop:
27+
- '{{ dingo_keys_dir }}:{{ dingo_keys_container_dir }}'
28+
when: dingo_block_producer | bool
29+
30+
- name: Create container
31+
docker_container:
32+
name: '{{ dingo_docker_container_name }}'
33+
image: '{{ dingo_docker_image }}'
34+
command:
35+
- --debug
36+
restart_policy: unless-stopped
37+
ports:
38+
- '{{ dingo_port }}:{{ dingo_container_port }}'
39+
- '{{ dingo_metrics_port }}:{{ dingo_metrics_container_port }}'
40+
env:
41+
CARDANO_BLOCK_PRODUCER: '{{ dingo_block_producer | string }}'
42+
CARDANO_CONFIG: '{{ dingo_config_file }}'
43+
CARDANO_DATABASE_PATH: '{{ dingo_db_container_dir }}'
44+
CARDANO_NETWORK: '{{ dingo_network }}'
45+
CARDANO_NODE_SOCKET_PATH: '{{ dingo_ipc_container_dir }}/{{ dingo_socket_name }}'
46+
CARDANO_PORT: '{{ dingo_port | string }}'
47+
CARDANO_SHELLEY_KES_KEY: '{{ dingo_shelley_kes_key }}'
48+
CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE: '{{ dingo_shelley_opcert }}'
49+
CARDANO_SHELLEY_VRF_KEY: '{{ dingo_shelley_vrf_key }}'
50+
CARDANO_SOCKET_PATH: '{{ dingo_ipc_container_dir }}/{{ dingo_socket_name }}'
51+
CARDANO_TOPOLOGY: '{{ dingo_topology_file }}'
52+
RESTORE_SNAPSHOT: '{{ dingo_restore_snapshot | string }}'
53+
SNAPSHOT_DIGEST: '{{ dingo_snapshot_digest }}'
54+
volumes: '{{ dingo_docker_volumes | list }}'

roles/dingo/tasks/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
- name: Check install method
3+
vars:
4+
_allowed_install_methods: ['docker']
5+
ansible.builtin.assert:
6+
that:
7+
- dingo_install_method in _allowed_install_methods
8+
fail_msg: 'The specified install method ({{ dingo_install_method }}) is not one of the allowed values ({{ _allowed_install_methods | join(", ") }})'
9+
10+
- name: Install chrony
11+
package:
12+
name: chrony
13+
state: present
14+
when: chrony_enabled
15+
16+
- name: Create directories for persistent data
17+
ansible.builtin.file:
18+
state: directory
19+
path: '{{ item }}'
20+
owner: '{{ dingo_user | string }}'
21+
group: '{{ dingo_group | string }}'
22+
mode: '0755'
23+
loop:
24+
- '{{ dingo_db_dir }}'
25+
- '{{ dingo_ipc_dir }}'
26+
27+
- name: Create directories for topology
28+
ansible.builtin.file:
29+
state: directory
30+
path: '{{ item }}'
31+
owner: '{{ dingo_user | string }}'
32+
group: '{{ dingo_group | string }}'
33+
mode: '0755'
34+
loop:
35+
- '{{ dingo_topology_dir }}'
36+
when: dingo_manage_topology
37+
38+
- name: Generate custom topology config
39+
template:
40+
dest: '{{ dingo_topology_file }}'
41+
src: custom-topology.json.j2
42+
owner: '{{ dingo_user | string }}'
43+
group: '{{ dingo_group | string }}'
44+
mode: 0644
45+
register: cardano_topology
46+
when: dingo_manage_topology
47+
48+
- name: Include docker-related tasks
49+
ansible.builtin.include_tasks: docker.yml
50+
when: dingo_install_method == 'docker'

roles/go_node/templates/custom-topology.json.j2 renamed to roles/dingo/templates/custom-topology.json.j2

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
{% set peer_count = go_node_topology_bootstrap_peers | length %}
2+
{% set peer_count = dingo_topology_bootstrap_peers | length %}
33
{% if peer_count > 0 %}
44
"bootstrapPeers": [
5-
{% for peer in go_node_topology_bootstrap_peers %}
5+
{% for peer in dingo_topology_bootstrap_peers %}
66
{
77
"address": "{{ peer.address }}",
88
"port": {{ peer.port | int }}
@@ -17,8 +17,8 @@
1717
"localRoots": [
1818
{
1919
"accessPoints": [
20-
{% set peer_count = go_node_topology_localroots | length %}
21-
{% for peer in go_node_topology_localroots %}
20+
{% set peer_count = dingo_topology_localroots | length %}
21+
{% for peer in dingo_topology_localroots %}
2222
{
2323
"address": "{{ peer.address }}",
2424
"port": {{ peer.port | int }}
@@ -37,8 +37,8 @@
3737
"publicRoots": [
3838
{
3939
"accessPoints": [
40-
{% set peer_count = go_node_topology_publicroots | length %}
41-
{% for peer in go_node_topology_publicroots %}
40+
{% set peer_count = dingo_topology_publicroots | length %}
41+
{% for peer in dingo_topology_publicroots %}
4242
{
4343
"address": "{{ peer.address }}",
4444
"port": {{ peer.port | int }}
@@ -52,5 +52,5 @@
5252
"advertise": false
5353
}
5454
],
55-
"useLedgerAfterSlot": {{ go_node_topology_use_ledger_after_slot }}
55+
"useLedgerAfterSlot": {{ dingo_topology_use_ledger_after_slot }}
5656
}

roles/go_node/defaults/main.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

roles/go_node/tasks/docker.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)