a year ago
Disclaimer: Bit of a noob.
I'm super familiar with running services via docker files.
Am a bit unsure how to run a cron job.
If I have a file in my repo called pull_data.sh in /cron/ dir, how would I have a cron service execute that?
Note: I took a look at documentation on this and am a bit stuck.
0 Replies
a year ago
yeah docs around this topic are lacking
a year ago
Create a new service in your existing project
Add any needed variables
Set it up to deploy from the repo that contains the file / script / etc that you want to run
In the service settings, set the start command
the start command will be what's ran on the set scheduleSet the schedule in the service settings
Step 1 and 2 are done. Service created and variables added.
For step 3, I have the repo connected. I take it thats all here.
For step 4, what would the start command be? saying I have the sh file in /cron/.
a year ago
in your case it would be sh /cron/pull_[data.sh](data.sh)
Also would you recommend it be done via a docker container or is that not necessary here
pull_data.sh runs a python script.
a year ago
not necessary as runs of the cron job don't rebuild anything
a year ago
nixpacks should detect that its a python app so you should have python
Gotcha. Quick Q: Without a docker container how would I handle passing in all the dependencies (requirements.txt)
a year ago
nixpacks handles that
Okay so the cron job worked (so really all is good).
I'm just wondering, should there be things here in the deployments tab?

a year ago
yes, but that doesnt look like it worked lol
a year ago
send a link to it please?
a year ago
the url
a year ago
correct
a year ago
only you and team
Seems like the cron part is working. Not sure about the deployment tab though
a year ago
its running a deploy from 14 mins ago
a year ago
what about the deploy from 3 mins ago?
a year ago
from the deploy logs, it looks like you might need to set a root dir
Okay. I start that service trying it with docker file so I just created a new one
a year ago
^
a year ago
/ is already the default
a year ago
have you read the deploy logs?
a year ago
sorry, i meant build logs
a year ago
yes there is
a year ago
yes i can
a year ago
have you read the logs though?
Sorry I don't want to be missing something but when I look through the build logs, all I see is that screenshot
a year ago
please read the actual content of the logs, dont worry if they are red or not
I read them. All I see is "
[Region: us-west1]
Using Nixpacks
context: 2b843b44d67edc7bfb5e5c611eba9555
Nixpacks build failed
Nixpacks was unable to generate a build plan for this app.
Please check the documentation for supported languages: https://nixpacks.com
The contents of the app directory are:
.cursorignore
.dockerignore
deploy/
services/
contracts/
v3alts/ setup.py mt5/ shared/ jasper/ admin/ tests/ lib/ .gitignore init.py datasci/
"
a year ago
^
a year ago
i feel like you aren't reading the build logs?
a year ago
where is it located
a year ago
Nixpacks build failed
Nixpacks was unable to generate a build plan for this app.I'm just trying to test services/cron/test/run_test.sh
a year ago
does the script need files from outside of the services folder
a year ago
thenn your start command should be sh /services/cron/test/run_[test.sh](test.sh)
Let me mess around with this and see if I can fix it. I'm probably just messing up something stupid.
a year ago
add a nixpacks.toml to the cron folder with this in it -
[phases.setup]
nixPkgs = ['python3']the set a service variable NIXPACKS_CONFIG_FILE=/services/cron
Hey boss. I tried this nix approach with your nixpacks.toml but was getting a file doesn't exist error.
Out of curiousity, is it not recommended to do it via docker file? I was able to get it work this way but wanted to get your thoughts.
a year ago
Dockerfile is perfectly fine
Okay great. Does this screenshot look okay? I just wanted to make sure that the deployments are properly closing down after they finish.
I'm scared that they're staying open and every 5 minutes another container is opening up (and charging)
Here's that link in case you need it: https://railway.app/project/92c5e847-f796-4ffc-b29f-0c2a9bc86322/service/1eb1b172-8a40-4084-a91d-8b89360ffa9e/schedule
a year ago
looks like they are exiting after around 10s according to the time on the right side
But when I open up the log (of one that already completed) it still says active and doesn't say it stopped container or anything like that.

a year ago
that's fine
a year ago
correct
a year ago
no problem!
a year ago
wdym?
a year ago
I'm still gonna say no, railway pays me lol
a year ago
happy to help
a year ago
!s
Status changed to Solved brody • about 1 year ago

