How to run command or script right AFTER deployment is live
This is Next.js app. I need to do
PUT https://myapp.com/api/inngest
on my own app, which will in turn register my inngest functions in external service https://www.inngest.com/docs/deploy.
I was thinking about triggering PUT request in package.json poststart
script but obviously at that moment it is not guaranteed that the new app is live (how would the /health endpoint work otherwise).
It is important that when PUT request is triggered that the new app is live; or more precisely that all traffic to app's public domain is directed to newly deployed app instead of the old one.
It is also important to do this request as soon as possible, so some arbitrary timeout is not acceptable here.
How can this be achieved? Is it possible to do this via nixpacks config? Am I missing something obvious here?7 Replies
Project ID:
24e91f39-8c4b-4005-b2fa-bcb47c44b717
24e91f39-8c4b-4005-b2fa-bcb47c44b717
set
RAILWAY_DEPLOYMENT_OVERLAP_SECONDS
= 0
then use a webhook, there will be a webhook fired on SUCCESS
and of course be sure to use a health checkWow, that' great, thanks for the info, I somehow missed railway has deployment webhooks, that is exactly what I need
Follow up question; is there a Railway-Provided service variable for service
id
or name
?no variable for service name unfortunately, but there is for the service id
RAILWAY_SERVICE_ID
these are all the variables available to the app at run time (i haven't defined any service variables, otherwise they would be there too)
https://utilities.up.railway.app/env_varsWow, this is great, tnx
Thank you for your help, that solves it for me
awsome! no problem!