Running Mailwizz on multiple servers


New Member

I am setting up Mailwizz in a clustered environment. Obviously, there's no problem running the actual web application on multiple servers but what about the cron jobs? Can they be set up to run on multiple machines without any risk of unexpected behavior, for example sending duplicate emails? I am doing it to ensure everything is working even if one machine goes down or we need to take it out for maintenance.

@Robin - For most of the cron jobs, we're locking them with mutexes when using pcntl to prevent running them twice, sending-campaigns being one of them. Then if using redis for mutexes and cache, you'll have them shared between your apps, so if a lock is aquired by machine A, machine B won't be able to acquire it.
However, there are some crons which are not locked for good reasons, for example the daily cron job is not locked, because that one handles local cleanup and auto-update, so locking it makes no sense.
My advice is to either use a single instance for crons, or programatically make sure the crons are called just once, for example by wrapping them in a scripting language(php / go / etc) which communicates with a shared lock machine like redis.
Thank you so much @twisted1919. Do you have any other advice or recommendations when it comes to running Mailwizz in a multiple servers environment?

Is there any documentation on which folders and files need to be hosted on a shared storage?
@Robin - Not many since running mailwizz in multiple servers should be no different than running any web app, it's just these little things you have to take care of, like cron jobs (which i think it's the only thing actually in mailwizz).
As for content that goes in shared storage, the /frontend/assets/{files,gallery} folders contain shared data which have to be kept in sync using rsync or any other tool you're familiar with, this is because that's where uploaded files go, template assets, etc.
If you hit specific issues, let me know and i'll be more than happy to answer.