Skip to content

Commit

Permalink
Start verified signer node as block producer
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Nov 29, 2022
1 parent b1c9555 commit 9d67c9b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
14 changes: 13 additions & 1 deletion mithril-infra/assets/docker/docker-compose-signer-verified.yaml
Expand Up @@ -24,6 +24,8 @@ services:
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/ipc:/ipc
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/pool:/pool
- ../data/${NETWORK}/mithril-signer-${SIGNER_ID}/cardano/www:/www
ports:
- "${SIGNER_CARDANO_PORT}:${SIGNER_CARDANO_PORT}"
environment:
- CARDANO_SOCKET_PATH=/ipc/node.socket
- CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
Expand All @@ -35,7 +37,17 @@ services:
"--topology",
"/config/cardano-node/topology.json",
"--database-path",
"/db"
"/db",
"--host-addr",
"${SIGNER_CARDANO_ADDR}",
"--port",
"${SIGNER_CARDANO_PORT}",
"--shelley-kes-key",
"/pool/kes.skey",
"--shelley-vrf-key",
"/pool/vrf.skey",
"--shelley-operational-certificate",
"/pool/opcert.cert"
]

mithril-signer:
Expand Down
Expand Up @@ -9,7 +9,7 @@ exec_sql_signer() {
}

fix_stake_distribution_signer() {
LAST_EPOCH=$(exec_sql_aggregator $1 $2 "SELECT MAX(key) FROM stake;")
LAST_EPOCH=$(exec_sql_signer $1 $2 "SELECT MAX(key) FROM stake;")

exec_sql_signer $1 $2 "UPDATE stake SET value = json_insert(json(value), '$.${POOL_ID}', ${POOL_STAKES}) WHERE key = '$LAST_EPOCH';"
exec_sql_signer $1 $2 "SELECT * FROM stake WHERE key = $LAST_EPOCH;"
Expand Down
2 changes: 1 addition & 1 deletion mithril-infra/assets/tools/pool/create-cardano-pool.sh
Expand Up @@ -142,7 +142,7 @@ POOL_PLEDGE=$AMOUNT_STAKED
POOL_COST=$(cat $PROTOCOL_FILE | jq .protocolParams.minPoolCost)
POOL_MARGIN=0.1
POOL_METADATA_URL=$(curl -s https://tinyurl.com/api-create.php?url=https://${SIGNER_NODE}.${DOMAIN}/pool-metadata.json)
POOL_RELAY_URL="https://${SIGNER_NODE}.${DOMAIN}/"
POOL_RELAY_URL="${SIGNER_NODE}.${DOMAIN}"

CARDANO_CLI_CMD stake-pool registration-certificate \
--cold-verification-key-file ${POOL_ARTIFACTS_DIR}/cold.vkey \
Expand Down
2 changes: 1 addition & 1 deletion mithril-infra/main.firewall.tf
Expand Up @@ -4,7 +4,7 @@ resource "google_compute_firewall" "mithril-vm-firewall" {

allow {
protocol = "tcp"
ports = ["22", "80", "443"]
ports = concat(["22", "80", "443"], values(local.mithril_signers_cardano_port))
}

source_ranges = ["0.0.0.0/0"]
Expand Down
8 changes: 6 additions & 2 deletions mithril-infra/mithril.signer.tf
@@ -1,5 +1,7 @@
locals {
mithril_signers_index = [for key, signer in var.mithril_signers : key]
mithril_signers_index = [for key, signer in var.mithril_signers : key]
mithril_signers_www_port = { for key, signer in var.mithril_signers : key => index(local.mithril_signers_index, key) + 1 + 8080 }
mithril_signers_cardano_port = { for key, signer in var.mithril_signers : key => index(local.mithril_signers_index, key) + 1 + 9090 }
}
resource "null_resource" "mithril_signer" {
for_each = var.mithril_signers
Expand Down Expand Up @@ -38,7 +40,9 @@ resource "null_resource" "mithril_signer" {
"export NETWORK=${var.cardano_network}",
"export IMAGE_ID=${var.mithril_image_id}",
"export SIGNER_HOST=${local.mithril_signers_host[each.key]}",
"export SIGNER_WWW_PORT=`expr 8080 + ${index(local.mithril_signers_index, each.key) + 1}`",
"export SIGNER_WWW_PORT=${local.mithril_signers_www_port[each.key]}",
"export SIGNER_CARDANO_ADDR=0.0.0.0",
"export SIGNER_CARDANO_PORT=${local.mithril_signers_cardano_port[each.key]}",
"export CURRENT_UID=$(id -u)",
"export DOCKER_GID=$(getent group docker | cut -d: -f3)",
"docker-compose -p $SIGNER_ID -f /home/curry/docker/docker-compose-signer-${each.value.type}.yaml --profile all up -d",
Expand Down

0 comments on commit 9d67c9b

Please sign in to comment.