Sha256: d3603f6fd8dcfabc8d7fef91ca458fc5e623c52d01cadb45a936bf2c12f480d4

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

namespace :rubber do
  
  namespace :mongodb do
    
    rubber.allow_optional_tasks(self)
    
    before "rubber:install_packages", "rubber:mongodb:setup_apt_sources"
  
    task :setup_apt_sources, :roles => :mongodb do
      # Setup apt sources to mongodb from 10gen
      sources = <<-SOURCES
        deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
      SOURCES
      sources.gsub!(/^[ \t]*/, '')
      put(sources, "/etc/apt/sources.list.d/mongodb.list") 
      rsudo "apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10"
    end

    after "rubber:bootstrap", "rubber:mongodb:bootstrap"

    task :bootstrap, :roles => :mongodb do
      exists = capture("echo $(ls #{rubber_env.mongodb_data_dir} 2> /dev/null)")
      if exists.strip.size == 0
        rubber.update_code_for_bootstrap
        rubber.run_config(:file => "role/mongodb/", :force => true, :deploy_path => release_path)

        restart
      end
    end
    
    desc <<-DESC
      Starts the mongodb daemon
    DESC
    task :start, :roles => :mongodb do
      rsudo "service mongodb status || service mongodb start"
    end
    
    desc <<-DESC
      Stops the mongodb daemon
    DESC
    task :stop, :roles => :mongodb do
      rsudo "service mongodb stop || true"
    end
    
    desc <<-DESC
      Restarts the mongodb daemon
    DESC
    task :restart, :roles => :mongodb do
      stop
      start
    end
    
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubber-2.2.4 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.2.3 templates/mongodb/config/rubber/deploy-mongodb.rb