Project

vgh

0.0
No release in over 3 years
Low commit activity in last 3 years
Vlad's custom scripts
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0
>= 0

Runtime

>= 1.6.6
>= 1.3.3
 Project Readme

VGH Scripts¶ ↑

<img src=“https://secure.travis-ci.org/vladgh/vgh.png” alt=“Build Status” /> <img src=“https://codeclimate.com/badge.png” />

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: 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:

ApplicationName

Specify the application you want to run. For a list of available apps see {file:README.rdoc#Applications Applications} below.

--confdir=~/.vgh

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.

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. 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.

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 (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request ({help.github.com/articles/using-pull-requests Using Pull Requests})

License¶ ↑

See {file:LICENSE LICENSE}

Changelog¶ ↑

See {file:CHANGELOG.rdoc CHANGELOG}