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._
Some system wide dependencies should be installed first:
ruby 1.8 or 1.9
rubygems (if ruby 1.8)
libxslt & libxslt-dev
libxml2 & libxml2-dev
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install vgh
This gem looks for the configuration file inside the following folders
--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: mkdir /etc/vgh vgh --example=/etc/vgh
Read the config.yml.example for a list of configuration options.
Command line options
The following command line options are available:
Specify the application you want to run. For a list of available apps see Applications below.
Specify the desired directory in which the configuration files reside.
- -v --[no-]verbose
Specify whether to display messages on the screen or not.
- -l --[no-]logging
Specify whether to log messages or not.
- -g --gemdir
Gem files location.
- -h --help
Displays this list.
- -V --version
Displays the version number.
- /bin/vgh ec2-backup
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. You need to provide the necessary mysql credentials in the ec2-backup.config.yml file.
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.
# Cron Job: 0 */6 * * * vgh ec2-backup -l
- /bin/vgh checkpoint
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.
# Cron Job: 0 */6 * * * vgh checkpoint -l
Create your feature branch (git checkout -b my-new-feature)
Commit your changes (git commit -am 'Add some feature')
Push to the branch (git push origin my-new-feature)
Create new Pull Request (Using Pull Requests)