How to install supervisor on MacOS

1
1113

How to install supervisor on MacOS. In your project, you sometimes need to use a program to manage the Schedule Tasks (Queue – Job). Supervisor is a good choice for Linux, especially Ubuntu. However, many developers use MacOS, and installing supervisors on Macs is sometimes difficult if your MacOS is using python 3.

This article provides solutions if your MacOS does not install a supervisor. I use Python 3, so i can not install a supervisor normally. I found the solution after trying a lot of methods. And now, let’s start.

Install supervisor on MacOS

First, you need to create a Python environment with Conda. Conda is a system for managing libraries as well as working environments. We can switch versions easily. Start creating Python environment 2.7

conda create -n envtestpy2 python=2.7

Terminal will ask to install Python 2.7 packages. Press and Enter. When finished, you will see

How to install supervisor on MacOS - Config supervisor run Job/Task. Detailed supervisor installation instructions on MacOS does not support supervisor.

Now you have a python 2.7 environment to install the supervisor. Perform the installation as usual.

Step 1: Active Environment

source activate envtestpy2

Step 2: Install supervisor

easy_install supervisor

Successful installation, you will have supervisor.

Step 3: Configure the supervisor

View the supervisor configuration file

vi /etc/supervisor/supervisord.conf

Here I take an example of my project. My project uses Laravel + Valet. And I have a Job update all my shop image using the Queue Job in Laravel.

I will configure the supervisor as follows:

  • Create a file containing the parameters of the Job to run. Each job has only one configuration file. In this example, I created a smartseoimage-worker.conf file with the following content.

How to install supervisor on MacOS - Config supervisor run Job/Task. Detailed supervisor installation instructions on MacOS does not support supervisor.

  • Do not care about content inside. They are just job settings.
  • Then, you include the file name at the end of the supervisor’s default config file. the supervisor’s default config file is supervisord.conf

How to install supervisor on MacOS - Config supervisor run Job/Task. Detailed supervisor installation instructions on MacOS does not support supervisor.

So I successfully configured my job on the supervisor. Later, if any more jobs. Just repeat step 3.

Step 4: Run Job

Launch supervisord if no supervisord is run.

supervisord

Run Job created

supervisorctl reread #update config
supervisorctl start smartseoimage-worker:* #run

Show status

supervisorctl status

How to install supervisor on MacOS - Config supervisor run Job/Task. Detailed supervisor installation instructions on MacOS does not support supervisor.

So you can customize your project on MacOS. Wish you a wonderful work day.

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Hung Nguyen Recent comment authors
newest oldest most voted
Hung Nguyen
Guest
Hung Nguyen

Nice!