Skip to content

Commit f839c09

Browse files
committed
Add relay/block producer Cardano nodes
For verified signers.
1 parent 6ec79b5 commit f839c09

File tree

4 files changed

+78
-22
lines changed

4 files changed

+78
-22
lines changed

mithril-infra/assets/docker/docker-compose-signer-unverified.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
max-file: "5"
2121
volumes:
2222
- ./cardano-configurations/network/${NETWORK}:/config
23-
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db:/db
23+
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db/passive:/db
2424
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/ipc:/ipc
2525
environment:
2626
- CARDANO_SOCKET_PATH=/ipc/node.socket
@@ -57,7 +57,7 @@ services:
5757
- CARDANO_CLI_PATH=/app/bin/cardano-cli
5858
volumes:
5959
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/mithril:/mithril-signer-${SIGNER_ID}/mithril
60-
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db:/mithril-signer-${SIGNER_ID}/cardano/db
60+
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db/passive:/mithril-signer-${SIGNER_ID}/cardano/db
6161
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/ipc:/ipc
6262
depends_on:
6363
cardano-node-signer:

mithril-infra/assets/docker/docker-compose-signer-verified.yaml

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
version: "3.9"
44

55
services:
6-
cardano-node-signer:
6+
cardano-node-signer-relay:
77
image: cardano-node/1.35.4-modified
8-
container_name: cardano-node-signer-${SIGNER_ID}
8+
container_name: cardano-node-relay-signer-${SIGNER_ID}
99
build:
1010
context: .
1111
dockerfile: Dockerfile.cardano
@@ -20,12 +20,12 @@ services:
2020
max-file: "5"
2121
volumes:
2222
- ./cardano-configurations/network/${NETWORK}:/config
23-
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db:/db
23+
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db/relay:/db
2424
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/ipc:/ipc
2525
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/pool:/pool
2626
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/www:/www
2727
ports:
28-
- "${SIGNER_CARDANO_PORT}:${SIGNER_CARDANO_PORT}"
28+
- "${SIGNER_CARDANO_RELAY_PORT}:${SIGNER_CARDANO_RELAY_PORT}"
2929
environment:
3030
- CARDANO_SOCKET_PATH=/ipc/node.socket
3131
- CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
@@ -35,13 +35,50 @@ services:
3535
"--config",
3636
"/config/cardano-node/config.json",
3737
"--topology",
38-
"/config/cardano-node/topology.json",
38+
"/pool/topology-relay.json",
3939
"--database-path",
4040
"/db",
41-
"--host-addr",
42-
"${SIGNER_CARDANO_ADDR}",
4341
"--port",
44-
"${SIGNER_CARDANO_PORT}",
42+
"${SIGNER_CARDANO_RELAY_PORT}"
43+
]
44+
45+
cardano-node-signer-block-producer:
46+
image: cardano-node/1.35.4-modified
47+
container_name: cardano-node-block-producer-signer-${SIGNER_ID}
48+
build:
49+
context: .
50+
dockerfile: Dockerfile.cardano
51+
user: ${CURRENT_UID}
52+
profiles:
53+
- cardano
54+
- all
55+
logging:
56+
driver: "json-file"
57+
options:
58+
max-size: "100m"
59+
max-file: "5"
60+
volumes:
61+
- ./cardano-configurations/network/${NETWORK}:/config
62+
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db/block-producer:/db
63+
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/ipc:/ipc
64+
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/pool:/pool
65+
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/www:/www
66+
ports:
67+
- "${SIGNER_CARDANO_BLOCK_PRODUCER_PORT}:${SIGNER_CARDANO_BLOCK_PRODUCER_PORT}"
68+
environment:
69+
- CARDANO_SOCKET_PATH=/ipc/node.socket
70+
- CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
71+
command:
72+
[
73+
"run",
74+
"--config",
75+
"/config/cardano-node/config.json",
76+
"--topology",
77+
"/pool/topology-block-producer.json",
78+
"--database-path",
79+
"/db",
80+
"--port",
81+
"${SIGNER_CARDANO_BLOCK_PRODUCER_PORT}",
4582
"--shelley-kes-key",
4683
"/pool/kes.skey",
4784
"--shelley-vrf-key",
@@ -72,12 +109,14 @@ services:
72109
- CARDANO_CLI_PATH=/app/bin/cardano-cli
73110
volumes:
74111
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/mithril:/mithril-signer-${SIGNER_ID}/mithril
75-
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db:/mithril-signer-${SIGNER_ID}/cardano/db
112+
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/db/block-producer:/mithril-signer-${SIGNER_ID}/cardano/db
76113
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/pool:/mithril-signer-${SIGNER_ID}/cardano/pool
77114
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/ipc:/ipc
78115
- ./cardano-configurations/network/${NETWORK}:/config
79116
depends_on:
80-
cardano-node-signer:
117+
cardano-node-signer-block-producer:
118+
condition: service_started
119+
cardano-node-signer-relay:
81120
condition: service_started
82121
logging:
83122
driver: "json-file"
@@ -96,9 +135,6 @@ services:
96135
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/www:/usr/share/nginx/html
97136
ports:
98137
- "${SIGNER_WWW_PORT}:8080"
99-
depends_on:
100-
cardano-node-signer:
101-
condition: service_started
102138
logging:
103139
driver: "json-file"
104140
options:

mithril-infra/main.firewall.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resource "google_compute_firewall" "mithril-vm-firewall" {
44

55
allow {
66
protocol = "tcp"
7-
ports = concat(["22", "80", "443"], values(local.mithril_signers_cardano_port))
7+
ports = concat(["22", "80", "443"], values(local.mithril_signers_relay_cardano_port))
88
}
99

1010
source_ranges = ["0.0.0.0/0"]

mithril-infra/mithril.signer.tf

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
locals {
2-
mithril_signers_index = [for key, signer in var.mithril_signers : key]
3-
mithril_signers_www_port = { for key, signer in var.mithril_signers : key => index(local.mithril_signers_index, key) + 1 + 8080 }
4-
mithril_signers_cardano_port = { for key, signer in var.mithril_signers : key => index(local.mithril_signers_index, key) + 1 + 9090 }
2+
mithril_signers_index = [for key, signer in var.mithril_signers : key]
3+
mithril_signers_www_port = { for key, signer in var.mithril_signers : key => index(local.mithril_signers_index, key) + 1 + 8080 }
4+
mithril_signers_relay_cardano_port = { for key, signer in var.mithril_signers : key => index(local.mithril_signers_index, key) + 1 + 9090 }
5+
mithril_signers_block_producer_cardano_port = { for key, signer in var.mithril_signers : key => index(local.mithril_signers_index, key) + 1 + 10000 }
56
}
67
resource "null_resource" "mithril_signer" {
78
for_each = var.mithril_signers
@@ -25,12 +26,29 @@ resource "null_resource" "mithril_signer" {
2526
inline = [
2627
"mkdir -p /home/curry/data/${var.cardano_network}",
2728
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/db",
29+
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/db/passive",
30+
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/db/block-producer",
31+
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/db/relay",
2832
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/ipc",
2933
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/pool",
3034
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/www",
3135
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/mithril/stores",
3236
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/mithril/snapshots",
33-
"echo -n ${local.mithril_signers_cardano_port[each.key]} > /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/pool/port"
37+
"echo -n ${local.mithril_signers_relay_cardano_port[each.key]} > /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/pool/port",
38+
<<-EOT
39+
cat > /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/pool/topology-block-producer.json << EOF
40+
{
41+
"Producers": [
42+
{
43+
"addr": "${google_compute_address.mithril-external-address.address}",
44+
"port": ${local.mithril_signers_relay_cardano_port[each.key]},
45+
"valency": 1
46+
}
47+
]
48+
}
49+
EOF
50+
cat /home/curry/docker/cardano-configurations/network/preview/cardano-node/topology.json | jq '.Producers[1] |= . + { "addr": "${google_compute_address.mithril-external-address.address}", "port": ${local.mithril_signers_block_producer_cardano_port[each.key]}, "valency": 1}' > /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/pool/topology-relay.json
51+
EOT
3452
]
3553
}
3654

@@ -42,8 +60,10 @@ resource "null_resource" "mithril_signer" {
4260
"export IMAGE_ID=${var.mithril_image_id}",
4361
"export SIGNER_HOST=${local.mithril_signers_host[each.key]}",
4462
"export SIGNER_WWW_PORT=${local.mithril_signers_www_port[each.key]}",
45-
"export SIGNER_CARDANO_ADDR=0.0.0.0",
46-
"export SIGNER_CARDANO_PORT=${local.mithril_signers_cardano_port[each.key]}",
63+
"export SIGNER_CARDANO_RELAY_ADDR=0.0.0.0",
64+
"export SIGNER_CARDANO_RELAY_PORT=${local.mithril_signers_relay_cardano_port[each.key]}",
65+
"export SIGNER_CARDANO_BLOCK_PRODUCER_ADDR=0.0.0.0",
66+
"export SIGNER_CARDANO_BLOCK_PRODUCER_PORT=${local.mithril_signers_block_producer_cardano_port[each.key]}",
4767
"export CURRENT_UID=$(id -u)",
4868
"export DOCKER_GID=$(getent group docker | cut -d: -f3)",
4969
"docker-compose -p $SIGNER_ID -f /home/curry/docker/docker-compose-signer-${each.value.type}.yaml --profile all up -d",

0 commit comments

Comments
 (0)