Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 105 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
# flake = false;
#};
# --------------------------------------------------------------
oura.url = "github:pacman99/oura/nix-flake";
scrolls.url = "github:pacman99/scrolls/nix-flake";
};
outputs = inputs: let
nomadEnvs = inputs.self.${system}.cloud.nomadEnvs;
Expand Down
48 changes: 48 additions & 0 deletions nix/cardano/entrypoints.nix
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,21 @@
| jq -s 'add' > "$NODE_TOPOLOGY"
}
'';

txpipe-config = ''
NETWORK_MAGIC=$(jq '.networkMagic' "$(
file="$(jq '.ShelleyGenesisFile' "$NODE_CONFIG" )"
folder="$(dirname "$NODE_CONFIG")"
[[ "$file" == /* ]] && echo "$file" || echo "$folder/$file"
)")

SOURCE_CONFIG=$( jq -n \
--arg sp "$SOCKET_PATH" \
--arg nm "$NETWORK_MAGIC" \
'{metrics: {}, source: {type: "N2C", address: ["Unix", $sp], magic: $nm}}' )

'';

in {
cardano-node = writeShellApplication {
name = "entrypoint";
Expand Down Expand Up @@ -565,4 +580,37 @@ in {
exec ${packages.ogmios}/bin/ogmios "''${args[@]}"
'';
};

oura = writeShellApplication {
runtimeInputs = prelude-runtime;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depending on how oura is configured, you probably won't need the prelude.

The prelude and all the other bash script are "hacky" workarounds for the operational "shortcomings" of the binaries in this operational context.

debugInputs = [packages.oura];
name = "entrypoint";
text = ''
${prelude}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same: probably not needed.


${txpipe-config}

OURA_CONFIG="$DATA_DIR/config/$ENVIRONMENT/oura-config.json"
echo "[$json,$TXPIPE_CONFIG]" | jq '.[0].ouraConfig + .[1]' > "$OURA_CONFIG"

exec ${packages.oura}/bin/oura daemon --config "$OURA_CONFIG"
'';
};

scrolls = writeShellApplication {
# runtimeInputs = prelude-runtime;
debugInputs = [packages.scrolls];
name = "entrypoint";
text = ''
${prelude}

${txpipe-config}

SCROLLS_CONFIG="$DATA_DIR/config/$ENVIRONMENT/scrolls-config.json"
echo "[$json,$TXPIPE_CONFIG]" | jq '.[0].scrollsConfig + .[1]' > "$SCROLLS_CONFIG"

exec ${packages.scrolls}/bin/scrolls daemon -c "$SCROLLS_CONFIG"
'';
};

}
17 changes: 17 additions & 0 deletions nix/cardano/hydrationProfiles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@
};
};

# Oura
workload-policies-oura = {
tf.hydrate-cluster.configuration.locals.policies = {
consul.oura = {
# oura also needs to read the cardano config
key_prefix."config/cardano" = {
policy = "read";
intentions = "deny";
};
session_prefix."" = {
policy = "write";
intentions = "deny";
};
};
};
};

# Db Sync
workload-policies-db-sync = {
tf.hydrate-cluster.configuration.locals.policies = {
Expand Down
Loading