Running scheduled jobs from Rails app

I’m moving my rails app from Digital Ocean to Fly, and I have a few background jobs that I need to run:

  1. hourly Firebase certificate fetch from Firebase’s servers
  2. a scraper that gets some data from the web

they’re currently set up as rake tasks, so app.json contains:

"cron": [
    {
      "command": "rake 'firebase:certificates:force_request'",
      "schedule": "@hourly"
    },
...
]

It doesn’t seem that fly is running these?

As an addendum, it doesn’t seem that Fly is running postdeploy.sh when I deploy?

I think this app.json format might be specific to Digital Ocean, it’s not something our system knows what to do with.

We don’t have a cron feature yet. We actually use sidekiq to schedule jobs like that, but some people just run a tiny VM with cron in it too.

What does postdeploy.sh do?

sidekiq-scheduler is a good option if you’re using Sidekiq. It’s better than cron in many ways - not least because you can monitor jobs in the Sidekiq web UI.

DO has predeploy and postdeploy job types. Predeploy is equivalent to the Fly release command in fly.toml. This will run after a successful build, but before the deployment is released.

Fly has no equivalent to postdeploy, but most apps are OK with predeploy.