I have deployed rails app on two EC2 instances. I have scheduled on Job with rufus-scheduler to run every 24 hours to send some emails.
But scheduler is running separately on two instances.
I need run scheduler on only one instance. So can you please help with this issue?
Thanks
Let's assume you've followed https://github.com/jmettraux/rufus-scheduler#so-rails
You could modify the initializer in this way:
Then in the Rails root of the instance you don't want to schedule, simply touch the no_scheduling file, then start your Rails. The instances with a "no_scheduling" file will not schedule.
Exercise 1: enhance the initializer above so that it doesn't even instantiate the scheduler if no_scheduling is present.
Exercise 2: replace the file check by an IP check so that only the rails setup on a given IP schedules.