Sha256: 64cc82c7a528d309a4a725c33e18b43c62599957f20319f63b15b353c614ff60

Contents?: true

Size: 1.38 KB

Versions: 17

Compression:

Stored size: 1.38 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 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

17 entries across 17 versions & 1 rubygems

Version Path
rubber-2.0.4 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.3 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.2 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.1 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre12 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre11 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre10 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre9 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre8 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre7 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre6 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre5 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre4 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre3 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre2 templates/mongodb/config/rubber/deploy-mongodb.rb
rubber-2.0.0.pre1 templates/mongodb/config/rubber/deploy-mongodb.rb