Skip to content

feat(quick-start): run the network layer as a single adapter in docker compose (#55, #66) - #88

Open
kelvinprabhu wants to merge 10 commits into
developmentfrom
feat/55-run-a-single-adapter-at-the-network-layer-in-docker-compose
Open

kelvinprabhu wants to merge 10 commits into
developmentfrom
feat/55-run-a-single-adapter-at-the-network-layer-in-docker-compose

Conversation

@kelvinprabhu

@kelvinprabhu kelvinprabhu commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #55, #66 · Refs OpenAgriNet/network-adapter#55 · Parent: OpenAgriNet/engineering-tracker#171

Objective

Run the network layer as a single adapter in docker compose by default, with multi still one command away.

Solution

  • One network-adapter service on 127.0.0.1:9201.
  • NETWORK_ADAPTER_DEPLOYMENT_MODE in .env (default single) picks its config at startup: all three tiers, or the network tier alone.
  • make up (single) and make up-multi (adds provider-adapter and consumer-adapter).
  • The single template is an exact copy of the tier modules.

Split from #75: Helm in #87, docs in #89.

…r compose (#55, #66)

One compose service, network-adapter, on 127.0.0.1:9201. The deployment
mode, read at startup by bin/stack.sh from NETWORK_ADAPTER_DEPLOYMENT_MODE
in .env (MODE overrides), picks the config it mounts:

- single (default, make up): network-adapter.yaml, the consumer, network
  and provider tiers as four modules of one process; tier hops stay in
  the container.
- multi (make up-multi): network.yaml, the network tier alone, with
  provider-adapter and consumer-adapter (profile multi) beside it. Only
  the network tier's config is mounted, so it never holds the other
  tiers' keys.

- setup.py renders network-adapter.yaml from network-adapter.yaml.tmpl;
  routing-network-adapter-{consumer,provider}.yaml route tier hops to
  localhost:9201/_internal/<tier>.
- stack.sh: safe .env parsing, running-mode detection from the mounted
  config, removal of a pre-merge network-adapter-layer container.
- server_proxy.conf denies /publish and /_internal at the edge.
- README, .env.example, Makefile and bootstrap-ubuntu.sh updated; Postman
  environment for the local adapter ports.
… two lines (#55, #66)

README and the Postman environment move to docs/55-network-adapter-deployment-modes.
Comments added for the single/multi modes are cut to two lines; the reasoning
is in ADR-0001's implementation notes. No behaviour change.
Comment thread quick-start/docker-compose.yml Outdated
…ules; multi-adapter anchor (#55, #66)

- network-adapter.yaml.tmpl: drop the extra httpClientConfig and use log
  level debug, so each module matches its tier template apart from name,
  path and routingConfig.
- docker-compose.yml: x-multi-adapter anchor carries profiles: ["multi"]
  for provider-adapter and consumer-adapter.

@kelvinprabhu kelvinprabhu left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Self review done | @manjudr

Comment thread quick-start/docker-compose.yml
kelvinprabhu added a commit that referenced this pull request Oct 22, 2026
- charts/adapter-service/SETUP.md: guidelines, then single and multi steps
  (Secrets, install, check), the openbao-secrets changes multi needs,
  switching, and a symptom table. Steps verified on k3d.
- charts/adapter-service/README.md rewritten short: roles, modes, the three
  values the render really requires, the identity Secret, key rotation;
  install steps live in SETUP.md.
- quick-start/README.md: "Two modes" rewritten as guidelines; single-mode log
  checks; publish example on 9201 (multi: 9200).
- CHANGELOG and ADR-0001 follow #87 and #88: networkTierKeys with default
  Secret names, lint-values back to role network, the single template is an
  exact copy of the tier modules.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

under /adaptor create two sub folder single-adaptor and multi-adaptor and keep the files config accorgingly . keep routing same as now outside

@@ -0,0 +1,307 @@
# Single mode: consumer at /, /publish, /_internal/network/, /_internal/provider/ in one
# process. Signing is off: keep :9201 on 127.0.0.1. setup.py renders it (ADR-0001).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Add a comment use this for only single mode similarly in others

Comment thread quick-start/Makefile
# ---------------------------------------------------------------- the stack

up: ; @$(STACK) up
up-core: ; @$(STACK) up-core

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

change it to --up --single-adaptor and --up --multi-adaptor || across all and make it consistent

- addRoute

# provider: answers from the upstream APIs itself (no router).
- name: provider

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

consistent module name as we have in the other config module names

…apter, module names (#55, #66)

Addresses review 5627422258:
- Templates move to config/adapters/single-adapter/ and multi-adapter/;
  routing files stay in config/adapters/. setup.py, docker-compose.yml,
  stack.sh and .gitignore follow the new paths.
- Each template says which mode it is for.
- bin/stack.sh up|up-core take --single-adapter / --multi-adapter. make keeps
  only up and up-core (mode from MODE, then .env, then single); up-multi and
  up-core-multi are removed.
- Single template modules: consumer-adapter, network-adapter, oanProvider,
  oanProviderPublish, matching the multi templates.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
kelvinprabhu added a commit that referenced this pull request Oct 23, 2026
…#55, #66)

Follows the #87 and #88 review fixes:
- Roles consumer-adapter / network-adapter / provider-adapter (old names still
  work), deploymentMode single-adapter | multi-adapter, adapterKeys.
- Chart configs under config/single-adapter/ and config/multi-adapter/;
  quick-start templates under config/adapters/single-adapter/ and multi-adapter/.
- Module names consumer-adapter, network-adapter, oanProvider, oanProviderPublish.
- quick-start: make up / make up-core, MODE=multi for multi.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
…55, #66)

The previous commit (210e321) pushed only the template moves. This adds the
setup.py, stack.sh, Makefile, docker-compose.yml, .gitignore and template
changes it describes.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
@kelvinprabhu

Copy link
Copy Markdown
Collaborator Author

Review 5627422258 addressed in 210e321 + 01c56c7 (docs in #89, 2a82193).

  • Folders: templates live in config/adapters/single-adapter/ and config/adapters/multi-adapter/; routing files stay in config/adapters/. setup.py, docker-compose.yml, stack.sh and .gitignore follow.
  • Comments: each template says which mode it is for.
  • Mode flags: bin/stack.sh up|up-core --single-adapter|--multi-adapter. make keeps only up and up-core (mode from MODE, then .env, then single); up-multi and up-core-multi are removed.
  • Modules (single template): consumer-adapter, network-adapter, oanProvider, oanProviderPublish, matching the multi templates.

Checks: docker demo single → multi → single, publish/discover/select 200; the network container holds only its own key in multi.

Refs #55 #66 · OpenAgriNet/network-adapter#55 · OpenAgriNet/engineering-tracker#171

Comment thread quick-start/.gitignore Outdated
config/adapters/exp.yaml
config/adapters/network.yaml
config/adapters/provider.yaml
config/adapters/network-adapter.yaml

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

why we need since it is moved to multi adaptor

@@ -0,0 +1,307 @@
# Single mode only: consumer at /, /publish, /_internal/network/, /_internal/provider/

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

add like this #Use only in single network mode deployment

Comment thread quick-start/bin/stack.sh Outdated
registry+discovery -> setup.py -> network-adapter (Network Adapter Layer)
-> gateway (public, 80/443) -> hyperdx (wants 16 GB)
up-core steps 1-3 only. Nothing public, no ClickHouse.
up --single-adapter as up, one network-adapter running all three tiers

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

remove as we not using

Comment thread quick-start/bin/stack.sh Outdated
up-core steps 1-3 only. Nothing public, no ClickHouse.
up --single-adapter as up, one network-adapter running all three tiers
up --multi-adapter as up, with the three adapters (provider, network, consumer)
up-core --single-adapter as up-core, in single mode

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

remove from here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

can we keep respective routing as well inside

… flags (#55, #66)

Addresses review 5627709821:
- Routing files move into config/adapters/multi-adapter/ and single-adapter/;
  the single network module reuses multi-adapter/routing-network.yaml.
- .gitignore names the four rendered configs instead of whole folders.
- Templates start with "Use only in single-adapter/multi-adapter deployment mode".
- bin/stack.sh drops --single-adapter/--multi-adapter (mode comes from MODE or
  .env) and stops on an unexpected argument instead of ignoring it.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
kelvinprabhu added a commit that referenced this pull request Oct 23, 2026
#66)

- SETUP.md, README and the 0.6.0 CHANGELOG use examples/consumer-adapter.yaml,
  network-adapter.yaml and provider-adapter.yaml (#87).
- quick-start README: routing files live in config/adapters/multi-adapter/ and
  single-adapter/ (#88).

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
@kelvinprabhu

Copy link
Copy Markdown
Collaborator Author

@manjudr a question on how quick-start picks the mode. Your view would help.

What changed: make up-multi and make up-core-multi are removed. make now has only up and up-core, and the mode comes from one place:

# .env (default single)
NETWORK_ADAPTER_DEPLOYMENT_MODE=single    # or multi

# or once, on the command line
MODE=multi make up

Why:

  • up and up-core already decide how much of the stack starts (with or without NPM and HyperDX). A separate -multi target for each doubled the targets without adding anything the mode setting can't do.
  • With the mode in .env, a VM sets it once and always runs make up, so there's no chance of starting the wrong mode by typing a different target.
  • make restart, make down, make ps and make logs already follow the running mode, so nothing else needs a mode flag.

Why we can't use make up --single-adapter / --multi-adapter: make reads any --… word as one of its own options, not as an argument to a target. make up --multi-adapter fails with an unknown-option error before our Makefile runs. The only ways to pass a mode through make are a variable (MODE=multi make up or make up MODE=multi) or a separate target per mode, which is what we just removed. bin/stack.sh could take flags, but then make and the script would disagree on how the mode is chosen, so it now takes none and stops on any extra argument.

Question: is MODE=multi make up (or .env) fine for you, or would you rather have the explicit make up-multi / make up-core-multi targets back?

Refs #55 #66

Comment thread quick-start/bin/stack.sh Outdated
PROFILES=(--profile reverse-proxy --profile observability)
# Every optional profile, named so `down` also stops profiled services
# (the gateway, hyperdx, provider- and consumer-adapter).
PROFILES=(--profile reverse-proxy --profile observability --profile multi)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

no multi change to multi-adaptor

Comment thread quick-start/docker-compose.yml Outdated
# change here or a restart.
provider-adapter:
<<: *adapter
profiles: ["multi"]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

no multi the name should be single adaptor and multi adaptor

…adapter (#55, #66)

Addresses review 5628280636:
- The compose profile multi becomes multi-adapter (provider-adapter,
  consumer-adapter, and every --profile in bin/stack.sh).
- MODE and NETWORK_ADAPTER_DEPLOYMENT_MODE take single-adapter (default) or
  multi-adapter, matching the chart's deploymentMode. Old single/multi values
  are still accepted.
- Hints in docker-compose.yml and setup.py say MODE=multi-adapter make up.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
kelvinprabhu added a commit that referenced this pull request Oct 23, 2026
…er (#55, #66)

Follows #88: MODE=multi-adapter make up, NETWORK_ADAPTER_DEPLOYMENT_MODE=
single-adapter and profile multi-adapter in the quick-start README, SETUP.md
and ADR-0001.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
Comment thread quick-start/docker-compose.yml Outdated
# 3. python3 bin/setup.py keys, the three adapter entries, and
# the adapter configs they mount
# 4. docker compose up -d now the adapters
# 4. docker compose up -d network-adapter now the adapter (multi: MODE=multi-adapter make up)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

is this use the env deployement mode

…r template names (#55, #66)

Addresses review 5628386136:
- multi-adapter templates become consumer-adapter, network-adapter and
  provider-adapter.yaml.tmpl, so both mode folders hold network-adapter.yaml.
- docker-compose.yml mounts config/adapters/${NETWORK_ADAPTER_DEPLOYMENT_MODE}/
  network-adapter.yaml, and .env.example sets
  COMPOSE_PROFILES=${NETWORK_ADAPTER_DEPLOYMENT_MODE}: plain `docker compose up -d`
  now follows the .env mode, like make up. NETWORK_ADAPTER_CONFIG is gone.
- setup.py, stack.sh and .gitignore follow the new names.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171
Comment thread quick-start/.env.example

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

what is different better mode and networadaptordeployment mode'

…de setting (#55, #66)

MODE and NETWORK_ADAPTER_DEPLOYMENT_MODE set the same thing. stack.sh now
reads NETWORK_ADAPTER_DEPLOYMENT_MODE from the shell, then .env, then
defaults to single-adapter. COMPOSE_PROFILES gets the same default, so an
.env without the mode no longer warns.

Refs: #55, #66, OpenAgriNet/network-adapter#55, OpenAgriNet/engineering-tracker#171

@kelvinprabhu kelvinprabhu left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done @manjudr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

End-to-end verification and demonstration of the single adapter Run a single adapter through the helm charts

1 participant