-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from blinklabs-io/feat/cardano-node-api
feat: cardano-node-api
- Loading branch information
Showing
5 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
cardano_node_api | ||
========= | ||
|
||
This role deploys a Cardano Node API 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.cardano_node_api | ||
``` | ||
License | ||
------- | ||
Apache 2.0 | ||
Author Information | ||
------------------ | ||
An optional section for the role authors to include contact information, or a | ||
website (HTML is not allowed). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
# Install method | ||
cardano_node_api_install_method: 'docker' | ||
|
||
# Cardano Submit API version | ||
cardano_node_api_version: 'main' | ||
|
||
# Base host directory for node data | ||
cardano_node_dir: /opt/cardano | ||
|
||
# IPC directory for host/container | ||
cardano_node_ipc_dir: '{{ cardano_node_dir }}/ipc' | ||
cardano_node_api_ipc_container_dir: '/node-ipc' | ||
|
||
# User/group for file/directory ownership | ||
cardano_node_user: root | ||
cardano_node_group: root | ||
|
||
# Docker image | ||
cardano_node_api_docker_image: 'ghcr.io/blinklabs-io/cardano-node-api:{{ cardano_node_api_version }}' | ||
|
||
# Docker container name | ||
cardano_node_api_docker_container_name: cardano-node-api | ||
|
||
# Port for host/container | ||
cardano_node_api_container_port: 8080 | ||
cardano_node_api_port: '{{ cardano_node_api_container_port }}' | ||
|
||
# Metrics port for host/container | ||
cardano_node_api_metrics_container_port: 8081 | ||
cardano_node_api_metrics_port: '{{ cardano_node_api_metrics_container_port }}' | ||
|
||
# Cardano network | ||
cardano_node_api_network: mainnet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
galaxy_info: {} | ||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- name: Create container | ||
docker_container: | ||
name: '{{ cardano_node_api_docker_container_name }}' | ||
image: '{{ cardano_node_api_docker_image }}' | ||
restart_policy: unless-stopped | ||
ports: | ||
- '{{ cardano_node_api_port }}:{{ cardano_node_api_container_port }}' | ||
- '{{ cardano_node_api_metrics_port }}:{{ cardano_node_api_metrics_container_port }}' | ||
env: | ||
CARDANO_NETWORK: '{{ cardano_node_api_network }}' | ||
volumes: | ||
- '{{ cardano_node_ipc_dir }}:{{ cardano_node_api_ipc_container_dir }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
- name: Check install method | ||
vars: | ||
_allowed_install_methods: ['docker'] | ||
ansible.builtin.assert: | ||
that: | ||
- cardano_node_api_install_method in _allowed_install_methods | ||
fail_msg: 'The specified install method ({{ cardano_node_api_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 }}' | ||
group: '{{ cardano_node_group }}' | ||
mode: '0755' | ||
loop: | ||
- '{{ cardano_node_ipc_dir }}' | ||
|
||
- name: Include docker-related tasks | ||
ansible.builtin.include_tasks: docker.yml | ||
when: cardano_node_api_install_method == 'docker' |