2 years ago
Just wondering how to do that. Instead of deploying the services at the same time. Is this possible?
18 Replies
2 years ago
It's not currently possible natively with Railway, the best you could do would be to use nc to wait for the database (since I'm pretty sure I know the context of this question)
2 years ago
Yup you know the context, we want to make sure that the database is running before deploying the source image.
Btw, it is working successfully now, there's an issue with our dashboard that it says that the instance or the service is not publicly accessible.
2 years ago
You wouldn't want to be using the TCP proxy for HTTP, you'd want to use the HTTP proxy for HTTP.
2 years ago
Correct. But it sounds like you are using the v1 template composer, I would highly recommend you use the v2 composer -
2 years ago
Yeah tried that but it doesn't show a response from the browser is that intended?
In addition, how to make the public network HTTPS?
2 years ago
Sure it does! - https://thirdweb-engine-production-ee27.up.railway.app/json
HTTPS is automatically done by Railway.
2 years ago
How about the nc thing how to do that with the setup? Where can I put that?
2 years ago
You could update the service's start command to -
/bin/sh -c "echo 'Waiting for database...'; while ! nc -z ${PGHOST_PRIVATE} ${PGPORT_PRIVATE}; do sleep 0.5; done; echo 'Database is now available'; exec /sbin/tini -- yarn start"This means you need two additional variables on the service -
PGHOST_PRIVATE=${{Postgres.PGPRIVATEHOST}}
PGPORT_PRIVATE=5432Tini would also like you to set a TINI_SUBREAPER variable to 1
2 years ago
Alright, the above start command will also work with "source image" not a github repo?
Tini would also like you to set a TINI_SUBREAPER variable to 1
Do I need to add this too in the env?
2 years ago
Alright, the above start command will also work with "source image" not a github repo?
If the image is built using that Dockerfile in your repo, yes absolutely!
Tini would also like you to set a TINI_SUBREAPER variable to 1
Do I need to add this too in the env?
Yeah as a service variable!
2 years ago
Hey Brody works!
Finalizing and will publish in a minute, thanks for all the help!