the S2 deployment-engine

Buidling the gem

gem build depengine.gemspec

Usage

  1. rvm use 2.1.1
  2. bundle install
  3. bundle exec depengine

Running specs

To run the specs, your machine needs to fulfill some requirements:

  • mail_spec.rb: be able to send and receive mails on localhost (e.g. install postfix on linux and set it to "local only")
  • repository_spec.rb: be able to SSH into your own machine via public_key_auth (e.g. putting your .ssh/id_rsa_pub in your .ssh/authorized_keys)
  • zip_spec.rb: have a unzip programm installed (e.g. apt-get install zip)

There is a somewhat simplistic script to get a suitable environment up and running. Have a look at bin/spec_setup.

rspec

Documentation

To see a list of all currently supported methods in the DSL, run rake doc and browse to: doc/table_of_contents.html#methods

Example recipe

set :application_name,         "testapp"
set :module_name,              "testmodule"

set :cleanup_workspace_before, ["source", "tmp"]

set :log_level,                "INFO"
set :log_file,                 "deploy.log"
set :log_file_level,           "DEBUG"

Deployment.deliver do

  config = get_all_config_parameters
  $log.writer.info "Got config parameters from cdb"

  $log.writer.info "date_unique: #{date_unique}"

  config['test_app_hosts'].each do |test_app_host|
    $log.writer.info "doing something on #{test_app_host}"
    rsync("target/", "/srv/testapp/")
    remote_execute("export JAVA_HOME=/opt/java7; cd /srv/testapp/project_#{config['env'].downcase}/current/; . ./setantenv.sh; ant;", :remote_host => test_app_host)
  end

  report_by_mail
  $log.writer.info "Sent mail to deployment team #{config['deploy_email_to']}"

  $log.writer.info "Deployment done!"
end