Originally, I had intended for the PokeyHost project to be a sandbox environment on my shared hosting account. I wanted to write up some quick Python scripts that could be used to manage some aspects of my sites, including .htaccess directives, website backups, and other basic utility functions (resource usage warnings, attack mitigation, advanced-warning systems).
In working in web hosting, and through working on my own sites, I had run across some tools – mostly written in bash or perl – which were useful for managing sites and even entire server farms. Why not adapt these concepts into my own Python toolset for managing my sites, and learn something along the way? I realized a countless library of examples exists in popular hosting and server management suites to borrow ideas from.
Once the PokeyWorks framework became a part of my first tool in this suite – site_backups.py – I realized I had the start to a project that could offer me some excellent automation opportunities for common website maintenance functions. The idea of a cron-schedulable and easily customized application to pull site backups (keeping in mind a website usually equals files + databases) and store them in a conveniently-accessed form is very appealing.
As I brainstormed it became apparent some performance and resource usage alerts could easily be added, all configured using the PokeyWorks PokeyConfig class. I decided to come up with a suite of three core tools :
- site_backups.py – A flexible website backup utility integrating Database and File backups. Using the MySQLdb and tarfile Python modules, a database backup is taken, and with the website files archived with optional gzip or bzip2 compression. Can be executed remotely.
- site_monitors.py – A small but modularly-designed set of website monitors. Initial functionality ideas :
- e-mail bounceback detection, including a copy of the bounceback and headers sent to the monitor’s inbox (and stored locally in the event of an e-mail outage)
- website DNS monitoring, automated checks of domain resolution from remote locations for both propagation and early detection of DNS changes.
- automated process and other resource monitors, using the subprocess module.
- site_dashboard.py – A dashboard with information on all websites hosted, including on-demand (or streaming) updates on monitors, and an easy website backup scheduler.
The plan now becomes development and deployment of this core set of tools before focusing on features and enhancements, version control, and other application aspects.