cameri / nostream

A Nostr Relay written in TypeScript
MIT License
745 stars 193 forks source link

[BUG] Railway app deployment issue (settings.yaml file missing) #175

Open antonleviathan opened 1 year ago

antonleviathan commented 1 year ago
Error: ENOENT: no such file or directory, open '/app/resources/default-settings.yaml'
at Object.openSync (node:fs:600:3)
at Object.readFileSync (node:fs:468:35)
at SettingsStatic.loadAndParseYamlFile (/app/src/utils/settings.js:27:57)
at SettingsStatic.loadSettings (/app/src/utils/settings.js:53:39)
at App.createSettings [as settings] (/app/src/utils/settings.js:72:41)
at App.run (/app/src/app/app.js:34:31)
at Object.<anonymous> (/app/src/index.js:33:30)
at Module._compile (node:internal/modules/cjs/loader:1226:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
at Module.load (node:internal/modules/cjs/loader:1089:32) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/app/resources/default-settings.yaml'
}
Node.js v18.14.0
MTG2000 commented 1 year ago

Hey @Cameri Any updates or suggestions for how this issue could be fixed??

I was using an older version of the relay deployed on railway, but today when I updated to the latest version, I faced this error & my project is crashing & not working right now...

I tried adding this line to my Dockerfile.railwayapp file as #190 suggested:

...
WORKDIR /app

COPY --from=build /build/dist .
+ ADD resources /app/resources
+ COPY .railwayapp/settings.yaml /app/.nostr/settings.yaml

RUN npm install --omit=dev --quiet

USER 1000:1000

RUN mkdir -p $NOSTR_CONFIG_DIR

And I created a file at ./railwayapp/settings.yaml with the same content of the default-settings.yaml file.

But it's now a different error:

node:internal/fs/watchers:255
throw error;
^
Error: ENOENT: no such file or directory, watch '/home/node/.nostr/settings.yaml'
at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
at Object.watch (node:fs:2343:34)
at SettingsStatic.watchSettings (/app/src/utils/settings.js:107:26)
at App.run (/app/src/app/app.js:35:51)
at Object.<anonymous> (/app/src/index.js:33:30)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
errno: -2,
syscall: 'watch',
code: 'ENOENT',
path: '/home/node/.nostr/settings.yaml',
filename: '/home/node/.nostr/settings.yaml'
}

It seems like it wants me to provide a custom settings file even though there is a default one...

I see in the README that in the QuickStart section, you say that we should copy default-settigs.yaml file to .nostr/settings.yaml file, is this the case here too?? Even though the .nostr folder is gitignored and it won't be uploaded??

Any advice is greatly appreciated. Cause as I said, my relay is currently down.


@antonleviathan Have you fixed the issue for yourself btw?

MTG2000 commented 1 year ago

I fixed the issue. The path to the settings file was incorrect. So when I changed it to this:

COPY --from=build /build/dist .
ADD resources /app/resources

RUN mkdir -p $NOSTR_CONFIG_DIR
COPY .railwayapp/settings.yaml $NOSTR_CONFIG_DIR/settings.yaml

It worked.

amunrarara commented 6 months ago

I've just encountered the same issue. Trying @MTG2000 's solution now

amunrarara commented 6 months ago

Fixed it for me, too. Thanks @MTG2000