Weird start command behaviour

cayter
TRIAL

a year ago

does this override ENTRYPOINT or CMD in the dockerfile? i can't get it to work no matter what, it keeps returning ERROR Unknown command node /app/node_modules/saaskitty/build/production/main.js start --service=worker

this is the default in the Dockerfile which is working fine in another service that doesn't configure Custom Start Command

ENTRYPOINT [ "node", "/app/node_modules/saaskitty/build/production/main.js" ]
CMD [ "start", "--service=server"]

followed the guide here https://docs.railway.app/reference/build-and-start-commands#start-command, but it seems not working?

0 Replies

cayter
TRIAL

a year ago

56e8d4c1-7369-4e6b-b4c1-159f7d94bfdd


a year ago

when a dockerfile or image is in use that custom start command will overwrite the entrypoint and cmd


a year ago

can you share your entire dockerfile?



a year ago

does this work if you omit the start command in the service settings?


cayter
TRIAL

a year ago

yeah i have another service that doesn't have custom start command and it's working fine with this Dockerfile


cayter
TRIAL

a year ago

i run 2 services

server -> fastify server with remix which is run via start --service=server
worker -> bullmq which is run via start --service=worker


a year ago

those two services seem like they wouldnt be using the same dockerfile


a year ago

either way, what runtime are you currently on?


cayter
TRIAL

a year ago

distroless nodejs v22


cayter
TRIAL

a year ago

i'm pretty sure Dockerfile doesn't have any issue, as i have compose.yml that uses the same and it's running fine locally


a year ago

railway runtime, check your service settings


cayter
TRIAL

a year ago

this?

1253390840097931300


a year ago

switch to legacy and see what happens


cayter
TRIAL

a year ago

ok let me try now


cayter
TRIAL

a year ago

same error


cayter
TRIAL

a year ago

1253391824614199600


cayter
TRIAL

a year ago

is there a way to know how railway apply Custom Start Command?

'cause ENTRYPOINT and CMD are pretty different and the docs is very ambiguous


a year ago

i would have to ask a team member, and they are very busy at the moment so i dont want to disturb them.

are you on the v2 builder or the legacy builder?


cayter
TRIAL

a year ago

i tried both legacy and v2


a year ago

builder, not runtime


cayter
TRIAL

a year ago

would this affect anything?

1253392727916413000


a year ago

try disabling it


cayter
TRIAL

a year ago

trying


cayter
TRIAL

a year ago

ok seems like this is the culprit, i'm seeing a different error that's not related to deployment


a year ago

what error


cayter
TRIAL

a year ago

1253393409725694000


a year ago

thats because you arent on the v2 runtime


cayter
TRIAL

a year ago

do you mean my databases have to be on legacy if my services are on legacy?


a year ago

no, your app should be on v2


a year ago

your databases are on legacy regardless since they have a volume


cayter
TRIAL

a year ago

let me try updating them to v2


cayter
TRIAL

a year ago

both my services have the same env and v2 runtime (same as redis queue) but only server can connect to queue.railway.internal (private) and not the worker

i remember bumping into the same 2 months back when i tried railways

1253396354651263000


cayter
TRIAL

a year ago

is private url only accessible by 1 service at a time? if yes, that's weird


a year ago

thats not the case at all, something is misconfigured


a year ago

what error do you get from the worker


cayter
TRIAL

a year ago

1253397071583514600


cayter
TRIAL

a year ago

the thing is that server is also connecting but not seeing the same error


a year ago

is it on the v2 runtime?


cayter
TRIAL

a year ago

yeah all databases and server/worker are on v2 runtime now


a year ago

what kind of worker is the worker?


cayter
TRIAL

a year ago

it's a bullmq


cayter
TRIAL

a year ago

node /app/node_modules/saaskitty/build/production/main.js start --service=worker

this command runs bullmq underneath


a year ago

how are you telling it to connect to redis?


cayter
TRIAL

a year ago

environment variable


a year ago

url or host, port, username, password?


cayter
TRIAL

a year ago

https://github.com/saaskitty/starter/blob/main/.env.docker#L8

this is how i connect the server/worker when they all running in the docker compose cluster locally

on railway, it's currently configured to the one in screenshot

1253397996188598300


a year ago

append ?family=0 to the end of the url


a year ago

the private network is ipv6 only but ioredis (what bullmq uses) defaults to only ipv4


cayter
TRIAL

a year ago

ahhh ok


cayter
TRIAL

a year ago

oh man, this is finally working, i was wrong that server was able to connect to the queue as i configured it to connect lazily


cayter
TRIAL

a year ago

thanks a lot man!


a year ago

there is still the issue of the new builder not working for you


a year ago

you wont be able to use the old builder forever so its best we sort that out sooner than later


cayter
TRIAL

a year ago

yeah, but at least i can now demo to my co-founder to convince them to switch to railway, wish me luck


a year ago

good luck!


a year ago

fwiw i deployed a direct fork of your repo with no changes and could not reproduce the issue, i of course get some missing environment variables error but the app does technically start


cayter
TRIAL

a year ago

nice cool, i can finally create a template for it on railway


a year ago

as long as you sort out the issue with the v2 builder


cayter
TRIAL

a year ago

is v2 builder a new thing that needs some time to stabilize?


a year ago

not quite


cayter
TRIAL

a year ago

so basically v2 builder doesn't work well with custom start command at the moment


a year ago

im trying to reproduce


a year ago

v2 builder, v2 runtime, the same custom start command you used, the same repo you used, app crashed but it did start.

am i missing anything?

1253402135790354400
1253402136210047200
1253402136520298500
1253402136734204000


cayter
TRIAL

a year ago

oh we need postgres, 3 redis (for pubsub, cache, queue), and a SMTP url


a year ago

well yeah but the point is the app did start, you where not able to have that happen with the v2 builder


cayter
TRIAL

a year ago

let me try it now


a year ago

im going to say that you have something misconfigured somewhere else


cayter
TRIAL

a year ago

i'm also not sure, i'm using default mostly, is there any other configuration that we need to be aware of?


a year ago

can you send me the full deploy logs -


cayter
TRIAL

a year ago

crap arc doesn't have bookmark


a year ago

L


cayter
TRIAL

a year ago

1253405269258670000
1253405269615050800
1253405269933686800
1253405270256914700


cayter
TRIAL

a year ago

1253405354986049800


a year ago

deploy logs please


cayter
TRIAL

a year ago


cayter
TRIAL

a year ago


a year ago

where is (app v0.1.0) coming from?


cayter
TRIAL

a year ago

it's a message printed from the app


a year ago

then your app did indeed start


cayter
TRIAL

a year ago

now that you mentioned it, it's possible that the process.argv is wrongly parsed by the library i'm using for building the CLI


a year ago

yeah this isnt an issue with the v2 builder, but it is odd all the same


cayter
TRIAL

a year ago

is this ur custom start command?

node /app/node_modules/saaskitty/build/production/main.js start --service=worker

a year ago

yep


a year ago

pasted it in and railway said there was no changes made


cayter
TRIAL

a year ago

hmm i guess i probably need to pass -- in between


a year ago

perhaps, im not really sure whats causing it, but the fact that your app has started means this isnt exactly an issue with railway


cayter
TRIAL

a year ago

yeah thanks for all the help though!


a year ago

no problem!