简体   繁体   中英

Run Supervisor on CloudFoundry

Is there a way to install an run Supervisor in the php-buildpack of CloudFoundry?

I have a Laravel app and wan't some monitored background processes to work on queued jobs .

I can install supervisor with the apt-buildpack, but when ever i wan't to start supervisor with supervisord -c supervisord.conf i get the following error:

Traceback (most recent call last):
File "/home/vcap/deps/0/bin/supervisorctl", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

This is my supervisord.conf:

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/vcap/app/artisan queue:work --tries=3
autostart=true
autorestart=true
user=vcap
numprocs=2
redirect_stderr=true
stdout_logfile=/home/vcap/app/storage/logs/worker.log

Don't use supervisord, it's not necessary with Cloud Foundry. The platform does everything that supervisord will do for you here.

To utilize the platform, you've got two options:

  1. Push your normal web app. Push a second app for your worker process. You can do this by running cf push twice or by using an application manifest.yml file that describes both apps .

  2. You can use the new cf v3-push features and use a Procfile. In that you can have one web and one worker process. This will be similar to option #1, but you'll end up with one app that has two processes under that app. See here for details .

The benefit of these options is that the platform handles everything about your app. It starts it, it watches it, it restarts it if there's problems and it can even scale it. There is nothing else to install or configure.

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM