R
Railway3mo ago
IgnisDa

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:
you could spin up a curl image on a schedule and use curl in the start command
Jump to solution
36 Replies
Percy
Percy3mo ago
Project ID: N/A
IgnisDa
IgnisDaOP3mo ago
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
Brody
Brody3mo ago
not sure how GCP comes into play here
IgnisDa
IgnisDaOP3mo ago
GCP's cron scheduler has this feature built-in
Brody
Brody3mo ago
right but railway already supports cron in a far more versatile way
Solution
Brody
Brody3mo ago
you could spin up a curl image on a schedule and use curl in the start command
IgnisDa
IgnisDaOP3mo ago
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
Brody
Brody3mo ago
^
IgnisDa
IgnisDaOP3mo ago
^
Brody
Brody3mo ago
please read my message no code would be involved
IgnisDa
IgnisDaOP3mo ago
can I use variables in the railway's start command?
IgnisDa
IgnisDaOP3mo ago
how do i do this?
Brody
Brody3mo ago
please read the docs page i linked
IgnisDa
IgnisDaOP3mo ago
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.internal
IgnisDa
IgnisDaOP3mo ago
it fails without any logs
No description
Brody
Brody3mo ago
project id please
IgnisDa
IgnisDaOP3mo ago
No description
No description
IgnisDa
IgnisDaOP3mo ago
6ef7539d-c186-4609-a904-178fd8fa7fa0
Brody
Brody3mo ago
please read the docs page i linked
IgnisDa
IgnisDaOP3mo ago
thats weird
No description
IgnisDa
IgnisDaOP3mo ago
pretty sure ubuntu has it
Brody
Brody3mo ago
ubuntu the desktop install does, the ubuntu docker image does not, you need to use an image with curl such as chainguard/curl
IgnisDa
IgnisDaOP3mo ago
TIL it failed again without any logs
Brody
Brody3mo ago
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-port
IgnisDa
IgnisDaOP3mo ago
Thanks that worked
Brody
Brody3mo ago
awesome! see, it was easy! and you were thinking youd need to write code!
IgnisDa
IgnisDaOP3mo ago
i keep getting this error
No description
Brody
Brody3mo ago
is this website listening on ipv6 and port 8080?
IgnisDa
IgnisDaOP3mo ago
not sure how to check that you mean i should change it to 0.0.0.0?
Brody
Brody3mo ago
you would check that in your code and or start command note quite, that's ipv4
IgnisDa
IgnisDaOP3mo ago
it is already running on that what do i need to do?
IgnisDa
IgnisDaOP3mo ago
alright that worked
Brody
Brody3mo ago
awesome
Want results from more Discord servers?
Add your server