R
Railway15mo ago
tomp7579

Run a daily rails rake script on cron

Hi I have an app that does a daily update to the data in the db. Currently using railway I run this rails rake script from my local computer in a railway shell, however I want to remove the dependency of my local computer and have the script run automatically. To do this properly, do I need to create a seperate railway service (linked to the same github repo and docker scripts) to do this and run that on a cron schedule? Thanks!
9 Replies
Percy
Percy15mo ago
Project ID: 27e66b9a-1db7-462a-a04b-8430e543caa9
tomp7579
tomp7579OP15mo ago
27e66b9a-1db7-462a-a04b-8430e543caa9
root
root15mo ago
Railway Docs
Cron Jobs | Railway Docs
Documentation for Railway
tomp7579
tomp7579OP15mo ago
Thanks yes I've seen that, I think what I'm confused about is how to actually run the rake task in the docker container. I tried setting my start command as the script that should run the rake task (assuming that it would run from within the container) but that isnt working (I see now that it overrides the docker build so thats not right) and I'm not sure how to specify the script to run. The service I set up is hooked to the same github repo as my server service and inheriting the same docker files so I'm not sure if I need different docker files for this cron service that run the script after bringing the container up? If so, not sure how to specify which docker files to use on start.
Brody
Brody15mo ago
the start command would be the place to put your desired start command
tomp7579
tomp7579OP15mo ago
Ok and for docker that just overrides the entrypoint script right? AH I think I got it, needed to add a ./ in front of the start script When that script terminates, does the railway service then shut down on its own?
Brody
Brody15mo ago
correct, you should see a completed status or successful, same difference assuming it exits with non error code
tomp7579
tomp7579OP15mo ago
Thanks for your help, I think Im good now.
Brody
Brody15mo ago
awesome!
Want results from more Discord servers?
Add your server