You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(cli): mount the configuration directory the CLI set up into the relay - #1380
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.
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.
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.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
nostream startprepared settings inNOSTR_CONFIG_DIR, butdocker-compose.ymlalways mounted${PWD}/.nostrinto 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: withNOSTR_CONFIG_DIR=/srv/relay-confon the host, the relay still got${PWD}/.nostras its configuration mount, while the CLI had writtensettings.yamlin/srv/relay-conf.runDockerCompose()addsNOSTR_CONFIG_HOST_DIR, the absolute path of the directory the CLI uses (NOSTR_CONFIG_DIR, or.nostrin the project), and the mount indocker-compose.ymlis${NOSTR_CONFIG_HOST_DIR:-${PWD}/.nostr}:/home/node/.nostr. A plaindocker compose upstill mounts.nostrin the project;NOSTR_CONFIG_DIRis the path inside the container, anddocs/SETUP.mdhas a.envthat sets it to/home/node/.nostr. Compose reads.envfor 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.nostrin the project, so I left them as they are.How Has This Been Tested?
test/unit/cli/docker.spec.ts: the variable is the directoryNOSTR_CONFIG_DIRnames, it is made absolute, it is.nostrin the project whenNOSTR_CONFIG_DIRis not set, and it reachesdocker composenext to the variables the command adds, such asDEBUG. One more readsdocker-compose.ymland checks the mount, and fails when it is put back to${PWD}/.nostr.docker compose config:NOSTR_CONFIG_HOST_DIR=/srv/relay-confmounts/srv/relay-conf, no variable mounts.nostrin the project, and a.envwithNOSTR_CONFIG_DIR=/home/node/.nostras indocs/SETUP.mdstill mounts.nostrin the project.pnpm run test:unit(3773 passing),pnpm run test:cli(193 passing),pnpm lint,pnpm run build:checkandpnpm run check:deps.Screenshots (if appropriate):
Types of changes
Checklist:
Summary by CodeRabbit
nostream startnow mounts and uses the configuration folder selected byNOSTR_CONFIG_DIR. When no custom folder is set, plaindocker compose upcontinues to use the project’s.nostrfolder.