Skip to content

If a LEMP server stops for whatever reason, this does it's best to bring it back to life.

License

Notifications You must be signed in to change notification settings

vivithemage/defibrillator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Defibrillator

Overview

If an nginx server returns a non 200 code, this does it's best to bring it back to life.

LEMP stacks can sometimes return non 200 values such as 502 errors and this can occur for a variety of reasons. The purpose of this is to essentially try to get rid of the error and bring the server back to life until someone can investigate the issue further.

It works by installing a crontab that runs a script to check the server status. If a non 200 code is returned, nginx, mysql and php-fpm are restarted.

Usage

Install the necessary dependencies:

pip install -r requirements.txt

To install the crontab, replace the url with your own and run:

python install.py https://www.example.com

It's important this returns a 200 code. So if you put http://example.com and it comes up with a 301 redirect to www.example.com it's going to deem that as down and reboot the server.

Future enhancements

Initially the plan is to just to monitor the site and reboot nginx and php-fpm if it falls over. Some potential future enhancements would be to fix nginx/php-fpm configs automatically but it's just monitor and reboot for the moment.

About

If a LEMP server stops for whatever reason, this does it's best to bring it back to life.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages