cap-recipes 0.3.33 → 0.3.34

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,7 @@ Currently included recipes in this gem:
22
22
  * Backgroundrb Server
23
23
  * DelayedJob Worker
24
24
  * Whenever Cron Scheduling
25
+ * MongoDB Management
25
26
  * Aptitude Package Management
26
27
  * Gitosis Git Repository Hosting
27
28
 
@@ -47,7 +48,8 @@ Then, include into your @deploy.rb@ configuration file for Capistrano:
47
48
  require 'cap_recipes/tasks/passenger'
48
49
  require 'cap_recipes/tasks/thinking_sphinx'
49
50
  require 'cap_recipes/tasks/rails'
50
- # or ruby, rubygems, apache, delayed_job, juggernaut, backgroundrb, aptitude, gitosis, whenever
51
+ require 'cap_recipes/tasks/delayed_job'
52
+ # or ruby, rubygems, apache, mongodb, juggernaut, backgroundrb, aptitude, gitosis, whenever
51
53
 
52
54
  # OR
53
55
  # only use managing tasks:
@@ -335,6 +337,28 @@ hooks.rb
335
337
  after "deploy:restart", "memcache:restart" # clear cache after updating code
336
338
  </code></pre>
337
339
 
340
+ h3. MongoDB
341
+
342
+ These recipes are for installing and managing the mongodb document-oriented database
343
+
344
+ h4. Configuration
345
+
346
+ * mongodb_data_path - the location to store the mongodb data [default: "/data/db"]
347
+ * mongodb_bin_path - the location to install mongodb [default: "/opt/mongo"]
348
+ * mongodb_log - the path to the mongodb log file [default: "/var/log/mongodb.log"]
349
+
350
+ h4. Tasks
351
+
352
+ install.rb
353
+
354
+ * mongodb:install - Performs the full installation of mongodb and dependencies
355
+
356
+ manage.rb
357
+
358
+ * mongodb:start - Starts the mongodb process
359
+ * mongodb:stop - Stops the mongodb process
360
+ * mongodb:restart - Restarts the mongodb process
361
+
338
362
  h3. Gitosis
339
363
 
340
364
  These recipes are for installing Gitosis Git Repository Hosting
@@ -465,7 +489,7 @@ h2. CONTRIBUTORS
465
489
  The following people are the reason this library exists:
466
490
 
467
491
  * nesquena [Nathan Esquenazi] - created and maintaining the library
468
- * achiu [Arthur Chiu] - contributed gitosis, ruby and other recipes
492
+ * achiu [Arthur Chiu] - contributed gitosis, ruby, mongodb and other recipes
469
493
  * hubertlepicki - contributed thinking_sphinx recipes
470
494
 
471
495
  h2. LICENSE
@@ -2,4 +2,4 @@
2
2
  :major: 0
3
3
  :minor: 3
4
4
  :build:
5
- :patch: 33
5
+ :patch: 34
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cap-recipes}
8
- s.version = "0.3.33"
8
+ s.version = "0.3.34"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Esquenazi"]
12
- s.date = %q{2009-10-22}
12
+ s.date = %q{2009-10-25}
13
13
  s.description = %q{Battle-tested capistrano recipes for debian, passenger, apache, delayed_job, juggernaut, rubygems, backgroundrb, rails and more}
14
14
  s.email = %q{nesquena@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -48,6 +48,9 @@ Gem::Specification.new do |s|
48
48
  "lib/cap_recipes/tasks/memcache/hooks.rb",
49
49
  "lib/cap_recipes/tasks/memcache/install.rb",
50
50
  "lib/cap_recipes/tasks/memcache/manage.rb",
51
+ "lib/cap_recipes/tasks/mongodb.rb",
52
+ "lib/cap_recipes/tasks/mongodb/install.rb",
53
+ "lib/cap_recipes/tasks/mongodb/manage.rb",
51
54
  "lib/cap_recipes/tasks/passenger.rb",
52
55
  "lib/cap_recipes/tasks/passenger/install.rb",
53
56
  "lib/cap_recipes/tasks/passenger/manage.rb",
@@ -0,0 +1 @@
1
+ Dir[File.join(File.dirname(__FILE__), 'mongodb/*.rb')].sort.each { |lib| require lib }
@@ -0,0 +1,39 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../utilities')
2
+ require File.expand_path(File.dirname(__FILE__) + '/manage')
3
+
4
+ Capistrano::Configuration.instance(true).load do
5
+ set :mongodb_data_path, "/data/db"
6
+ set :mongodb_bin_path, "/opt/mongo"
7
+
8
+ namespace :mongodb do
9
+ desc "Installs mongodb binaries and all dependencies"
10
+ task :install, :role => :app do
11
+ utilities.apt_install "tcsh scons g++ libpcre++-dev"
12
+ utilities.apt_install "libboost1.37-dev libreadline-dev xulrunner-dev"
13
+ mongodb.make_spidermonkey
14
+ mongodb.make_mongodb
15
+ mongodb.setup_db_path
16
+ end
17
+
18
+ task :make_spidermonkey, :role => :app do
19
+ run "mkdir -p ~/tmp"
20
+ run "cd ~/tmp; wget ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz"
21
+ run "cd ~/tmp; tar -zxvf js-1.7.0.tar.gz"
22
+ run "cd ~/tmp/js/src; export CFLAGS=\"-DJS_C_STRINGS_ARE_UTF8\""
23
+ run "cd ~/tmp/js/src; #{sudo} make -f Makefile.ref"
24
+ run "cd ~/tmp/js/src; #{sudo} JS_DIST=/usr make -f Makefile.ref export"
25
+ end
26
+
27
+ task :make_mongodb, :role => :app do
28
+ sudo "rm -rf ~/tmp/mongo"
29
+ run "cd ~/tmp; git clone git://github.com/mongodb/mongo.git"
30
+ run "cd ~/tmp/mongo; #{sudo} scons all"
31
+ run "cd ~/tmp/mongo; #{sudo} scons --prefix=#{mongodb_bin_path} install"
32
+ end
33
+
34
+ task :setup_db_path, :role => :app do
35
+ sudo "mkdir -p #{mongodb_path}"
36
+ mongodb.start
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../utilities')
2
+ require File.expand_path(File.dirname(__FILE__) + '/install')
3
+
4
+ Capistrano::Configuration.instance(true).load do
5
+ set :mongodb_log, "/var/log/mongodb.log"
6
+
7
+ namespace :mongodb do
8
+ desc "Starts the mongodb server"
9
+ task :start, :role => :app do
10
+ sudo "#{mongodb_bin_path}/bin/mongod --fork --logpath #{mongodb_log} --logappend --dbpath #{mongodb_path}"
11
+ end
12
+
13
+ desc "Stop the mongodb server"
14
+ task :stop, :role => :app do
15
+ pid = capture("ps -o pid,command ax | grep mongod | awk '!/awk/ && !/grep/ {print $1}'")
16
+ sudo "kill -2 #{pid}" unless pid.strip.empty?
17
+ end
18
+
19
+ desc "Restart the mongodb server"
20
+ task :restart, :role => :app do
21
+ pid = capture("ps -o pid,command ax | grep mongod | awk '!/awk/ && !/grep/ {print $1}'")
22
+ mongodb.stop unless pid.strip.empty?
23
+ mongodb.start
24
+ end
25
+
26
+ end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.33
4
+ version: 0.3.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Esquenazi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-22 00:00:00 -07:00
12
+ date: 2009-10-25 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -54,6 +54,9 @@ files:
54
54
  - lib/cap_recipes/tasks/memcache/hooks.rb
55
55
  - lib/cap_recipes/tasks/memcache/install.rb
56
56
  - lib/cap_recipes/tasks/memcache/manage.rb
57
+ - lib/cap_recipes/tasks/mongodb.rb
58
+ - lib/cap_recipes/tasks/mongodb/install.rb
59
+ - lib/cap_recipes/tasks/mongodb/manage.rb
57
60
  - lib/cap_recipes/tasks/passenger.rb
58
61
  - lib/cap_recipes/tasks/passenger/install.rb
59
62
  - lib/cap_recipes/tasks/passenger/manage.rb