Skip to content
Open
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
51 changes: 48 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,53 @@ docker run --detach \
-e CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE=/opt/cardano/config/keys/node.cert \
-e CARDANO_SHELLEY_VRF_KEY=/opt/cardano/config/keys/vrf.skey \
-v /src/cardano/node-keys:/opt/cardano/config/keys \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was the typo. They should all be /srv. You found a bug. 😅

-v /srv/cardano/node-db:/data/db \
-v /srv/cardano/node-ipc:/ipc \
-v /src/cardano/node-db:/data/db \
-v /src/cardano/node-ipc:/ipc \
-p 3001:3001 \
-p 12798:12798 \
ghcr.io/blinklabs-io/cardano-node run
```

##### Dynamic Block Forging

To start a block producer in non-producing mode initially (for dynamic block forging):

```bash
docker run --detach \
--name cardano-node \
--restart unless-stopped \
-e CARDANO_BLOCK_PRODUCER=true \
-e START_AS_NON_PRODUCING=true \
-e CARDANO_SHELLEY_KES_KEY=/opt/cardano/config/keys/kes.skey \
-e CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE=/opt/cardano/config/keys/node.cert \
-e CARDANO_SHELLEY_VRF_KEY=/opt/cardano/config/keys/vrf.skey \
-v /src/cardano/node-keys:/opt/cardano/config/keys \
-v /src/cardano/node-db:/data/db \
-v /src/cardano/node-ipc:/ipc \
-p 3001:3001 \
-p 12798:12798 \
ghcr.io/blinklabs-io/cardano-node run
```

With dynamic block forging enabled, you can control block production without restarting the node:

- **Enable block forging**: Ensure credential files are present and send SIGHUP
```bash
docker exec cardano-node pkill -SIGHUP cardano-node
```

- **Disable block forging**: Move/rename credential files and send SIGHUP
```bash
docker exec cardano-node mv /opt/cardano/config/keys/kes.skey /opt/cardano/config/keys/kes.skey.disabled
docker exec cardano-node pkill -SIGHUP cardano-node
```

- **Re-enable block forging**: Restore credential files and send SIGHUP
```bash
docker exec cardano-node mv /opt/cardano/config/keys/kes.skey.disabled /opt/cardano/config/keys/kes.skey
docker exec cardano-node pkill -SIGHUP cardano-node
```

The above uses Docker's built in supervisor to restart a container which fails
for any reason. This will also cause the container to automatically restart
after a host reboot, so long as Docker is configured to start on boot. We
Expand Down Expand Up @@ -224,7 +264,12 @@ and operational certificate.
`${CARDANO_CONFIG_BASE}/keys/vrf.skey`)
- `CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE`
- Stake pool identity certificate (default:
`${CARDANO_CONFIG_BASE}/keys/node.cert`
`${CARDANO_CONFIG_BASE}/keys/node.cert`)
- `START_AS_NON_PRODUCING`
- Start block producer node in non-producing mode (default: `false`)
- When set to `true`, adds the `--start-as-non-producing-node` flag
- Only applies when `CARDANO_BLOCK_PRODUCER=true`
- Enables dynamic block forging control via SIGHUP signals

#### Controlling Mithril snapshots

Expand Down
6 changes: 6 additions & 0 deletions bin/run-node
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ if [[ -z $GENESIS_VERIFICATION_KEY && -f $GENESIS_VERIFICATION_KEY_PATH ]]; then
fi
SNAPSHOT_DIGEST=${SNAPSHOT_DIGEST:-latest}
RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT:-true}
START_AS_NON_PRODUCING=${START_AS_NON_PRODUCING:-false}

echo CARDANO_BIND_ADDR=${CARDANO_BIND_ADDR}
echo CARDANO_BLOCK_PRODUCER=${CARDANO_BLOCK_PRODUCER}
Expand All @@ -88,6 +89,7 @@ echo CARDANO_PORT=${CARDANO_PORT}
echo CARDANO_RTS_OPTS=${CARDANO_RTS_OPTS}
echo CARDANO_SOCKET_PATH=${CARDANO_SOCKET_PATH}
echo CARDANO_TOPOLOGY=${CARDANO_TOPOLOGY}
echo START_AS_NON_PRODUCING=${START_AS_NON_PRODUCING}

# block producer only
if [[ ${CARDANO_BLOCK_PRODUCER} == true ]]; then
Expand Down Expand Up @@ -164,6 +166,10 @@ if [[ ${CARDANO_BLOCK_PRODUCER} == true ]]; then
--shelley-vrf-key ${CARDANO_SHELLEY_VRF_KEY} \
--socket-path ${CARDANO_SOCKET_PATH} \
--topology ${CARDANO_TOPOLOGY})
# Add --start-as-non-producing-node flag if START_AS_NON_PRODUCING is true
if [[ ${START_AS_NON_PRODUCING} == true ]]; then
effopts+=(--start-as-non-producing-node)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for --start-as-non-producing-node and set START_AS_NON_PRODUCING in the block around line 26 to catch it as an argument being passed into the container.

fi
else
effopts=(--config ${CARDANO_CONFIG} \
--database-path ${CARDANO_DATABASE_PATH} \
Expand Down
Loading