Codio currently does not provide a parts install for supervisord. This can make developing apps that uses Laravel queues an issue since you'd then have to keep a terminal open at all times. So let's keep things simple, and install supervisord manually.
Installing the tools
The only thing from parts that we will need, is pip. This is a python package management tool, which is what supervisord is written in. Just grab this to your box like so:
parts install pip
Now that we have pip, we can pull in supervisord through it.
pip install supervisord
Configuring environment
Now that supervisord is installed, we need to setup the boxes configuration to make it easier to use. We need to:
Now all we need to do before we can begin, is refresh the path in use. You can either restart the terminal or execute the following command.
- Add the python bin to the path.
- Make the configuration directory for supervisor
- Make a log directory
To add the python bin folder to your path, open up /home/codio/.bash_profile and add the following:
$home/.parts/packages/python2/2.7.6-2/bin
to the first path entry. Remember to separate it with a colon between other path declarations.
Now, we need to make the directories for storing the configuration and logs. We will just put these right under the home as well.
mkdir -p ~/etc/supervisor/programs && mkdir ~/logs
Now all we need to do before we can begin, is refresh the path in use. You can either restart the terminal or execute the following command.
source ~/.bash_profile
Configuring supervisord
The only thing left to do to actually run supervisor, is to setup its configuration file. To create the conf file, we will execute the following command to create the file in the ~/etc folder.
echo_supervisord_conf > ~/etc/supervisord.conf
Within this new file, modify the log file to go to ~/logs and at the very bottom uncomment [include] and its rule. Then set the value of the rule to "supervisor/programs/*.ini" which will look relative to the path of the configuration file and grab the configs in there. This way you can make a new file for each adviser you want to keep things neat.
Now that the configuration is setup, just go make your queue.ini file. If you don't know how to set that up, Chris Fidao has a good post which should be enough to get you going.
To verify things run, we need to run supervisord with the configuration option pointing to the conf file.
supervisord --configuration=/home/codio/etc/supervisord.conf
Note that when running supervisorctl you need to pass the configuration location in as well. You may wish to create an alias to make it easier.
Autostart
To autostart supervisord on startup, just add the command you use to manually start it to startup.sh. For more information on setting that up you can check out the Codio documentation.