DESCRIPTION

Synchronize is designed to automate the ugly tasks of restoring database dumps and assets from s3 to our different environments.

INSTALL

Gemfile

Synchronize will be available to download as a gem in the downloads section.

Get Latest: https://github.com/downloads/bebanjo/synchronize/synchronize-0.1.1.gem

From source

git clone git@github.com:bebanjo/synchronize.git
cd synchronize
gem build synchronize.gemspec 
gem install synchronize-X.Y.Z.gem

Dependencies

  • Synchronize requires duplicity and python boto to restore files from s3, you can install both running synchronize dependencies. It only does work on mac and requires brew.

USAGE

Subcommands

Run synchronize followed by one of these sub-commands:

  • assets Synchronizes the assets to the system directory
  • check Perform a health check of system dependencies and environment variables required in order to run synchronize
  • db Synchronizes a database with the latest s3 dbdump.
  • db2disk Downloads the latest backup from s3 to local disk.
  • dependencies Installs the command line tools required for synchronize to work. Requires brew.
  • help Display global or [command] help documentation.

Environment variables, options and paths.

There are three of ways in which synchronize is able to get the information it needs to perform its tasks: trough command options, environment variables and knife. Command options has preference over knife, environment variables are always a last resource. Not all the information can be gathered trough knife (see below) so in these cases they should be present as options or environment variables. In any case the command helps you to find what you are missing. Run synchronize help to see every available option.

  • Synchronize assumes that you are sitting it in your RAILS_ROOT directory when you run it (if RAILS_ENV == development). In other RAILS_ENV situations (production, staging, preproduction) Synchronize assumes that the directory structure where the app is sitting is /home/APP_NAME/app/current. The command also accepts a RAILS_ROOT env variable. Alternatively you need to provide mysql credentials through command line options.
  • RAILS_ENV variable must be defined or --rails_env paramenter has to be used.
  • When using --knife parameter, synchronize assumes that there is chef data bag (already created in our chef server) set up with the following structure:
    [
     "buckets" : {
     "id": "buckets",
     "s3_backup_bucket": "VALUE"
     },
     "keys": {
     "aws_access_key_id": "VALUE",
     "id": "keys",
     "aws_secret_access_key": "VALUE"
     }
    ]
  • Alternatively you can set the following environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_BUCKET use the related command line options.
  • You can run synchronize check to know what's missing to run synchronize.

TODO / IMPROVEMENTS

  • Refactor code, at this moment synchronize does not use any classes.
  • Error parsing, output of some commands need to be parsed and synchronize the error output, also the verbosity of output on errors should be improved.