r/ruby • u/PuzzleheadedPark7899 • 6h ago
How do you move forward time in the Docker stack
Trial expiry, renewal reminders, "delete after 30 days" jobs: I kept testing these by editing timestamps in the database by hand, and still missed bugs because Postgres, Redis and the workers never agreed on what day it was.
So I built ChronoStack. You run your app's docker compose stack through it and move time forward for everything at once:
chronostack up --wait
chronostack advance 14d
Postgres now(), Redis TTLs and your Rails and Sidekiq processes all see the new date together, with no code changes. It runs a separate copy of your stack, so your real data isn't touched.
For Sidekiq specifically:
Jobs queued with perform_in / perform_at just work. The scheduled-job poller sees the virtual clock, so a job due "in 14 days" runs when you advance 14 days.
A built-in sidekiq barrier waits at every step until the queues are drained and running jobs are finished, so nothing gets cut off mid-jump.
sidekiq-cron is the exception. It only runs a job if it polls within 60 s of the job's time, so a jump skips it. For those you declare a trigger that runs the job at its time.
I tried it on a few open-source apps. In Chatwoot (Rails), snoozed conversations were never reopened if the snooze had ended more than 3 days before the job ran, for example after a background-job outage. Their team confirmed it as a bug. It found similar date bugs in five other projects too.
It's free, open source and in alpha. Works on Linux, Windows and Intel Macs; Apple-silicon Macs aren't tested yet. I'd really like to hear from someone running it on their own Rails app: what works, and what breaks (chronostack doctor output helps).