Help with NATS server ?
0xmemeterminal
TRIALOP

a year ago

Hi guys,

I've started recently my coding journey and I'm deploying a nats server with the following configuration :

docker file :

FROM nats:latest COPY nats-server.conf /etc/nats/nats-server.conf EXPOSE 4222 6222 8222 9222 CMD ["--config", "/etc/nats/nats-server.conf"]

conf file:

`port: 4222

http_port: 8222

websocket {

port: 9222

no_tls: false

same_origin: false

allowed_origins: [

"https://MYDOMAIN.com",

"https://MYDOMAIN.com"

]

compression: true

handshake_timeout: "5s"

}

debug: true

trace: true

logtime: true`

If I set the no_tls: to true, the nats server is working correctly but it says that TLS isn't activated and shouldn't be used in production.

If I set the no_tls: to false, it says that nats-server: websocket requires TLS configuration

Do you guys have an idea how to solve it ?

I though that I could set no_tls : true if Railway handles SSL?

Thanl you for reading and help 🙂

4 Replies

0xmemeterminal
TRIALOP

a year ago

0f205fc0-71bb-45bb-af8e-897a9141383c


a year ago

Railway does handle SSL for you


0xmemeterminal
TRIALOP

a year ago

I can't connect to NATS. I tried to remove the allowed origins in the docker file but it doesnt work :

Nats logs :

Using configuration file: /etc/nats/nats-server.conf [1] 2024/12/14 21:44:32.392731 [DBG] Created system account: "$SYS" [1] 2024/12/14 21:44:32.393451 [INF] Starting http monitor on 0.0.0.0:8222 [1] 2024/12/14 21:44:32.393564 [INF] Listening for websocket clients on ws://0.0.0.0:9222 [1] 2024/12/14 21:44:32.393572 [WRN] Websocket not configured with TLS. DO NOT USE IN PRODUCTION! [1] 2024/12/14 21:44:32.393575 [DBG] Get non local IPs for "0.0.0.0" [1] 2024/12/14 21:44:32.393752 [DBG] ip=REDACTED [1] 2024/12/14 21:44:32.393762 [DBG] ip=REDACTED [1] 2024/12/14 21:44:32.393809 [INF] Listening for client connections on 0.0.0.0:4222 [1] 2024/12/14 21:44:32.393815 [DBG] Get non local IPs for "0.0.0.0" [1] 2024/12/14 21:44:32.393909 [DBG] ip=10.250.29.95 [1] 2024/12/14 21:44:32.393917 [DBG] ip=REDACTED [1] 2024/12/14 21:44:32.393929 [INF] Server is ready

From my terminal:

npx wscat -c ws://PUBLIC-BACKEND-URL:9222 connect ETIMEDOUT

npx wscat -c wss://PUBLIC-BACKEND-URL:9222 connect ETIMEDOUT


a year ago

the service does not have a public domain?


Welcome!

Sign in to your Railway account to join the conversation.

Loading...