Skip to content

Commit 0c3cca7

Browse files
committed
tracerOci: add tracer image readme docs
1 parent a1d4fe9 commit 0c3cca7

File tree

1 file changed

+140
-12
lines changed

1 file changed

+140
-12
lines changed

nix/docker/README.md

Lines changed: 140 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Building Node and Submit API Images
1+
# Building Node, Submit API and Tracer Images
22
To build and load the oci images into the Docker engine, the most
33
basic commands are:
44
```
@@ -36,7 +36,8 @@ docker run \
3636
ghcr.io/intersectmbo/cardano-node:dev
3737
```
3838

39-
A similar command can be run to look around the cardano-submit-api container.
39+
Similar commands can be run to look around the cardano-submit-api and
40+
cardano-tracer containers.
4041

4142

4243
# Cardano Node Image Operation
@@ -61,8 +62,9 @@ To launch cardano-node with a custom configuration, "custom" mode, provide
6162
entrypoint args starting with `run` and:
6263
* Leave the `NETWORK` env variable unset
6364
* Optionally include additional cardano-node args to the entrypoint after `run`
64-
* Optionally include environment variables interpreted by [nix/docker/context/node/bin/run-node](context/node/bin/run-node),
65-
or `/usr/local/bin/run-node` in the container
65+
* Optionally include environment variables interpreted by
66+
[nix/docker/context/node/bin/run-node](context/node/bin/run-node), or
67+
`/usr/local/bin/run-node` in the container
6668

6769
For example, launch a custom cardano-node container using cardano-node args and
6870
a local configuration mapped into the container:
@@ -81,19 +83,19 @@ files found at `/opt/cardano/config` and organized under a subdirectory of the
8183
network's name. For example, to utilize standard configs for preprod network,
8284
but modify the cardano-node listening port:
8385
```
84-
docker run \
85-
-v preprod-data:/data \
86-
-e CARDANO_CONFIG="/opt/cardano/config/preprod/config.json" \
87-
-e CARDANO_TOPOLOGY="/opt/cardano/config/preprod/topology.json" \
88-
-e CARDANO_PORT="6001" \
89-
ghcr.io/intersectmbo/cardano-node:dev \
90-
run
86+
docker run \
87+
-v preprod-data:/data \
88+
-e CARDANO_CONFIG="/opt/cardano/config/preprod/config.json" \
89+
-e CARDANO_TOPOLOGY="/opt/cardano/config/preprod/topology.json" \
90+
-e CARDANO_PORT="6001" \
91+
ghcr.io/intersectmbo/cardano-node:dev \
92+
run
9193
```
9294

9395
In "custom" mode, default state directories include
9496
`/opt/cardano/{data,ipc,logs}`, with `/opt/cardano/data/db` being the default
9597
database state location. These state directories are symlinked to root in the container:
96-
`/opt/cardano/{data,ipc,logs} -> /{data,ipc,logs}` for more consistency between modes.
98+
`/opt/cardano/{data,ipc,logs} -> /{data,ipc,logs}` for consistency between modes.
9799
Standard network config files can be found under `/opt/cardano/config`.
98100

99101

@@ -250,6 +252,132 @@ both to align the default ipc socket state directory in both the cardano-node
250252
and cardano-submit-api images and to remain backwards compatible.
251253

252254

255+
# Cardano Tracer Image Operation
256+
## Scripts Mode
257+
To launch cardano-tracer with pre-loaded configuration, "scripts" mode,
258+
use the `NETWORK` env variable to declare an existing cardano network name.
259+
260+
An example using a docker named volume to persist socket state to the host:
261+
```
262+
docker run \
263+
-v node-ipc:/ipc \
264+
-e NETWORK=mainnet \
265+
ghcr.io/intersectmbo/cardano-tracer:dev
266+
```
267+
268+
In "scripts" mode, default state directories include `/{ipc,logs}` and default
269+
mode of operation is to accept socket connections from node, `AcceptAt`, at a
270+
path of `/ipc/tracer.socket`. Both tracer socket connection modes of
271+
`AcceptAt` and `ConnectTo` necessitate a shared volume mount between a node
272+
container and a tracer container. See the [Cardano-node to Cardano-tracer
273+
Socket Connection](#cardano-node-to-cardano-tracer-socket-connection) section
274+
for more on making the required socket connections.
275+
276+
277+
## Custom Mode
278+
To launch cardano-tracer with a custom configuration, "custom" mode, provide
279+
entrypoint args starting with `run` and:
280+
* Leave the `NETWORK` env variable unset
281+
* Optionally include additional cardano-tracer args to the entrypoint after `run`
282+
* Optionally include environment variables interpreted by
283+
[nix/docker/context/tracer/bin/run-tracer](context/tracer/bin/run-tracer), or
284+
`/usr/local/bin/run-tracer` in the container
285+
286+
For example, launch a custom cardano-tracer container using cardano-tracer args and
287+
a local configuration mapped into the container:
288+
```
289+
docker run \
290+
-v node-ipc:/ipc \
291+
-v "$PWD/config/tracer:/config" \
292+
ghcr.io/intersectmbo/cardano-tracer:dev \
293+
run \
294+
--config /config/mainnet/config.json
295+
```
296+
297+
Custom mode may also leverage standard mainnet or testnet network tracer config
298+
files found at `/opt/cardano/config` and organized under a subdirectory of the
299+
network's name. For example, to utilize standard configs for preprod network,
300+
but modify the cardano-tracer minimum log severity:
301+
```
302+
docker run \
303+
-e CARDANO_CONFIG="/opt/cardano/config/preprod/tracer-config.json" \
304+
-e CARDANO_MIN_LOG_SEVERITY="Debug" \
305+
ghcr.io/intersectmbo/cardano-tracer:dev \
306+
run
307+
```
308+
309+
In "custom" mode, default state directories include `/opt/cardano/{ipc,logs}`.
310+
These state directories are symlinked to root in the container:
311+
`/opt/cardano/{ipc,logs} -> /{ipc,logs}` for consistency between modes.
312+
Standard network tracer config files can be found under `/opt/cardano/config`.
313+
314+
315+
## Merge Mode
316+
With the `NETWORK` env variable set and `CARDANO_CONFIG_JSON_MERGE` env
317+
variable set and containing valid json, cardano-tracer will run with deep
318+
merged base `NETWORK` tracer config and json merge config.
319+
320+
Optional env variables and cardano-tracer args which can be used in custom mode
321+
can also be used in this mode. Merge mode uses the same default state
322+
directories as custom mode.
323+
324+
An example which changes the prometheus binding address from a default of
325+
localhost (`127.0.0.1`) to `0.0.0.0`:
326+
```
327+
docker run \
328+
-v node-ipc:/ipc \
329+
-e NETWORK=mainnet \
330+
-e CARDANO_CONFIG_JSON_MERGE='{"hasPrometheus":{"epHost": "0.0.0.0"}}' \
331+
ghcr.io/intersectmbo/cardano-tracer:dev
332+
```
333+
334+
Similar bind mounting, and host mounted network tracer config considerations
335+
exist for the cardano-tracer image as also detailed above for the cardano-node
336+
image.
337+
338+
339+
## Cardano-node to Cardano-tracer Socket Connection
340+
To establish a cardano-node container to cardano-tracer container socket
341+
connection, in addition to a shared volume mount where such a socket can be
342+
accessed by both containers, the cardano-node container will need to be started
343+
with an extra argument. To include the extra argument, either custom mode or
344+
merge mode for the node image will be required.
345+
346+
An example for node to connect to a tracer socket, using custom mode to
347+
append the extra cli arg:
348+
```
349+
docker run \
350+
-v node-ipc:/ipc \
351+
-e CARDANO_CONFIG="/opt/cardano/config/mainnet/config.json" \
352+
-e CARDANO_TOPOLOGY="/opt/cardano/config/mainnet/topology.json" \
353+
ghcr.io/intersectmbo/cardano-node:dev \
354+
run \
355+
--tracer-socket-path-connect /ipc/tracer.socket
356+
357+
docker run \
358+
-v node-ipc:/ipc \
359+
-e NETWORK=mainnet \
360+
ghcr.io/intersectmbo/cardano-tracer:dev
361+
```
362+
363+
An example for node to use a socket to accept a tracer connection, using merge
364+
mode to append the extra cli arg:
365+
```
366+
docker run \
367+
-v node-ipc:/ipc \
368+
-e NETWORK=mainnet \
369+
-e CARDANO_CONFIG_JSON_MERGE='{}' \
370+
ghcr.io/intersectmbo/cardano-node:dev \
371+
run \
372+
--tracer-socket-path-accept /ipc/node-tracer.socket
373+
374+
docker run \
375+
-v node-ipc:/ipc \
376+
-e NETWORK=mainnet \
377+
-e CARDANO_CONFIG_JSON_MERGE='{"network":{"contents":["/ipc/node-tracer.socket"],"tag":"ConnectTo"}}' \
378+
ghcr.io/intersectmbo/cardano-tracer:dev
379+
```
380+
253381
# Manual Testing
254382
1. Run -e NETWORK=mainnet and check graceful shutdown SIGINT with -it
255383
2. Run -e NETWORK=mainnet and check graceful shutdown SIGTERM with --detach

0 commit comments

Comments
 (0)