@@ -18,10 +18,85 @@ invoked. There is a `NETWORK` environment variable which can be used as a
18
18
short cut to starting nodes on a specific named Cardano network with a default
19
19
configuration.
20
20
21
- ### Using run (Recommended for SPO)
21
+ We recommend using this method for running the container if you are not
22
+ familiar with running a node.
23
+
24
+ For nodes on the ` preprod ` and ` mainnet ` networks, the container will start
25
+ fetching the latest Mithril snapshot if an empty data directory is detected.
26
+ This snapshot will be used to bootstrap the node into an operating state much
27
+ more rapidly than doing a sync from the beginning of the chain. This behavior
28
+ can be disabled in the advanced path below.
29
+
30
+ ### Using NETWORK (Recommended)
31
+
32
+ Using the ` NETWORK ` environment variable causes the entrypoint script to use
33
+ the simplified path. The only configurable option in this path is the
34
+ ` NETWORK ` environment variable itself.
35
+
36
+ This is in keeping with the IOHK image behavior.
37
+
38
+ To run a Cardano full node on preprod:
39
+
40
+ ``` bash
41
+ docker run --detach \
42
+ --name cardano-node \
43
+ -v node-data:/data/db \
44
+ -v node-ipc:/ipc \
45
+ -e NETWORK=preprod \
46
+ -p 3001:3001 \
47
+ ghcr.io/blinklabs-io/cardano-node
48
+ ```
49
+
50
+ Node logs can be followed:
51
+
52
+ ``` bash
53
+ docker logs -f cardano-node
54
+ ```
55
+
56
+ The node can be monitoring using [ nview] ( https://github.com/blinklabs-io/nview )
57
+ from within the container. We run ` nview ` from within the same container as
58
+ our running node to get access to information about the node process.
59
+
60
+ ``` bash
61
+ docker exec -ti cardano-node nview
62
+ ```
63
+
64
+ #### Running the Cardano CLI
65
+
66
+ To run a Cardano CLI command, we use the ` node-ipc ` volume from our node.
67
+
68
+ ``` bash
69
+ docker run --rm -ti \
70
+ -e NETWORK=preprod \
71
+ -v node-ipc:/ipc \
72
+ ghcr.io/blinklabs-io/cardano-node cli < command>
73
+ ```
74
+
75
+ This can be added to a shell alias:
76
+
77
+ ``` bash
78
+ alias cardano-cli=" docker run --rm -ti \
79
+ -e NETWORK=preprod \
80
+ -v node-ipc:/ipc \
81
+ ghcr.io/blinklabs-io/cardano-node cli"
82
+ ```
83
+
84
+ Now, you can use cardano-cli commands as you would, normally.
85
+
86
+ ``` bash
87
+ cardano-cli query tip --network-magic 1
88
+ ```
89
+
90
+ Or, for a node running with NETWORK=mainnet:
91
+
92
+ ``` bash
93
+ cardano-cli query tip --mainnet
94
+ ```
95
+
96
+ ### Using run (Recommended for SPO/Advanced)
22
97
23
98
Using the ` run ` argument to the image causes the entrypoint script to use the
24
- fully configurable code path.
99
+ fully configurable code path. Do not set the ` NETWORK ` environment variable.
25
100
26
101
To run a Cardano full node on mainnet with minimal configuration and defaults:
27
102
@@ -34,17 +109,53 @@ docker run --detach \
34
109
ghcr.io/blinklabs-io/cardano-node run
35
110
```
36
111
112
+ ** NOTE** The container paths for persist disks are different in this mode
113
+
37
114
The above maps port 3001 on the host to 3001 on the container, suitable
38
115
for use as a mainnet relay node. We use docker volumes for our persistent data
39
116
storage and IPC (interprocess communication) so they live beyond the lifetime
40
- of the container.
117
+ of the container. To mount local host paths instead of using Docker's built in
118
+ volumes, use the local path on the left side of a ` -v ` argument.
119
+
120
+ An example of a more advanced configuration for mainnet:
121
+
122
+ ``` bash
123
+ docker run --detach \
124
+ --name cardano-node \
125
+ --restart unless-stopped \
126
+ -e CARDANO_CONFIG=/opt/cardano/config/mainnet/p2p-config.json \
127
+ -e CARDANO_TOPOLOGY=/opt/cardano/config/mainnet/p2p-topology.json \
128
+ -v /srv/cardano/node-db:/opt/cardano/data \
129
+ -v /srv/cardano/node-ipc:/opt/cardano/ipc \
130
+ -p 3001:3001 \
131
+ -p 12798:12798 \
132
+ ghcr.io/blinklabs-io/cardano-node run
133
+ ```
134
+
135
+ The above uses Docker's built in supervisor to restart a container which fails
136
+ for any reason. This will also cause the container to automatically restart
137
+ after a host reboot, so long as Docker is configured to start on boot. The
138
+ current default configuration for mainnet does not enable P2P, so we override
139
+ the configuration with the shipped ` p2p-config.json ` and its accompanying
140
+ ` p2p-topology.json ` to enable it. Our node's persistent data and client
141
+ communication socket are mapped to ` /src/cardano/node-db ` and
142
+ ` /src/cardano/node-ipc ` on the host, respectively. This allows for running
143
+ applications directly on the host which may need access to these. Last, we add
144
+ mapping the host's port 12798 to the container 12798, which is the port for
145
+ exposing the node's metrics in Prometheus format, for monitoring.
146
+
147
+ This mode of operation allows configuring multiple facets of the node using
148
+ environment variables, described below.
41
149
42
150
Node logs can be followed:
43
151
44
152
``` bash
45
- docker logs -f cardano-node
153
+ docker logs -f -n 500 cardano-node
46
154
```
47
155
156
+ Adding the ` -n 500 ` to the logs command limits the logs to the last 500 lines
157
+ before following.
158
+
48
159
#### Configuration using environment variables
49
160
50
161
The power in using ` run ` is being able to configure the node's behavior to
@@ -99,29 +210,23 @@ and operational certificate.
99
210
- Stake pool identity certificate (default:
100
211
` ${CARDANO_CONFIG_BASE}/keys/node.cert `
101
212
102
- ### Using NETWORK (standalone)
213
+ #### Controlling Mithril snapshots
103
214
104
- Using the ` NETWORK ` environment variable causes the entrypoint script to use
105
- the simplified path. The only configurable option in this path is the
106
- ` NETWORK ` environment variable itself.
215
+ If the container does not find a protocolMagicId file within the
216
+ ` CARDANO_DATABASE_PATH ` location, it will initiate Mithril snapshot downloads
217
+ for preprod and mainnet networks. This can be disabled by setting
218
+ ` RESTORE_SNAPSHOT ` to ` false ` .
107
219
108
- ** NOTE** The container paths for persist disks is different in this mode
220
+ - ` AGGREGATOR_ENDPOINT `
221
+ - Mithril Aggregator URL (default:
222
+ ` https://aggregator.release-${CARDANO_NETWORK}.api.mithril.network/aggregator ` )
223
+ - ` GENESIS_VERIFICATION_KEY `
224
+ - Network specific Genesis Verification Key (default:
225
+ ` reads file at: ${CARDANO_CONFIG_BASE}/${CARDANO_NETWORK}/genesis.vkey ` )
226
+ - ` SNAPSHOT_DIGEST `
227
+ - Digest identifier to fetch (default: ` latest ` )
109
228
110
- This is in keeping with the IOHK image behavior.
111
-
112
- To run a Cardano full node on preview:
113
-
114
- ``` bash
115
- docker run --detach \
116
- --name cardano-node \
117
- -v node-data:/data/db \
118
- -v node-ipc:/ipc \
119
- -e NETWORK=preview \
120
- -p 3001:3001 \
121
- ghcr.io/blinklabs-io/cardano-node
122
- ```
123
-
124
- ## Running the CLI
229
+ #### Running the Cardano CLI
125
230
126
231
To run a Cardano CLI command, we use the ` node-ipc ` volume from our node.
127
232
@@ -144,9 +249,3 @@ Now, you can use cardano-cli commands as you would, normally.
144
249
``` bash
145
250
cardano-cli query tip --mainnet
146
251
```
147
-
148
- Or, for preview:
149
-
150
- ``` bash
151
- cardano-cli query tip --network-magic 2
152
- ```
0 commit comments