cachet icon indicating copy to clipboard operation
cachet copied to clipboard

mailing queue without cron?

Open fdhex opened this issue 10 years ago • 12 comments

Your setup

  • What version of Cachet? 2.3
  • What database driver? MySQL? Postgres? SQLite? MySQL
  • What version of PHP? 7

I was wondering if there was a way to have the mail queue functionality without having to make a cron job? As I'm currently running Cachet as an app on a PaaS, it's not practical for me to edit the crontab every time the app is rescheduled anywhere.

Would you have suggestions there? Or should I just stick with the sync driver (which works well, but I have only one user so I don't really know how it scales)?

fdhex avatar Jun 28 '16 12:06 fdhex

+1 Can we execute the mailing queue as a daemon?

I observed some issue while multiple jobs are created in the database (on creating incidents) but the delivery of mail is delayed (probably because of queue executing slowly in case of multiple jobs). I'm looking into this further.

Is there alternative for running the mailing queue better which is not listed here in the docs - https://docs.cachethq.io/docs/setup-subscribers

Srthk avatar Jun 28 '16 13:06 Srthk

Yes, you can. Just use a queue worker. :)

GrahamCampbell avatar Jun 28 '16 14:06 GrahamCampbell

That is infact the preferable way to do it. We only have the cron there to make things simpler if you don't want to setup a queue worker.

GrahamCampbell avatar Jun 28 '16 14:06 GrahamCampbell

https://laravel.com/docs/5.2/queues#running-the-queue-listener

GrahamCampbell avatar Jun 28 '16 14:06 GrahamCampbell

@GrahamCampbell Thanks. This would be a useful thing to add in the docs.

It does not really solve my problem unfortunately (as far as I can tell) as I can't really run that as part of my paas-deployed cachet (kind of like with a heroku php buildpack). I guess it makes a case for a Docker deployment (as there is no other way to run this in our environment on a physical server / full fledged VM).

fdhex avatar Jun 28 '16 14:06 fdhex

Can we execute the mailing queue as a daemon?

Yes. :)

GrahamCampbell avatar Jun 28 '16 14:06 GrahamCampbell

It does not really solve my problem unfortunately

If you are not able to run a queue worker, then your only other option is to set the queue to sync.

GrahamCampbell avatar Jun 28 '16 14:06 GrahamCampbell

I can't run something else than a webserver on a single container in that context, I would prefer if there was a possibility to send async http requests to an external mailing component with the mail content, but I understand this is not much a priority for Cachet.

if I ever get to do that I'll send a PR if you want to have a look. :)

In general, it would be great to have more modern methods to deploy production grade Cachet rather than manual install on servers.

fdhex avatar Jun 28 '16 15:06 fdhex

I hope you guys could have added more details and shed light on the best practice to run a queue worker for handling subscription mailing for Cachet in your docs. Will try to implement this https://laravel.com/docs/5.2/queues#running-the-queue-listener (Queue Listener) and see if it improves mail delivery.

Srthk avatar Jun 28 '16 20:06 Srthk

Alternate question, how many requests can be handled if queue driver is set to sync and what is the possibility of losing out sending out mails in such a scenario? Is implementing a queue worker the best and most efficient practice for this?

Srthk avatar Jun 28 '16 20:06 Srthk

@GrahamCampbell For starters, a simple guide on how to use beanstalkd or sqs instead of database as QUEUE_DRIVER with cachet will be helpful. Hope you could provide more support on this.

Srthk avatar Jun 28 '16 20:06 Srthk

Just use the laravel docs. It's identical.

GrahamCampbell avatar Jun 29 '16 08:06 GrahamCampbell