Call a webhook endpoint using cron
I would like to trigger an endpoint on a cron schedule. I am aware that railway already provides a way to spin up a service and do so, but I was wondering if there was a way to do it such that I only need to setup an endpoint using the internal networking feature. That way I will not have to create a new service.
Solution:Jump to solution
you could spin up a curl image on a schedule and use curl in the start command
36 Replies
Project ID:
N/A
Since railway already runs on GCP, this should be not be very difficult to implement
or maybe it would be difficult, i cant really assume that
not sure how GCP comes into play here
GCP's cron scheduler has this feature built-in
right but railway already supports cron in a far more versatile way
Solution
you could spin up a curl image on a schedule and use curl in the start command
im aware of it's versatility but it also ends up with me writing around 20 lines of code to do something that should be achievable in 1
^
^
please read my message
no code would be involved
can I use variables in the railway's start command?
of course - https://docs.railway.app/guides/start-command
how do i do this?
please read the docs page i linked
is there a railway variable for internal url? I am trying
${{App.RAILWAY_STATIC_URL}}
but that resolves to the public url
and i dont want to hardcode app.railway.internalit fails without any logs
project id please
6ef7539d-c186-4609-a904-178fd8fa7fa0
please read the docs page i linked
thats weird
pretty sure ubuntu has it
ubuntu the desktop install does, the ubuntu docker image does not, you need to use an image with curl such as
chainguard/curl
TIL
it failed again without any logs
try this image instead -
curlimages/curl
your APP_URL
is also incorrect, please read this docs section - https://docs.railway.app/guides/private-networking#use-internal-hostname-and-portThanks that worked
awesome!
see, it was easy! and you were thinking youd need to write code!
i keep getting this error
is this website listening on ipv6 and port 8080?
not sure how to check that
you mean i should change it to 0.0.0.0?
you would check that in your code and or start command
note quite, that's ipv4
it is already running on that
what do i need to do?
please read the docs section - https://docs.railway.app/guides/private-networking#listen-on-ipv6
alright that worked
awesome