Keeping NancyFX running with Supervisor

I wanted to give the pi and my smart devices some time to collect some data, so I didn’t pay too much attention to it.  When I went back to it the query only returned a few rows (~70).  My log messages that I printed to the console were still there and I didn’t see any errors, so what the hell was going on?

Naively I restarted the Nancy server and waited again, and again.  You will start to see a theme in my posts.  After about the fourth time, I realized that my ssh session was closing and with it my Nancy instance.

To solve this problem I am going to install this sweet little application called Supervisor.  This is an application very similar to the Service Control Manager in windows.

Since I am using Raspbian, I need to first update my package lists and then run the install.

sudo apt-get update
sudo apt-get install supervisor

There are a number of options to change in the configuration file, but I will only detail the changes for my use case.  FYI,  I am following the instructions that are from the Supervisor website.  My needs require me to modify the [progam] section.  There is a bunch of properties that you can modify to customize the way that Supervisor will manage your application.

For some reason, I hit a snag in the installation that would not allow me to start the Supervisor service.  It seems like the service did not install correctly.  Luckily, I found this point on serverfault that gave the solution that fixed my issue.

aptitude -o DPkg::Options::='--force-confmiss' reinstall supervisor

Once that was fixed I was able to get my configuration set.


Now it is simply a matter of reloading the configuration and starting it up.

sudo supervisorctl

At this point, your application should be up and running. If it stops or the machine reboots, Supervisor will start it up.
Pretty Simple, Right?