Skip to content

Commit 4e3976d

Browse files
authored
Merge pull request #139 from mlabs-haskell/avnik/indirection-layer-for-node
documentation for indirection layer
2 parents 32260e5 + cd0fd61 commit 4e3976d

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

docs/getting-started/providers.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Cardano Providers Module
2+
3+
### Introduction
4+
5+
The Cardano Providers module defines a common interface for services that depend on a Cardano node.
6+
Instead of binding directly to a specific systemd unit, services interact with an abstract provider.
7+
This indirection makes it possible to switch seamlessly between different backends
8+
(for example, a local `cardano-node` or a remote tunnel such as Demeter)
9+
without changing service configuration.
10+
11+
The module ensures that shared options and access rules are consistent across all consumers, while hiding implementation details of the underlying node.
12+
13+
### Design Rationale
14+
15+
This design has several advantages:
16+
17+
- **Flexibility** – a consumer does not need to know whether the node is provided locally or remotely.
18+
- **Transparency** – switching between a local `cardano-node` and a remote tunnel (e.g., from Demeter) requires no changes on the consumer side.
19+
- **Reusability** – common configuration options are centralized and can be shared across different providers.
20+
- **Consistency** – consumers operate against a unified contract, regardless of the actual implementation.
21+
22+
### Contract and Visibility
23+
24+
Options under `cardano.provider.*` should be set only in respective provider implementations,
25+
and only referenced in other services.
26+
27+
If a service provider is enabled, it must set `cardano.provider.$servicename.active = true`.
28+
Consumers can check `cardano.provider.$servicename.active` for service presence and use provider values without additional checks.
29+
30+
### Service Integration Guidelines
31+
32+
All new services added under `cardano.nix` must integrate exclusively through the provider interface:
33+
34+
- Services must use `cardano.providers.node.socketPath` to locate the node socket.
35+
36+
- Services must respect `cardano.providers.node.accessGroup` for Unix group-based permissions.
37+
38+
- Direct references to a particular `cardano-node` systemd unit or its implementation details are forbidden.
39+
40+
This rule applies not only to Cardano consumers like `cardano-cli` or monitoring tools, but also to middleware services such as Ogmios, Kupo, and others.
41+
The goal is to guarantee that any consumer can transparently switch between different backends (local node, remote tunnel, etc.) without reconfiguration.

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ nav:
6565
- Deploy: getting-started/deploy.md
6666
- Load Balancer: getting-started/load-balancer.md
6767
- Deploy to Cloud: getting-started/cloud.md
68+
- Providers: getting-started/providers.md
6869
- Development:
6970
- development/develop.md
7071
- development/contributing.md

0 commit comments

Comments
 (0)