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