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:
assetsSynchronizes the assets to the system directorycheckPerform a health check of system dependencies and environment variables required in order to run synchronizedbSynchronizes a database with the latest s3 dbdump.db2diskDownloads the latest backup from s3 to local disk.dependenciesInstalls the command line tools required for synchronize to work. Requires brew.helpDisplay 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_ROOTdirectory when you run it (if RAILS_ENV == development). In otherRAILS_ENVsituations (production,staging,preproduction) Synchronize assumes that the directory structure where the app is sitting is/home/APP_NAME/app/current. The command also accepts aRAILS_ROOTenv variable. Alternatively you need to provide mysql credentials through command line options. RAILS_ENVvariable must be defined or--rails_envparamenter has to be used.- When using
--knifeparameter, 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_KEYandAWS_BUCKETuse 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.