Skip to content

fix(cli): mount the configuration directory the CLI set up into the relay - #1380

Merged
cameri merged 1 commit into
cameri:mainfrom
Priyanshubhartistm:fix/compose-mount-nostr-config-dir
Dec 4, 2026
Merged

cameri merged 1 commit into
cameri:mainfrom
Priyanshubhartistm:fix/compose-mount-nostr-config-dir

Conversation

@Priyanshubhartistm

@Priyanshubhartistm Priyanshubhartistm commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

nostream start prepared settings in NOSTR_CONFIG_DIR, but docker-compose.yml always mounted ${PWD}/.nostr into the relay, so a relay started with another configuration directory ran on the default settings from the project, without the admission restrictions saved in the directory the CLI had set up. The CLI now tells compose which directory it used, and the compose file mounts that one.

Related Issue

#1022, finding F-019.

Motivation and Context

CodeRabbit's scan did not establish reachability, so I checked it with docker compose config: with NOSTR_CONFIG_DIR=/srv/relay-conf on the host, the relay still got ${PWD}/.nostr as its configuration mount, while the CLI had written settings.yaml in /srv/relay-conf.

  • runDockerCompose() adds NOSTR_CONFIG_HOST_DIR, the absolute path of the directory the CLI uses (NOSTR_CONFIG_DIR, or .nostr in the project), and the mount in docker-compose.yml is ${NOSTR_CONFIG_HOST_DIR:-${PWD}/.nostr}:/home/node/.nostr. A plain docker compose up still mounts .nostr in the project;
  • it is a separate variable because in the compose file NOSTR_CONFIG_DIR is the path inside the container, and docs/SETUP.md has a .env that sets it to /home/node/.nostr. Compose reads .env for interpolation, so mounting ${NOSTR_CONFIG_DIR} would have mounted that container path from the host for anyone following it.

The deploy/ compose files are separate production files that the CLI does not start, and the database, Tor and I2P mounts keep using .nostr in the project, so I left them as they are.

How Has This Been Tested?

  • Four tests in test/unit/cli/docker.spec.ts: the variable is the directory NOSTR_CONFIG_DIR names, it is made absolute, it is .nostr in the project when NOSTR_CONFIG_DIR is not set, and it reaches docker compose next to the variables the command adds, such as DEBUG. One more reads docker-compose.yml and checks the mount, and fails when it is put back to ${PWD}/.nostr.
  • With docker compose config: NOSTR_CONFIG_HOST_DIR=/srv/relay-conf mounts /srv/relay-conf, no variable mounts .nostr in the project, and a .env with NOSTR_CONFIG_DIR=/home/node/.nostr as in docs/SETUP.md still mounts .nostr in the project.
  • pnpm run test:unit (3773 passing), pnpm run test:cli (193 passing), pnpm lint, pnpm run build:check and pnpm run check:deps.

Screenshots (if appropriate):

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

Summary by CodeRabbit

  • Bug Fixes
    • nostream start now mounts and uses the configuration folder selected by NOSTR_CONFIG_DIR. When no custom folder is set, plain docker compose up continues to use the project’s .nostr folder.
  • Documentation
    • Clarified which configuration folder is used when starting the relay with the CLI.

…elay

Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
@changeset-bot

changeset-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: daf3285

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Docker Compose now mounts the host directory derived from NOSTR_CONFIG_DIR at /home/node/.nostr, with ${PWD}/.nostr as the fallback. The CLI passes the resolved directory to Compose. Tests and documentation cover the behavior.

Changes: Docker configuration directory mount

Layer / File(s) Summary
Resolve and mount the CLI configuration directory
src/cli/utils/docker.ts, docker-compose.yml, test/unit/cli/docker.spec.ts, README.md, .changeset/compose-mount-nostr-config-dir.md
composeConfigEnv resolves the configuration directory and runDockerCompose passes it to Compose. The nostream service uses that directory for its host mount, falling back to ${PWD}/.nostr. Tests and documentation describe the configuration behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Merge Risk: Minimal · up to daf32

The relay now mounts the configuration directory that the CLI set up, which fixes the mismatch. Plain docker compose up still mounts the project's .nostr directory. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the CLI now mounts the configuration directory it sets up into the relay container. The raw summary and objectives confirm this. The docker-compose.yml volume uses NOS…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the CLI now mounts the configuration directory it sets up into the relay container. The raw summary and objectives confirm this. The docker-compose.yml volume uses NOSTR_CONFIG_HOST_DIR, composeConfigEnv passes that value, and the changeset describes the same mismatch. The title is specific and uses the 'fix(cli)' convention. It is 73 characters, which is slightly long but acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the config path,
Then hops it to the Compose file.
The relay finds its settings there,
While .nostr waits as fallback fare.
The burrow hums; the carrots smile!

Recent review info

Automatic approval policy

Commit: daf3285584c3.

Setting Effective value Source
Automatic approvals Enabled Global configuration
Merge risk Minimal Global configuration
Security risk Not set Global configuration

Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 45f305c2-739a-47e9-b35b-8e8b37d0ff5c
Commits

Reviewing files that changed from the base of the PR and between 0da5ca8 and daf3285.

Files selected for processing: 5

  • .changeset/compose-mount-nostr-config-dir.md
  • README.md
  • docker-compose.yml
  • src/cli/utils/docker.ts
  • test/unit/cli/docker.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@greptile-apps

greptile-apps Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge.

Summary

The CLI now mounts the configuration directory it prepared into the relay.

  • The relay mounts the folder where the CLI prepared its settings.

No actionable issues found. This review checked source code; it did not run tests or Docker Compose.

Reviews (1) · Last reviewed commit: "fix(cli): mount the configuration direct..." · Reviewed by Greptile

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 47358617394

Coverage increased (+0.005%) to 81.086%

Details

  • Coverage increased (+0.005%) from the base build.
  • Patch coverage: 4 of 4 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15714
Covered Lines: 13255
Line Coverage: 84.35%
Relevant Branches: 8696
Covered Branches: 6538
Branch Coverage: 75.18%
Branches in Coverage %: Yes
Coverage Strength: 705.41 hits per line

💛 - Coveralls

@cameri
cameri merged commit 8df5ab9 into cameri:main Dec 4, 2026
19 of 20 checks passed
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.

3 participants