Skip to content

Commit

Permalink
chore: Updates nixos and Docker image to conform with genesis file ch…
Browse files Browse the repository at this point in the history
…anges.

BREAKING CHANGE: `--genesis-file` is no longer a CLI argument in the nixos
service. The Docker image no longer establishes a pattern of conventional
mount location for provided configuration and IPC socket, instead mount it
where you wish and pass `--config` and `--socket-path` as the CMD.
``--schema-dir` is set internally. This does not impact the mode of
operation when selecting the IOHK-managed configuration via NETWORK env.
  • Loading branch information
rhyslbw committed Jul 16, 2020
1 parent 9808df5 commit 0013dc7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
3 changes: 0 additions & 3 deletions doc/building-running.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ nix-build -A cardano-db-sync -o db-sync-node
scripts/postgresql-setup.sh --createdb
PGPASSFILE=config/pgpass db-sync-node/bin/cardano-db-sync \
--config config/mainnet-config.yaml \
--genesis-file ../cardano-node/configuration/mainnet-genesis.json \
--socket-path ../cardano-node/state-node-mainnet/node.socket \
--schema-dir schema/
```
Expand All @@ -61,13 +60,11 @@ and then the two `db-sync` process run as:
```
PGPASSFILE=config/pgpass ./cardano-db-sync-extended-exe \
--config config/mainnet-config.yaml \
--genesis-file ../cardano-node/mainnet-genesis.json \
--socket-path ../cardano-node/state-node-mainnet/node.socket --schema-dir schema/
```
and
```
PGPASSFILE=config/pgpass-testnet ./cardano-db-sync-extended-exe \
--config config/testnet-config.yaml \
--genesis-file ../cardano-node/configuration/mainnet-ci/testnet-genesis.json \
--socket-path ../cardano-node/state-node-testnet/node.socket --schema-dir schema/
```
39 changes: 16 additions & 23 deletions nix/docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,30 @@
#
# docker load -i $(nix-build -A dockerImage --no-out-link)
#
# cardano-db-sync and cardano-db-sync-extended are interchangeable in the following:
#
# To launch with provided mainnet or testnet configuration
# To launch with pre-loaded configuration, using the NETWORK env.
#
# docker run \
# -v $PATH_TO/node-ipc:/node-ipc \
# -v $PATH_TO/pgpass:/configuration/pgpass \
# -e NETWORK=mainnet|testnet \
#
# To launch the extended service:
# Provide an (almost*) complete command otherwise:
#
# docker run \
# -v $PATH_TO/node-ipc:/node-ipc \
# -v $PATH_TO/pgpass:/configuration/pgpass \
# -e NETWORK=mainnet|testnet \
# -e EXTENDED=true
# docker run \
# -v $PWD/config/mainnet-config:/configuration/configuration.yaml
# -v $PWD/node-ipc:/node-ipc \
# -v $PWD/config/pgpass:/pgpass \
# -e PGPASSFILE=/pgpass
# inputoutput/cardano-db-sync run \
# --config /configuration/configuration.yaml \
# --socket-path /node-ipc/node.socket \
#
# To launch with custom configuration, mount a dir containing configuration.yaml, genesis.json,
# and pgpass into /configuration
#
# docker run \
# -v $PATH_TO/node-ipc:/node-ipc \
# -v $PATH_TO/configuration:/configuration \
# inputoutput/cardano-db-sync:<TAG>
# * --schema-dir is set within the script
#
# To launch the extended service include -e EXTENDED=true
# See the docker-compose.yml for demonstration of using Docker secrets instead of mounting a pgpass
#
#
############################################################################

{ iohkNix
Expand Down Expand Up @@ -140,7 +137,7 @@ let
export PGPASSFILE=/configuration/pgpass
# set up /tmp (override with TMPDIR variable)
mkdir -p -m 1777 tmp
if [[ -f /configuration/configuration.yaml ]]; then
if [[ -z "$NETWORK" ]]; then
echo "Connecting to network specified in configuration.yaml"
if [[ ! -z "''${EXTENDED}" ]] && [[ "''${EXTENDED}" == true ]]
then
Expand All @@ -149,14 +146,10 @@ let
DBSYNC=${cardano-db-sync}/bin/cardano-db-sync
fi
exec $DBSYNC \
--socket-path /node-ipc/node.socket \
--genesis-file /configuration/genesis.json \
--config /configuration/configuration.yaml \
--schema-dir ${../schema}
--schema-dir ${../schema} $@
${clusterStatements}
else
echo "Please set a NETWORK environment variable to one of: mainnet/testnet"
echo "Or mount a /configuration volume containing: configuration.yaml, genesis.json, pgpass"
echo "Managed configuration for network "$NETWORK" does not exist"
fi
'';
in dockerTools.buildImage {
Expand Down
1 change: 0 additions & 1 deletion nix/nixos/cardano-db-sync-service.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ in {
mkdir -p log-dir
exec ${exec} \
--config ${configFile} \
--genesis-file ${envConfig.genesisFile} \
--socket-path "$CARDANO_NODE_SOCKET_PATH" \
--schema-dir ${../../schema}
'';
Expand Down

0 comments on commit 0013dc7

Please sign in to comment.