R
Railway6mo ago
Cayter

Weird start command behaviour

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"]
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?
Railway Docs
Build and Start Commands | Railway Docs
Documentation for Railway
No description
Solution:
perhaps, im not really sure whats causing it, but the fact that your app has started means this isnt exactly an issue with railway
Jump to solution
73 Replies
Cayter
CayterOP6mo ago
56e8d4c1-7369-4e6b-b4c1-159f7d94bfdd
Brody
Brody6mo ago
when a dockerfile or image is in use that custom start command will overwrite the entrypoint and cmd can you share your entire dockerfile?
Cayter
CayterOP6mo ago
GitHub
starter/Dockerfile at main · saaskitty/starter
The starter template for quickly launching your full-stack web application. - saaskitty/starter
Brody
Brody6mo ago
does this work if you omit the start command in the service settings?
Cayter
CayterOP6mo ago
yeah i have another service that doesn't have custom start command and it's working fine with this Dockerfile 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
Brody
Brody6mo ago
those two services seem like they wouldnt be using the same dockerfile either way, what runtime are you currently on?
Cayter
CayterOP6mo ago
distroless nodejs v22 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
Brody
Brody6mo ago
railway runtime, check your service settings
Cayter
CayterOP6mo ago
this?
No description
Brody
Brody6mo ago
switch to legacy and see what happens
Cayter
CayterOP6mo ago
ok let me try now same error
Cayter
CayterOP6mo ago
No description
Cayter
CayterOP6mo 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
Brody
Brody6mo 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
CayterOP6mo ago
i tried both legacy and v2
Brody
Brody6mo ago
builder, not runtime
Cayter
CayterOP6mo ago
would this affect anything?
No description
Brody
Brody6mo ago
try disabling it
Cayter
CayterOP6mo ago
trying ok seems like this is the culprit, i'm seeing a different error that's not related to deployment
Brody
Brody6mo ago
what error
Cayter
CayterOP6mo ago
No description
Brody
Brody6mo ago
thats because you arent on the v2 runtime
Cayter
CayterOP6mo ago
do you mean my databases have to be on legacy if my services are on legacy?
Brody
Brody6mo ago
no, your app should be on v2 your databases are on legacy regardless since they have a volume
Cayter
CayterOP6mo ago
let me try updating them to v2
Cayter
CayterOP6mo 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
No description
Cayter
CayterOP6mo ago
is private url only accessible by 1 service at a time? if yes, that's weird
Brody
Brody6mo ago
thats not the case at all, something is misconfigured what error do you get from the worker
Cayter
CayterOP6mo ago
No description
Cayter
CayterOP6mo ago
the thing is that server is also connecting but not seeing the same error
Brody
Brody6mo ago
is it on the v2 runtime?
Cayter
CayterOP6mo ago
yeah all databases and server/worker are on v2 runtime now
Brody
Brody6mo ago
what kind of worker is the worker?
Cayter
CayterOP6mo ago
it's a bullmq node /app/node_modules/saaskitty/build/production/main.js start --service=worker this command runs bullmq underneath
Brody
Brody6mo ago
how are you telling it to connect to redis?
Cayter
CayterOP6mo ago
environment variable
Brody
Brody6mo ago
url or host, port, username, password?
Cayter
CayterOP6mo 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
No description
Brody
Brody6mo ago
append ?family=0 to the end of the url the private network is ipv6 only but ioredis (what bullmq uses) defaults to only ipv4
Cayter
CayterOP6mo ago
ahhh ok 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 thanks a lot man!
Brody
Brody6mo ago
there is still the issue of the new builder not working for you you wont be able to use the old builder forever so its best we sort that out sooner than later
Cayter
CayterOP6mo ago
yeah, but at least i can now demo to my co-founder to convince them to switch to railway, wish me luck
Brody
Brody6mo ago
good luck! 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
CayterOP6mo ago
nice cool, i can finally create a template for it on railway
Brody
Brody6mo ago
as long as you sort out the issue with the v2 builder
Cayter
CayterOP6mo ago
is v2 builder a new thing that needs some time to stabilize?
Brody
Brody6mo ago
not quite
Cayter
CayterOP6mo ago
so basically v2 builder doesn't work well with custom start command at the moment
Brody
Brody6mo ago
im trying to reproduce
Brody
Brody6mo 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?
No description
No description
No description
No description
Cayter
CayterOP6mo ago
oh we need postgres, 3 redis (for pubsub, cache, queue), and a SMTP url
Brody
Brody6mo ago
well yeah but the point is the app did start, you where not able to have that happen with the v2 builder
Cayter
CayterOP6mo ago
let me try it now
Brody
Brody6mo ago
im going to say that you have something misconfigured somewhere else
Cayter
CayterOP6mo ago
i'm also not sure, i'm using default mostly, is there any other configuration that we need to be aware of?
Brody
Brody6mo ago
can you send me the full deploy logs - https://bookmarklets.up.railway.app/log-downloader/
Cayter
CayterOP6mo ago
crap arc doesn't have bookmark
Brody
Brody6mo ago
L
Cayter
CayterOP6mo ago
No description
No description
No description
No description
Cayter
CayterOP6mo ago
No description
Brody
Brody6mo ago
deploy logs please
Cayter
CayterOP6mo ago
Brody
Brody6mo ago
where is (app v0.1.0) coming from?
Cayter
CayterOP6mo ago
it's a message printed from the app
Brody
Brody6mo ago
then your app did indeed start
Cayter
CayterOP6mo 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
Brody
Brody6mo ago
yeah this isnt an issue with the v2 builder, but it is odd all the same
Cayter
CayterOP6mo ago
is this ur custom start command?
node /app/node_modules/saaskitty/build/production/main.js start --service=worker
node /app/node_modules/saaskitty/build/production/main.js start --service=worker
Brody
Brody6mo ago
yep pasted it in and railway said there was no changes made
Cayter
CayterOP6mo ago
hmm i guess i probably need to pass -- in between
Solution
Brody
Brody6mo 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
CayterOP6mo ago
yeah thanks for all the help though!
Brody
Brody6mo ago
no problem!
Want results from more Discord servers?
Add your server