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
50 changes: 50 additions & 0 deletions roles/dolos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
dolos
=========

This role deploys an Dolos instance.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should
be mentioned here. For instance, if the role uses the EC2 module, it may be a
good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including
any variables that are in defaults/main.yml, vars/main.yml, and any variables
that can/should be set via parameters to the role. Any variables that are read
from other roles and/or the global scope (ie. hostvars, group vars, etc.)
should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in
regards to parameters that may need to be set for other roles, or variables
that are used from other roles.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables
passed in as parameters) is always nice for users too:

```yaml
- hosts: servers
tasks:
- include_role:
name: blinklabs.cardano.dolos
```

License
-------

Apache 2.0

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
44 changes: 44 additions & 0 deletions roles/dolos/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# Install method
dolos_install_method: 'docker'

# Dolos version
dolos_version: '0.15.1'

# Cardano network
dolos_network: mainnet

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

# DB directory for host/container
dolos_db_dir: '{{ cardano_node_dir }}/dolos'
dolos_db_container_dir: '/data'

# Config directory for host/container (cardano-node)
cardano_node_config_dir: '{{ cardano_node_dir }}/config'
dolos_cardano_node_config_container_dir: '/config'
# Config directory for host/container (dolos)
dolos_etc_container_dir: '/etc/dolos'

# IPC directory for host/container
cardano_node_ipc_dir: '{{ cardano_node_dir }}/ipc'
dolos_ipc_container_dir: '/ipc'

# User/group for file/directory ownership
cardano_node_user: root
cardano_node_group: root

# Docker image
dolos_docker_image: 'ghcr.io/txpipe/dolos:v{{ dolos_version }}'

# Docker container name
dolos_docker_container_name: dolos

# Port for host/container (relay)
dolos_relay_container_port: 30013
dolos_relay_port: '{{ dolos_relay_container_port }}'

# Port for host/container (grpc)
dolos_grpc_container_port: 50051
dolos_grpc_port: '{{ dolos_grpc_container_port }}'
3 changes: 3 additions & 0 deletions roles/dolos/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
galaxy_info: {}

dependencies: []
27 changes: 27 additions & 0 deletions roles/dolos/tasks/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
- name: Initialize dolos_docker_volumes fact
set_fact:
dolos_docker_volumes: '{{ dolos_docker_volumes | default([]) + [item] }}'
loop:
- '{{ cardano_node_ipc_dir }}:{{ dolos_ipc_container_dir }}'
- '{{ dolos_db_dir }}:{{ dolos_db_container_dir }}'

- name: Add config to dolos_docker_volumes fact
set_fact:
dolos_docker_volumes: '{{ dolos_docker_volumes | default([]) + [item] }}'
loop:
- '{{ cardano_node_config_dir }}/{{ dolos_network}}:{{ dolos_cardano_node_config_container_dir }}'
- '{{ cardano_node_config_dir }}/dolos:{{ dolos_etc_container_dir }}'

- name: Create container
docker_container:
name: '{{ dolos_docker_container_name }}'
image: '{{ dolos_docker_image }}'
restart_policy: unless-stopped
command:
- dolos
- daemon
ports:
- '{{ dolos_grpc_port }}:{{ dolos_grpc_container_port }}'
- '{{ dolos_relay_port }}:{{ dolos_relay_container_port }}'
volumes: '{{ dolos_docker_volumes | list }}'
33 changes: 33 additions & 0 deletions roles/dolos/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
- name: Check install method
vars:
_allowed_install_methods: ['docker']
ansible.builtin.assert:
that:
- dolos_install_method in _allowed_install_methods
fail_msg: 'The specified install method ({{ dolos_install_method }}) is not one of the allowed values ({{ _allowed_install_methods | join(", ") }})'

# We use the node owner and group
- name: Create directories
ansible.builtin.file:
state: directory
path: '{{ item }}'
owner: '{{ cardano_node_user | string }}'
group: '{{ cardano_node_group | string }}'
mode: '0755'
loop:
- '{{ cardano_node_ipc_dir }}'
- '{{ dolos_db_dir }}'
- '{{ cardano_node_config_dir }}/dolos'

- name: Generate Dolos config
template:
dest: '{{ dolos_etc_container_dir }}/daemon.toml'
src: daemon.toml.j2
owner: '{{ cardano_node_user | string }}'
group: '{{ cardano_node_group | string }}'
mode: 0644

- name: Include docker-related tasks
ansible.builtin.include_tasks: docker.yml
when: dolos_install_method == 'docker'
69 changes: 69 additions & 0 deletions roles/dolos/templates/daemon.toml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# https://dolos.txpipe.io/configuration
[upstream]
{% if dolos_network == "preprod" %}
{% set network_magic = 1 %}
network_magic = {{ network_magic }}
peer_address = "preprod-node.world.dev.cardano.org:3001"
is_testnet = true
{% elif dolos_network == "preview" %}
{% set network_magic = 2 %}
network_magic = {{ network_magic }}
peer_address = "preview-node.play.dev.cardano.org:3001"
is_testnet = true
{% elif dolos_network == "sanchonet" %}
{% set network_magic = 4 %}
network_magic = {{ network_magic }}
peer_address = "sanchonet-node.play.dev.cardano.org:3001"
is_testnet = true
{% else %}
{% set network_magic = 764824073 %}
network_magic = {{ network_magic }}
peer_address = "backbone.mainnet.cardanofoundation.org:3001"
is_testnet = false
{% endif %}

[storage]
path = "/data/db"
wal_size = 1000

[relay]
listen_address = "[::]:30013"
magic = {{ network_magic }}

[sync]
pull_batch_size = 100

[submit]
prune_height = 200

[genesis]
byron_path = "/config/byron-genesis.json"
shelley_path = "/config/shelley-genesis.json"
alonzo_path = "/config/alonzo-genesis.json"

[mithril]
{% if dolos_network == "preprod" %}
aggregator = "https://aggregator.release-preprod.api.mithril.network/aggregator"
genesis_key = "5b3132372c37332c3132342c3136312c362c3133372c3133312c3231332c3230372c3131372c3139382c38352c3137362c3139392c3136322c3234312c36382c3132332c3131392c3134352c31332c3233322c3234332c34392c3232392c322c3234392c3230352c3230352c33392c3233352c34345d"
{% elif dolos_network = "preview" %}
aggregator = "https://aggregator.prerelease-preview.api.mithril.network/aggregator"
genesis_key = "5b3132372c37332c3132342c3136312c362c3133372c3133312c3231332c3230372c3131372c3139382c38352c3137362c3139392c3136322c3234312c36382c3132332c3131392c3134352c31332c3233322c3234332c34392c3232392c322c3234392c3230352c3230352c33392c3233352c34345d"
{% elif dolos_network = "sanchonet" %}
aggregator = "https://aggregator.prerelease-sanchonet.api.mithril.network/aggregator"
genesis_key = "5b3132372c37332c3132342c3136312c362c3133372c3133312c3231332c3230372c3131372c3139382c38352c3137362c3139392c3136322c3234312c36382c3132332c3131392c3134352c31332c3233322c3234332c34392c3232392c322c3234392c3230352c3230352c33392c3233352c34345d"
{% else %}
aggregator = "https://aggregator.release-mainnet.api.mithril.network/aggregator"
genesis_key = "5b3139312c36362c3134302c3138352c3133382c31312c3233372c3230372c3235302c3134342c32372c322c3138382c33302c31322c38312c3135352c3230342c31302c3137392c37352c32332c3133382c3139362c3231372c352c31342c32302c35372c37392c33392c3137365d"
{% endif %}

[serve.grpc]
listen_address = "[::]:50051"

[serve.ouroboros]
listen_path = "/ipc/dolos.socket"
magic = {{ network_magic }}

[logging]
max_level = "info"
include_pallas = false
include_grpc = false
Loading