Skip to content

Commit

Permalink
oci: switch node to cfg cp to avoid broken symlinks from host
Browse files Browse the repository at this point in the history
  • Loading branch information
johnalotoski committed Feb 22, 2025
1 parent aac6a9d commit 9acaffe
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
30 changes: 30 additions & 0 deletions nix/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,36 @@ cardano-node service, rsync'd known good state from a remote, [Mithril
snapshot](https://mithril.network/doc/) or other out-of-band methods.


## Host Mount Image Network Configs
To host mount and explore the image configuration files found under
`/opt/cardano` a new named docker volume can be created. Docker will
initialize the new named volume with the contents of the container.

An example would be:
```
docker run \
-v opt-cardano:/opt/cardano \
ghcr.io/intersectmbo/cardano-node:dev
```

The above command will create a new named volume of `opt-cardano` with the
container contents of `/opt/cardano` and print some image mode information
before exiting. If there is already a named volume of `opt-cardano`, simply
select a different name, or allow a random name assignment by dropping the
`$NAME:` suffix of the `-v` option.

Exploring the configuration contents from the host after creating the named
volume can be done with commands such as:
```
docker volume ls
# Use the "Mountpoint" value in this command below
docker volume inspect opt-cardano
sudo tree /var/lib/docker/volumes/opt-cardano/_data
```


# Cardano Submit API Image Operation
## Scripts Mode
To launch cardano-submit-api with pre-loaded configuration, "scripts" mode,
Expand Down
13 changes: 7 additions & 6 deletions nix/docker/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ in
SRC="${genCfgs}"
DST="opt/cardano"
# Make the directory structure with the iohk-nix configs mutable.
# This allows the option to create merged entrypoint configs in the network directory.
find "$SRC" -mindepth 1 -type d -exec bash -c "DIR=\"{}\"; mkdir -v -p \"$DST/\''${DIR#${genCfgs}/}\"" \;
# Keep all base iohk-nix config files immutable via symlinks to nix store.
find "$SRC" -mindepth 1 -type f -exec bash -c "FILE=\"{}\"; TGT=\"$DST/\''${FILE#${genCfgs}/}\"; ln -sv \"\$FILE\" \"\$TGT\"" \;
# Make the directory structure with the iohk-nix configs mutable. This
# enables creation of merge mode entrypoint configs in the respective
# NETWORK directory. Keep config files as read-only copies from the nix
# store instead of direct symlinks. This avoids volume mount failures
# caused by broken symlinks as seen from the host.
cp -R "$SRC"/* "$DST"
find "$DST" -mindepth 1 -type d -exec bash -c "chmod 0755 {}" \;
# Preserve legacy oci config and topo path for backwards compatibility.
pushd opt/cardano/config
Expand Down

0 comments on commit 9acaffe

Please sign in to comment.