Setup Supervisor Worker

  1. Enabled service for supervisor
    • in my situation i enable supervisor services on runcloud
  2. Then Login in terminal server
  3. Go to supervisor.d
    cd /etc/supervisor.d
  4. Then vim a file name u want to add
    • in my situation i add ci-worker.conf
      /etc/supervisor.d $ vim ci-worker.conf
  5. Then add this code into your file
    [program:ci-worker]
    command=php /home/example/webapps/app-example/index.php worker process_example_queue
    autostart=true
    autorestart=true
    stderr_logfile=/var/log/ci-worker.err.log stdout_logfile=/var/log/ci-worker.out.log
    • for /home/example/webapps/app-example/index.php is your web application path
    • for worker is your controller name
    • for process_example_queue is your function in controller to be excute
    • stderr_logfile & stdout_logfile is generated log for monitoring. U can specify path for log file to be generated
  6. After finish add file for worker can run both script
    • sudo supervisorctl reread
    • sudo supervisorctl update
  7. Then u can run to restart worker process
    • sudo supervisorctl restart ci-worker

Notes

  1. For check all status for worker u can run
    • sudo supervisorctl status
  2. If u make changes in worker file changes not be effected immediately u need to restart your worker like step no 8.

Leave a comment

Your email address will not be published. Required fields are marked *