Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions roles/go_node/README.md → roles/dingo/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go_node
dingo
=========

This role deploys a Blink Labs Go Cardano node instance.
Expand Down Expand Up @@ -36,7 +36,7 @@ passed in as parameters) is always nice for users too:
- hosts: servers
tasks:
- include_role:
name: blinklabs.cardano.go_node
name: blinklabs.cardano.dingo
```

License
Expand Down
85 changes: 85 additions & 0 deletions roles/dingo/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
# Install method
dingo_install_method: 'docker'

# Cardano node version
dingo_version: '0.1.6'

# Cardano network
dingo_network: mainnet

# Base host directory for node data
dingo_dir: /opt/cardano

# Config directory for host/container
dingo_config_dir: '{{ dingo_dir }}/config'
dingo_config_container_dir: '{{ dingo_config_dir }}'

# DB directory for host/container
dingo_db_dir: '{{ dingo_dir }}/data'
dingo_db_container_dir: '{{ dingo_db_dir }}'

# IPC directory for host/container
dingo_ipc_dir: '{{ dingo_dir }}/ipc'
dingo_ipc_container_dir: '{{ dingo_ipc_dir }}'

# Topology directory for host/container
dingo_topology_dir: '{{ dingo_config_dir }}'
dingo_topology_container_dir: '{{ dingo_topology_dir }}'

# Block producer keys directory for host/container
dingo_keys_dir: '{{ dingo_config_dir }}/keys'
dingo_keys_container_dir: '{{ dingo_keys_dir }}'

# User/group for file/directory ownership
dingo_user: root
dingo_group: root

# Docker image
dingo_docker_image: 'ghcr.io/blinklabs-io/dingo:{{ dingo_version }}'

# Docker container name
dingo_docker_container_name: node

# Port for host/container
dingo_container_port: 3001
dingo_port: '{{ dingo_container_port }}'

# Metrics port for host/container
dingo_metrics_container_port: 12798
dingo_metrics_port: '{{ dingo_metrics_container_port }}'

# Socket file name
dingo_socket_name: node.socket

# Config
dingo_manage_config: false # this currently controls mounting only
dingo_config_file: '{{ dingo_config_container_dir }}/{{ dingo_network }}/config.json'

# Topology
dingo_manage_topology: false
dingo_topology_file: '{{ dingo_topology_container_dir }}/{{ dingo_network }}/topology.json'
dingo_topology_use_ledger_after_slot: 128908821
dingo_topology_localroots: []
dingo_topology_publicroots: []
# Adjust for non-mainnet deployments
dingo_topology_bootstrap_peers:
- address: 'backbone.cardano.iog.io'
port: 3001
- address: 'backbone.mainnet.emurgornd.com'
port: 3001
- address: 'backbone.mainnet.cardanofoundation.org'
port: 3001

# Install chrony
chrony_enabled: true

# Mithril configuration
dingo_restore_snapshot: true
dingo_snapshot_digest: 'latest'

# Block Producer (also controls mounts for keys)
dingo_block_producer: false
dingo_shelley_kes_key: '{{ dingo_keys_container_dir }}/kes.skey'
dingo_shelley_opcert: '{{ dingo_keys_container_dir }}/node.cert'
dingo_shelley_vrf_key: '{{ dingo_keys_container_dir }}/vrf.skey'
File renamed without changes.
54 changes: 54 additions & 0 deletions roles/dingo/tasks/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
- name: Initialize dingo_docker_volumes fact
set_fact:
dingo_docker_volumes: '{{ dingo_docker_volumes | default([]) + [item] }}'
loop:
- '{{ dingo_ipc_dir }}:{{ dingo_ipc_container_dir }}'
- '{{ dingo_db_dir }}:{{ dingo_db_container_dir }}'

- name: Add config to dingo_docker_volumes fact
set_fact:
dingo_docker_volumes: '{{ dingo_docker_volumes | default([]) + [item] }}'
loop:
- '{{ dingo_config_file }}:{{ dingo_config_file }}'
when: dingo_manage_config

- name: Add topology to dingo_docker_volumes fact
set_fact:
dingo_docker_volumes: '{{ dingo_docker_volumes | default([]) + [item] }}'
loop:
- '{{ dingo_topology_file }}:{{ dingo_topology_file }}'
when: dingo_manage_topology

- name: Add keys to dingo_docker_volumes fact
set_fact:
dingo_docker_volumes: '{{ dingo_docker_volumes | default([]) + [item] }}'
loop:
- '{{ dingo_keys_dir }}:{{ dingo_keys_container_dir }}'
when: dingo_block_producer | bool

- name: Create container
docker_container:
name: '{{ dingo_docker_container_name }}'
image: '{{ dingo_docker_image }}'
command:
- --debug
restart_policy: unless-stopped
ports:
- '{{ dingo_port }}:{{ dingo_container_port }}'
- '{{ dingo_metrics_port }}:{{ dingo_metrics_container_port }}'
env:
CARDANO_BLOCK_PRODUCER: '{{ dingo_block_producer | string }}'
CARDANO_CONFIG: '{{ dingo_config_file }}'
CARDANO_DATABASE_PATH: '{{ dingo_db_container_dir }}'
CARDANO_NETWORK: '{{ dingo_network }}'
CARDANO_NODE_SOCKET_PATH: '{{ dingo_ipc_container_dir }}/{{ dingo_socket_name }}'
CARDANO_PORT: '{{ dingo_port | string }}'
CARDANO_SHELLEY_KES_KEY: '{{ dingo_shelley_kes_key }}'
CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE: '{{ dingo_shelley_opcert }}'
CARDANO_SHELLEY_VRF_KEY: '{{ dingo_shelley_vrf_key }}'
CARDANO_SOCKET_PATH: '{{ dingo_ipc_container_dir }}/{{ dingo_socket_name }}'
CARDANO_TOPOLOGY: '{{ dingo_topology_file }}'
RESTORE_SNAPSHOT: '{{ dingo_restore_snapshot | string }}'
SNAPSHOT_DIGEST: '{{ dingo_snapshot_digest }}'
volumes: '{{ dingo_docker_volumes | list }}'
50 changes: 50 additions & 0 deletions roles/dingo/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
- name: Check install method
vars:
_allowed_install_methods: ['docker']
ansible.builtin.assert:
that:
- dingo_install_method in _allowed_install_methods
fail_msg: 'The specified install method ({{ dingo_install_method }}) is not one of the allowed values ({{ _allowed_install_methods | join(", ") }})'

- name: Install chrony
package:
name: chrony
state: present
when: chrony_enabled

- name: Create directories for persistent data
ansible.builtin.file:
state: directory
path: '{{ item }}'
owner: '{{ dingo_user | string }}'
group: '{{ dingo_group | string }}'
mode: '0755'
loop:
- '{{ dingo_db_dir }}'
- '{{ dingo_ipc_dir }}'

- name: Create directories for topology
ansible.builtin.file:
state: directory
path: '{{ item }}'
owner: '{{ dingo_user | string }}'
group: '{{ dingo_group | string }}'
mode: '0755'
loop:
- '{{ dingo_topology_dir }}'
when: dingo_manage_topology

- name: Generate custom topology config
template:
dest: '{{ dingo_topology_file }}'
src: custom-topology.json.j2
owner: '{{ dingo_user | string }}'
group: '{{ dingo_group | string }}'
mode: 0644
register: cardano_topology
when: dingo_manage_topology

- name: Include docker-related tasks
ansible.builtin.include_tasks: docker.yml
when: dingo_install_method == 'docker'
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
{% set peer_count = go_node_topology_bootstrap_peers | length %}
{% set peer_count = dingo_topology_bootstrap_peers | length %}
{% if peer_count > 0 %}
"bootstrapPeers": [
{% for peer in go_node_topology_bootstrap_peers %}
{% for peer in dingo_topology_bootstrap_peers %}
{
"address": "{{ peer.address }}",
"port": {{ peer.port | int }}
Expand All @@ -17,8 +17,8 @@
"localRoots": [
{
"accessPoints": [
{% set peer_count = go_node_topology_localroots | length %}
{% for peer in go_node_topology_localroots %}
{% set peer_count = dingo_topology_localroots | length %}
{% for peer in dingo_topology_localroots %}
{
"address": "{{ peer.address }}",
"port": {{ peer.port | int }}
Expand All @@ -37,8 +37,8 @@
"publicRoots": [
{
"accessPoints": [
{% set peer_count = go_node_topology_publicroots | length %}
{% for peer in go_node_topology_publicroots %}
{% set peer_count = dingo_topology_publicroots | length %}
{% for peer in dingo_topology_publicroots %}
{
"address": "{{ peer.address }}",
"port": {{ peer.port | int }}
Expand All @@ -52,5 +52,5 @@
"advertise": false
}
],
"useLedgerAfterSlot": {{ go_node_topology_use_ledger_after_slot }}
"useLedgerAfterSlot": {{ dingo_topology_use_ledger_after_slot }}
}
85 changes: 0 additions & 85 deletions roles/go_node/defaults/main.yml

This file was deleted.

54 changes: 0 additions & 54 deletions roles/go_node/tasks/docker.yml

This file was deleted.

Loading
Loading