Monitoring our Go API server with Supervisord
It is fine that Nginx is sitting in front of our Go API server, it just proxies a port. However, sometimes that web application may stop due to the operating system restarting or crashing. Whenever your web server gets killed, it is someone's job to automatically bring it back to life. Supervisord is such a task runner. To make our API server run all the time, we need to monitor it. Supervisord is a tool that can monitor running processes (system) and can restart them when they were terminated.
Installing Supervisord
We can easily install Supervisord using Python’s pip
command. On Ubuntu 16.04, just use the apt-get
command:
sudo apt-get install -y supervisor
This installs two tools, supervisor
and supervisorctl
. Supervisorctl
is intended to control the supervisor and add tasks, restart tasks, and so on. Let us use the sample basicServre.go
program we created for illustrating Nginx for this too. Install the binary to the $GOPATH/bin
directory. Here...