|
6 | 6 | # nix build .#dockerImage/node
|
7 | 7 | # docker load -i result
|
8 | 8 | #
|
9 |
| -# To launch with pre-loaded configuration, using the NETWORK env. |
| 9 | +# |
| 10 | +# Scripts Mode: |
| 11 | +# |
| 12 | +# To launch cardano-node with pre-loaded configuration, "scripts" mode, |
| 13 | +# use the NETWORK env variable to declare an existing cardano network name. |
| 14 | +# |
10 | 15 | # An example using a docker volume to persist state:
|
11 | 16 | #
|
12 |
| -# docker run -v /data -e NETWORK=mainnet ghcr.io/intersectmbo/cardano-node |
| 17 | +# docker run -v data:/data -e NETWORK=mainnet ghcr.io/intersectmbo/cardano-node |
| 18 | +# |
| 19 | +# In "scripts" mode, default state directories include /{data,ipc,logs}, with |
| 20 | +# /data/db being the default database state location. |
| 21 | +# |
| 22 | +# |
| 23 | +# Custom Mode: |
| 24 | +# |
| 25 | +# To launch cardano-node with a custom configuration, "custom" mode, provide |
| 26 | +# entrypoint args starting with `run` and: |
| 27 | +# * Leave the NETWORK env variable unset, |
| 28 | +# * Optionally include additional cardano-node args to the entrypoint afer `run`, |
| 29 | +# * Optionally include environment variables interpreted by `nix/docker/context/bin/run-node` |
| 30 | +# |
| 31 | +# For example, launch a custom cardano-node using cardano-node args and a |
| 32 | +# local configuration mapped into the container: |
13 | 33 | #
|
14 |
| -# Provide a complete command otherwise: |
| 34 | +# docker run \ |
| 35 | +# -v "$PWD/config/cardano:/config" \ |
| 36 | +# ghcr.io/intersectmbo/cardano-node \ |
| 37 | +# run \ |
| 38 | +# --config /config/mainnet/config.json \ |
| 39 | +# --topology /config/mainnet/topology.json \ |
| 40 | +# --database-path /data/db |
15 | 41 | #
|
16 |
| -# docker run -v $PWD/configuration/cardano:/configuration \ |
17 |
| -# ghcr.io/intersectmbo/cardano-node run \ |
18 |
| -# --config /configuration/mainnet-config.yaml \ |
19 |
| -# --topology /configuration/mainnet-topology.json \ |
20 |
| -# --database-path /db |
| 42 | +# Custom mode may also leverage standard mainnet or testnet network config |
| 43 | +# files found at /opt/cardano/config and organized under a subdirectory of the |
| 44 | +# network name. For example, to utilize standard configs for preview network, |
| 45 | +# but modify the cardano-node listening port: |
21 | 46 | #
|
22 |
| -# Mount a volume into /ipc for establishing cross-container communication via node.socket |
| 47 | +# docker run \ |
| 48 | +# -v "$PWD/preprod-data:/data" \ |
| 49 | +# -e CARDANO_CONFIG="/opt/cardano/config/preprod/config.json" \ |
| 50 | +# -e CARDANO_TOPOLOGY="/opt/cardano/config/preprod/topology.json" \ |
| 51 | +# -e CARDANO_PORT="6001" \ |
| 52 | +# ghcr.io/intersectmbo/cardano-node \ |
| 53 | +# run |
| 54 | +# |
| 55 | +# In "custom" mode, default state directories include |
| 56 | +# /opt/cardano/{data,ipc,logs} and with /opt/cardano/data/db being the default |
| 57 | +# database state location. Standard network config files can be found under |
| 58 | +# /opt/cardano/config. |
| 59 | +# |
| 60 | +# |
| 61 | +# Bind Mounting Considerations: |
| 62 | +# |
| 63 | +# For "custom" mode, the /opt/cardano/{data,ipc,logs} default state directories have been |
| 64 | +# symlinked to the "scripts" mode default state directories of /{data,ipc,logs} |
| 65 | +# respectively. This makes bind mounting easier when switching between |
| 66 | +# "scripts" and "custom" container modes as bind mounting any of the root |
| 67 | +# default state directory locations, /{data,ipc,logs}, will work for both modes. |
| 68 | +# |
| 69 | +# |
| 70 | +# Cardano-node socket sharing: |
| 71 | +# |
| 72 | +# To share a cardano-node socket with a different container, a volume can be made |
| 73 | +# for establishing cross-container communication: |
23 | 74 | #
|
24 | 75 | # docker run -v node-ipc:/ipc -e NETWORK=mainnet ghcr.io/intersectmbo/cardano-node
|
25 | 76 | # docker run -v node-ipc:/ipc -e NETWORK=mainnet ghcr.io/intersectmbo/some-node-client
|
| 77 | +# |
26 | 78 | ############################################################################
|
27 | 79 |
|
28 | 80 | { pkgs
|
@@ -106,15 +158,15 @@ let
|
106 | 158 | context = ./context;
|
107 | 159 |
|
108 | 160 | genCfgs = let
|
109 |
| - environments = lib.getAttrs [ "mainnet" "preprod" "preview" "sanchonet" ] commonLib.environments; |
110 |
| - cardano-deployment = commonLib.mkConfigHtml environments; |
| 161 | + environments' = lib.getAttrs [ "mainnet" "preprod" "preview" "sanchonet" ] commonLib.environments; |
| 162 | + cardano-deployment = commonLib.mkConfigHtml environments'; |
111 | 163 | in
|
112 | 164 | pkgs.runCommand "cardano-html" {} ''
|
113 | 165 | mkdir "$out"
|
114 | 166 | cp "${cardano-deployment}/index.html" "$out/"
|
115 | 167 | cp "${cardano-deployment}/rest-config.json" "$out/"
|
116 | 168 |
|
117 |
| - ENVS=(${lib.escapeShellArgs (builtins.attrNames environments)}) |
| 169 | + ENVS=(${lib.escapeShellArgs (builtins.attrNames environments')}) |
118 | 170 | for ENV in "''${ENVS[@]}"; do
|
119 | 171 | # Migrate each env from a flat dir to an ENV subdir
|
120 | 172 | mkdir -p "$out/config/$ENV"
|
|
0 commit comments