site_backups alpha version released!

Alpha Version

PokeyHost v0.1-alpha

The website backups utility is functioning in a limited capacity, there are few a still bugs to iron out but runs are succeeding without error and the results are as expected.

While I was intending to use the MySQLdb module to handle all database activities, I opted to use it instead only for the connectivity and diagnostic testing portion of the application.  When it comes to actually dumping the data, mysqldump is a simpler (and faster in some cases) solution.

The test database diagnostic section is as follows :

In a nutshell, the query list  mysql_tests = ["SELECT VERSION();","SHOW SESSION STATUS;","SHOW TABLES FROM {0};".format(test_db)] is executed over a MySQLdb connection to ensure credentials are valid and the database is accessible.  This is a stop-gap solution until a more definite diagnostic module can be constructed.  Ultimately, this tool will incorporate a pre- and post- backup diagnostics module with various warning conditions.  As it exists, there are only two diagnostics running.

  1. The MySQLdb-executed queries in the example
    • Test connectivity to the DB host
    • Test credential authentication
    • Ensure data is returned successfully
  2. The initial execution partition status check
    • Examines available space on the partition
      • Need to build out warnings and error states
    • Checks read and read/write status of the source and destination directories, respectively.
    • *Next release to contain destination space availability check

The output

There is a verbosity flag available,  [-v|--verbose] , which will enable long config, file, and database output during the run.  I invested a lot of effort into making sure adequate logging is in place, and I plan on expanding on this quite a bit in the refinement process.

The next release for this tool will contain a  [-f|--force] option in order to force continue when certain error conditions are met.

  1. A file cannot be added to the archive
    • This condition currently automatically continues
    • Once the force option is implemented the user will be presented with the option to cancel the operation
    • Current warning :
      • Could not add file "/home1/wnrmndn/pokeyhost/tools/tmp/wnrmndn_hgtools.sql" to the archive, continuing
  2. The database backup fails
    • The user is prompted with the option to proceed
    • Once the force option is implemented, input can be skipped
    • Current warning:
      • > Database backup failed! Proceed? (y=yes) :

There are several other prompts (like the test verbosity prompt, which adds even more output to the test run) which will ultimately be capable of being forced.

Testing Only

I’ve only tested the  [-t|--test] flag extensively for output at this point, two or three cursory runs with command-line passed path, database, and  destination arguments did complete successfully with the test datasets, but I haven’t played with the options or tried any gotcha type conditions.  Sample output:

 

Leave a Reply

Your email address will not be published. Required fields are marked *