SiteHost

Accessing supervisord from an SSH session

We have recently released a new feature for our PHP images which allows you to access the supervisor process from an SSH session. This article will go over how to access this feature and what can be done with it.

This involves a number of config changes that may cause problems when upgrading from an image that does not have this feature enabled.

Accessing supervisord

To access the supervisord process from an SSH session, you will need to run the following command while logged in as a user that has access to your container:

Please note that this can only be done on SSH users that are connected to one container. Multi-container users will not be able to use this feature.

supervisorctl

If successful, you will get something similar to the below output:

$ supervisorctl
apache2                          RUNNING   pid 8, uptime 0:03:50
cleartmp                         EXITED    Jul 26 01:26 PM
cron                             RUNNING   pid 9, uptime 0:03:50
php                              RUNNING   pid 10, uptime 0:03:50
rsyslog                          RUNNING   pid 11, uptime 0:03:50
supervisor>

Otherwise, if the feature is not available for your container, you will get the following error:

$ supervisorctl
unix:///var/run/supervisor.sock no such file
supervisor> 

Using supervisorctl

With this tool, you can perform various actions on your container's services and check their statuses. A full example of commands can be found with help.

For example, you can restart the php service with the restart command.

supervisor> restart php
php: stopped
php: started

Troubleshooting

No such file

This is potentially due to one of two problems:

  1. Your SSH user is setup to connect to multiple containers. You are unable to access supervisord for a container if you are connected to multiple containers.
  2. Your container is not setup to use the new supervisord feature.

You can confirm if your container has support for this feature by looking for a system folder under the /container directory. A container that can support this feature will look as follows:

~/container$ ls
application  backups  config  crontabs  logs  system

A container that isn't ready will look like this:

~/container$ ls
application  backups  config  crontabs  logs 

Supported Containers

In this case, you can navigate to the supervisord.conf file in the /container/config directory. Open it in a text editor.

$ nano /container/config/supervisord.conf

You will then need to replace all instances of the /var/run/supervisor.sock line with /container/system/run/supervisor.sock. Simply restart your container after saving the file to apply the new config file.

If you are still having trouble with your container, please contact our support team for assistance. We will be able to assist you in figuring out what went wrong.

Image Upgrade

If you have recently upgraded your container to a version of PHP that supports this feature, your container may not be functioning properly.

This is because your container is not setup to use the new supervisord feature. To fix this, you will need to update your container's configuration files to use the previous file paths until your container has been upgraded.

If you SSH with a user linked to your container, you can navigate to the /container/config folder. Inside this folder is a file called supervisord.conf.

Once you have located it, open the file up in a text editor.

$ nano /container/config/supervisord.conf

You will then need to replace all instances of the /container/system/run/supervisor.sock line with /var/run/supervisor.sock. Simply restart your container after saving the file to apply the new config file.

If you are still having trouble with your container, please contact our support team for assistance. We will be able to assist you in figuring out what went wrong.