2 months ago
Hello, when I push a new code on my project (with github connected to railway), I have an email "Deploy crashed", however, everything works after that. I think this email is being generated because the old instance is being abruptly killed during the deployment of the new instance. How can this be prevented?
Pinned Solution
2 months ago
Thank you for your reply. I didn't have a start command until now, but your message pointed me in the right direction. I removed this block of code from my Rails app, in the /bin/docker-entrypoint file:
# If running the rails server then create or migrate existing database
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
./bin/rails db:prepare
fi
Note: This is code generated by default in Rails projects, not my own code.
Instead, I created a pre-deploy command in railway:
./bin/rails db:prepare
This resolved the issue in my case. Thanks for your help.
2 Replies
2 months ago
hey,
what's your start command in railway? if you're using yarn start, that's likely the issue , yarn doesn't pass the sigterm signal down to your actual process, so when railway tries to gracefully stop the old instance it gets forcefully killed and marked as crashed. the fix is to start your app directly with node index.js instead of yarn. let me know your start command and i can confirm
ilyass012
hey, what's your start command in railway? if you're using yarn start, that's likely the issue , yarn doesn't pass the sigterm signal down to your actual process, so when railway tries to gracefully stop the old instance it gets forcefully killed and marked as crashed. the fix is to start your app directly with node index.js instead of yarn. let me know your start command and i can confirm
2 months ago
Thank you for your reply. I didn't have a start command until now, but your message pointed me in the right direction. I removed this block of code from my Rails app, in the /bin/docker-entrypoint file:
# If running the rails server then create or migrate existing database
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
./bin/rails db:prepare
fi
Note: This is code generated by default in Rails projects, not my own code.
Instead, I created a pre-deploy command in railway:
./bin/rails db:prepare
This resolved the issue in my case. Thanks for your help.
Status changed to Solved brody • 2 months ago
