I have a PHP app running on heroku (cedar stack). I'm at the point where I need to start passing jobs off to workers.
I've looked a both RabbitMQ and gearman. It seems like the best / simplest solution for my app would to use gearman.
So I'm guessing the gearman server would run on the main webapp dyno and then the gearman workerapi would run on separate heroku workers, along with the php code that should do the work.
How can I go about doing this with Heroku?
Thanks
Queuing is best done with an addon https://addons.heroku.com/#queues. The link ( devcenter.heroku.com/articles/background-jobs-queueing ) in the comment to your question by ficuscr should provide you with some insight as to how exactly to implement your workers.
Related
I use supervisord to configure and run laravel queues as a background job on the linux machines. One of my customer can only use windows machine due to their company policy.
I want to run laravel queue as a background job on windows. I've came up with this solution below but I am not so sure if it is good way to do it.
forever -c php artisan queue:listen --tries=3
Anyone has tried it in production if yes how was experience with that or anyone has better solution with this situtation?
Any help would be highly appreciated.
I have deployed my app on shared host "Hostgator", I've ssh successfull access, however I can't install supervisor to manage queue processing, the command sudo apt-get install supervisor always return errors, so I have contacted support and I was told that I can't make sudo commands with sharedhost "cloud" plan and I have to move to VPS or dedicated which I can't move to at this time.
My question is : is there any alternative can I use to manage the queue processing without supervisor or another way to go around this ? anybody wen through this and found a solution ?
I was thinking to make a cron job with command php artisan queue:work every morning maybe but is this a good practice ?
Thanks in advance any help is appreciated.
For anyone there who is going through something similar, I managed that by cron jobs that run every hour but you have to migrate failed jobs table to make sure that failed jobs are handled and don't stop the queue processing, even though this is not ideal but it somehow works. The ideal solution is considering VPS hosting or mixing Laravel Forge with DigitalOcean for example as mentioned in laravel docs.
Cheers.
I'm using Heroku running a PHP app, I need to setup background workers which talk to external APIs and write to my DB, Heroku has lots of info about setting up workers for Ruby but not for PHP.
Is this easily doable on Heroku with PHP?
I've never tackled launching background processes and I can't seem to find any docs detailing it...
Add the following environment variables:
# Add this config
$ heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib
Then you can just add the worker to your Procfile.
worker: cd ~/www/ && ~/php/bin/php worker.php
I have a small wordpress blog on local zend server. Recently I felt my PC slow down and I found a lot of php-cgi.exe are running. Some said cron job is the course but I don't have any plugin running cron job. Where can I go to check the log of php-cig process?
I was just able to get Apache ANT running on my computer. The ant -version commando outputs the version number , verifying that the installation went well.
I have read that ANT is well suited to handle deployment of web applications including PHP projects and have spent some time to get it working, but I just can't get my head around how to set it up to sync my files to my web server.
How can I make ANT sync folderA with folderB ?
Thanks
Last time I checked (long ago) there was no remote sync task in Ant (only local). You would have to write a shell script that calls rsync and execute this from Ant instead. There is a number of remote tasks though. And you could check out your code from your VCS instead of syncing it to the server.
On a sidenote, you might want to consider Phing over Ant. It's a port of Ant to PHP. It has a FileSync Task. You can also add your own Tasks (written in PHP) and is commonly used in Continuous Integration servers for PHP.
Also see What is your preferred Deployment Strategy for PHP and a couple others.
Read the manual: http://ant.apache.org/manual/index.html
Look at the <copy> task.
I was looking to do the same and just came across this article on how to deploy using ant, maybe it'll give you a different way of going about it: Deploying using Ant