README.rdoc
= VGH Scripts
{<img src="https://secure.travis-ci.org/vladgh/vgh.png" alt="Build Status" />}[http://travis-ci.org/vladgh/vgh]
{<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/vladgh/vgh]
A collection of custom scripts used on VladGh.com
_**This project is no longer maintained**.
Thank you all for using and contributing to this project.
It will be left here for a while, so please feel free so fork this repository and to improve it as you see fit._
== Instalation
Some system wide dependencies should be installed first:
* ruby 1.8 or 1.9
* rubygems (if ruby 1.8)
* ruby-dev
* build-essential
* libxslt & libxslt-dev
* libxml2 & libxml2-dev
Add this line to your application's Gemfile:
gem 'vgh'
And then execute:
$ bundle
Or install it yourself as:
$ gem install vgh
== Configuration
This gem looks for the configuration file inside the following folders
* +/etc/vgh+
* +~/.vgh+
* +--confdir+ (specified in the command line options)
This gem checks if the file exists and if it is in a correct YAML format.
It should have the following format (where the keys are symbols):
# Comment
:key: 'value'
:string: 'string value'
:integer: 123
:boolean: true/false
:array:
- '1st'
- '2nd'
:hash:
-
:sub_key: 'sub value'
An example of the configuration file can be found in this gem's directory.
You can copy it by using the +--example=PATH+ command line option.
Ex: <tt>mkdir /etc/vgh
vgh --example=/etc/vgh</tt>
Read the config.yml.example for a list of configuration options.
== Command line options
The following command line options are available:
[+ApplicationName+] Specify the application you want to run. For a
list of available apps see
{file:README.rdoc#Applications Applications} below.
[<tt>--confdir=~/.vgh</tt>] Specify the desired directory in which
the configuration files reside.
[+-v+ <tt>--[no-]verbose</tt>] Specify whether to display messages on the
screen or not.
[+-l+ <tt>--[no-]logging</tt>] Specify whether to log messages or not.
[+-g+ +--gemdir+] Gem files location.
[+-h+ +--help+] Displays this list.
[+-V+ +--version+] Displays the version number.
== Applications
=== EC2-Backup
[/bin/vgh ec2-backup]
==== Description
This app creates a snapshot of the attached EBS volumes. It also deletes
snapshots older than the expiration period specified in the configuration
file. It is intended to be used as a cron job on an AWS instance running
Ubuntu.
You can also backup a remote instance, if you specify an +:instance+ or
+fqdn+ value in the configuration file. But if you do so, you loose the
ability to suspend MySQL or Logical Volumes.
If a MySQL server is running, and the script has access to the administrator
credentials, then it closes all open tables and locks all tables for all
databases with a global read lock. Everything is unlocked at the end of the
script even if errors occur during the snapshot process. <em>You need to
provide the necessary mysql credentials in the +ec2-backup.config.yml+ file.
</em>
If Logical Volumes are found on the system then they are suspended for the
duration on the snapshot process.
Suspending a volume becomes useful if you want for example a consistent
EC2 snapshot of it. Any I/O that has already been mapped by the device but
has not yet completed will be flushed. Any further I/O to that device will
be postponed for as long as the device is suspended.
==== Intended usage
# Cron Job:
0 */6 * * * vgh ec2-backup -l
=== Checkpoint
[/bin/vgh checkpoint]
==== Description
This app looks for volumes tagged with the 'CHECKPOINT' key attached to the
current instance, and creates snapshots for them.
It is intended to be used as a cron job on an AWS instance running
Ubuntu.
MySQL flushing and LVM suspending specified above in the EC2-Backup app, work
the same.
==== Intended usage
# Cron Job:
0 */6 * * * vgh checkpoint -l
== Contributing
1. Fork it
2. Create your feature branch (<tt>git checkout -b my-new-feature</tt>)
3. Commit your changes (<tt>git commit -am 'Add some feature'</tt>)
4. Push to the branch (<tt>git push origin my-new-feature</tt>)
5. Create new Pull Request
({http://help.github.com/articles/using-pull-requests Using Pull Requests})
== License
See {file:LICENSE LICENSE}
== Changelog
See {file:CHANGELOG.rdoc CHANGELOG}