crazycode-cap-recipes 0.3.37
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.textile +586 -0
- data/Rakefile +57 -0
- data/VERSION.yml +5 -0
- data/bin/cap-recipes +4 -0
- data/cap-recipes.gemspec +128 -0
- data/examples/advanced/deploy.rb +39 -0
- data/examples/advanced/deploy/experimental.rb +14 -0
- data/examples/advanced/deploy/production.rb +20 -0
- data/examples/simple/deploy.rb +36 -0
- data/lib/cap_recipes.rb +1 -0
- data/lib/cap_recipes/tasks/apache.rb +1 -0
- data/lib/cap_recipes/tasks/apache/install.rb +16 -0
- data/lib/cap_recipes/tasks/apache/manage.rb +26 -0
- data/lib/cap_recipes/tasks/aptitude.rb +1 -0
- data/lib/cap_recipes/tasks/aptitude/manage.rb +32 -0
- data/lib/cap_recipes/tasks/backgroundrb.rb +1 -0
- data/lib/cap_recipes/tasks/backgroundrb/hooks.rb +5 -0
- data/lib/cap_recipes/tasks/backgroundrb/manage.rb +64 -0
- data/lib/cap_recipes/tasks/bundler.rb +1 -0
- data/lib/cap_recipes/tasks/bundler/manage.rb +31 -0
- data/lib/cap_recipes/tasks/delayed_job.rb +1 -0
- data/lib/cap_recipes/tasks/delayed_job/hooks.rb +5 -0
- data/lib/cap_recipes/tasks/delayed_job/manage.rb +34 -0
- data/lib/cap_recipes/tasks/ec2/install.rb +32 -0
- data/lib/cap_recipes/tasks/ec2/manage.rb +32 -0
- data/lib/cap_recipes/tasks/gitosis.rb +1 -0
- data/lib/cap_recipes/tasks/gitosis/install.rb +58 -0
- data/lib/cap_recipes/tasks/gitosis/manage.rb +3 -0
- data/lib/cap_recipes/tasks/hudson.rb +1 -0
- data/lib/cap_recipes/tasks/hudson/manage.rb +33 -0
- data/lib/cap_recipes/tasks/jetty.rb +1 -0
- data/lib/cap_recipes/tasks/jetty/install.rb +33 -0
- data/lib/cap_recipes/tasks/jetty/manage.rb +34 -0
- data/lib/cap_recipes/tasks/jetty/web.rb +98 -0
- data/lib/cap_recipes/tasks/juggernaut.rb +3 -0
- data/lib/cap_recipes/tasks/juggernaut/hooks.rb +4 -0
- data/lib/cap_recipes/tasks/juggernaut/manage.rb +56 -0
- data/lib/cap_recipes/tasks/maven.rb +85 -0
- data/lib/cap_recipes/tasks/memcache.rb +3 -0
- data/lib/cap_recipes/tasks/memcache/hooks.rb +5 -0
- data/lib/cap_recipes/tasks/memcache/install.rb +15 -0
- data/lib/cap_recipes/tasks/memcache/manage.rb +37 -0
- data/lib/cap_recipes/tasks/mongodb.rb +1 -0
- data/lib/cap_recipes/tasks/mongodb/install.rb +137 -0
- data/lib/cap_recipes/tasks/mongodb/manage.rb +27 -0
- data/lib/cap_recipes/tasks/passenger.rb +1 -0
- data/lib/cap_recipes/tasks/passenger/install.rb +72 -0
- data/lib/cap_recipes/tasks/passenger/manage.rb +23 -0
- data/lib/cap_recipes/tasks/rails.rb +1 -0
- data/lib/cap_recipes/tasks/rails/hooks.rb +6 -0
- data/lib/cap_recipes/tasks/rails/manage.rb +51 -0
- data/lib/cap_recipes/tasks/ruby.rb +1 -0
- data/lib/cap_recipes/tasks/ruby/install.rb +16 -0
- data/lib/cap_recipes/tasks/rubygems.rb +1 -0
- data/lib/cap_recipes/tasks/rubygems/install.rb +22 -0
- data/lib/cap_recipes/tasks/rubygems/manage.rb +43 -0
- data/lib/cap_recipes/tasks/templates/hudson.erb +85 -0
- data/lib/cap_recipes/tasks/templates/mongod.conf.erb +89 -0
- data/lib/cap_recipes/tasks/templates/mongodb.init.erb +73 -0
- data/lib/cap_recipes/tasks/templates/mongodb.repo.erb +4 -0
- data/lib/cap_recipes/tasks/templates/mongos.init.erb +69 -0
- data/lib/cap_recipes/tasks/templates/tomcat.erb +95 -0
- data/lib/cap_recipes/tasks/thinking_sphinx.rb +1 -0
- data/lib/cap_recipes/tasks/thinking_sphinx/hooks.rb +4 -0
- data/lib/cap_recipes/tasks/thinking_sphinx/install.rb +17 -0
- data/lib/cap_recipes/tasks/thinking_sphinx/manage.rb +65 -0
- data/lib/cap_recipes/tasks/tomcat.rb +1 -0
- data/lib/cap_recipes/tasks/tomcat/install.rb +43 -0
- data/lib/cap_recipes/tasks/tomcat/manage.rb +34 -0
- data/lib/cap_recipes/tasks/tomcat/war.rb +98 -0
- data/lib/cap_recipes/tasks/utilities.rb +172 -0
- data/lib/cap_recipes/tasks/whenever.rb +1 -0
- data/lib/cap_recipes/tasks/whenever/hooks.rb +5 -0
- data/lib/cap_recipes/tasks/whenever/manage.rb +8 -0
- data/lib/cap_recipes/tasks/yum.rb +1 -0
- data/lib/cap_recipes/tasks/yum/manage.rb +30 -0
- data/lib/capify.rb +35 -0
- data/lib/templates/Capfile.tt +4 -0
- data/lib/templates/deploy.rb.tt +30 -0
- data/spec/cap/all/Capfile +2 -0
- data/spec/cap/helper.rb +3 -0
- data/spec/cap_recipes_spec.rb +56 -0
- data/spec/spec_helper.rb +37 -0
- data/specs.watchr +35 -0
- metadata +155 -0
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
=begin
|
2
|
+
Using Jeweler for Gem Packaging...
|
3
|
+
|
4
|
+
* Update the version and release version to github:
|
5
|
+
$ rake version:bump:patch && rake release && rake gemcutter:release
|
6
|
+
|
7
|
+
* Build and install the latest version locally:
|
8
|
+
$ rake install
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'rake'
|
13
|
+
require 'rake/testtask'
|
14
|
+
require 'rake/rdoctask'
|
15
|
+
|
16
|
+
begin
|
17
|
+
require 'jeweler'
|
18
|
+
Jeweler::Tasks.new do |s|
|
19
|
+
s.name = "crazycode-cap-recipes"
|
20
|
+
s.summary = %Q{Battle-tested capistrano recipes for passenger, delayed_job, and more}
|
21
|
+
s.email = "crazycode@gmail.com"
|
22
|
+
s.homepage = "http://github.com/crazycode/cap-recipes"
|
23
|
+
s.description = "Battle-tested capistrano recipes for debian, passenger, apache, hudson, delayed_job, juggernaut, rubygems, backgroundrb, rails and more"
|
24
|
+
s.authors = ["crazycode"]
|
25
|
+
s.rubyforge_project = 'crazycode-cap-recipes'
|
26
|
+
end
|
27
|
+
Jeweler::GemcutterTasks.new
|
28
|
+
rescue LoadError
|
29
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
30
|
+
end
|
31
|
+
|
32
|
+
Rake::RDocTask.new do |rdoc|
|
33
|
+
rdoc.rdoc_dir = 'rdoc'
|
34
|
+
rdoc.title = 'crazycode-cap-recipes'
|
35
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
36
|
+
rdoc.rdoc_files.include('README*')
|
37
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
require 'rcov/rcovtask'
|
42
|
+
Rcov::RcovTask.new do |t|
|
43
|
+
t.libs << 'test'
|
44
|
+
t.test_files = FileList['test/**/*_test.rb']
|
45
|
+
t.verbose = true
|
46
|
+
end
|
47
|
+
rescue LoadError
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Run all specs in spec directory"
|
51
|
+
task :spec do |t|
|
52
|
+
options = "--colour --format progress --loadby --reverse"
|
53
|
+
files = FileList['spec/**/*_spec.rb']
|
54
|
+
system("spec #{options} #{files}")
|
55
|
+
end
|
56
|
+
|
57
|
+
task :default => :spec
|
data/VERSION.yml
ADDED
data/bin/cap-recipes
ADDED
data/cap-recipes.gemspec
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{cap-recipes}
|
8
|
+
s.version = "0.3.36"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Nathan Esquenazi"]
|
12
|
+
s.date = %q{2010-10-12}
|
13
|
+
s.default_executable = %q{cap-recipes}
|
14
|
+
s.description = %q{Battle-tested capistrano recipes for debian, passenger, apache, delayed_job, juggernaut, rubygems, backgroundrb, rails and more}
|
15
|
+
s.email = %q{nesquena@gmail.com}
|
16
|
+
s.executables = ["cap-recipes"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.textile"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".gitignore",
|
23
|
+
"LICENSE",
|
24
|
+
"README.textile",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION.yml",
|
27
|
+
"bin/cap-recipes",
|
28
|
+
"cap-recipes.gemspec",
|
29
|
+
"examples/advanced/deploy.rb",
|
30
|
+
"examples/advanced/deploy/experimental.rb",
|
31
|
+
"examples/advanced/deploy/production.rb",
|
32
|
+
"examples/simple/deploy.rb",
|
33
|
+
"lib/cap_recipes.rb",
|
34
|
+
"lib/cap_recipes/tasks/apache.rb",
|
35
|
+
"lib/cap_recipes/tasks/apache/install.rb",
|
36
|
+
"lib/cap_recipes/tasks/apache/manage.rb",
|
37
|
+
"lib/cap_recipes/tasks/aptitude.rb",
|
38
|
+
"lib/cap_recipes/tasks/aptitude/manage.rb",
|
39
|
+
"lib/cap_recipes/tasks/backgroundrb.rb",
|
40
|
+
"lib/cap_recipes/tasks/backgroundrb/hooks.rb",
|
41
|
+
"lib/cap_recipes/tasks/backgroundrb/manage.rb",
|
42
|
+
"lib/cap_recipes/tasks/bundler.rb",
|
43
|
+
"lib/cap_recipes/tasks/bundler/manage.rb",
|
44
|
+
"lib/cap_recipes/tasks/delayed_job.rb",
|
45
|
+
"lib/cap_recipes/tasks/delayed_job/hooks.rb",
|
46
|
+
"lib/cap_recipes/tasks/delayed_job/manage.rb",
|
47
|
+
"lib/cap_recipes/tasks/ec2/install.rb",
|
48
|
+
"lib/cap_recipes/tasks/ec2/manage.rb",
|
49
|
+
"lib/cap_recipes/tasks/gitosis.rb",
|
50
|
+
"lib/cap_recipes/tasks/gitosis/install.rb",
|
51
|
+
"lib/cap_recipes/tasks/gitosis/manage.rb",
|
52
|
+
"lib/cap_recipes/tasks/jetty.rb",
|
53
|
+
"lib/cap_recipes/tasks/jetty/install.rb",
|
54
|
+
"lib/cap_recipes/tasks/jetty/manage.rb",
|
55
|
+
"lib/cap_recipes/tasks/jetty/web.rb",
|
56
|
+
"lib/cap_recipes/tasks/juggernaut.rb",
|
57
|
+
"lib/cap_recipes/tasks/juggernaut/hooks.rb",
|
58
|
+
"lib/cap_recipes/tasks/juggernaut/manage.rb",
|
59
|
+
"lib/cap_recipes/tasks/maven.rb",
|
60
|
+
"lib/cap_recipes/tasks/memcache.rb",
|
61
|
+
"lib/cap_recipes/tasks/memcache/hooks.rb",
|
62
|
+
"lib/cap_recipes/tasks/memcache/install.rb",
|
63
|
+
"lib/cap_recipes/tasks/memcache/manage.rb",
|
64
|
+
"lib/cap_recipes/tasks/mongodb.rb",
|
65
|
+
"lib/cap_recipes/tasks/mongodb/install.rb",
|
66
|
+
"lib/cap_recipes/tasks/mongodb/manage.rb",
|
67
|
+
"lib/cap_recipes/tasks/passenger.rb",
|
68
|
+
"lib/cap_recipes/tasks/passenger/install.rb",
|
69
|
+
"lib/cap_recipes/tasks/passenger/manage.rb",
|
70
|
+
"lib/cap_recipes/tasks/rails.rb",
|
71
|
+
"lib/cap_recipes/tasks/rails/hooks.rb",
|
72
|
+
"lib/cap_recipes/tasks/rails/manage.rb",
|
73
|
+
"lib/cap_recipes/tasks/ruby.rb",
|
74
|
+
"lib/cap_recipes/tasks/ruby/install.rb",
|
75
|
+
"lib/cap_recipes/tasks/rubygems.rb",
|
76
|
+
"lib/cap_recipes/tasks/rubygems/install.rb",
|
77
|
+
"lib/cap_recipes/tasks/rubygems/manage.rb",
|
78
|
+
"lib/cap_recipes/tasks/templates/tomcat.erb",
|
79
|
+
"lib/cap_recipes/tasks/thinking_sphinx.rb",
|
80
|
+
"lib/cap_recipes/tasks/thinking_sphinx/hooks.rb",
|
81
|
+
"lib/cap_recipes/tasks/thinking_sphinx/install.rb",
|
82
|
+
"lib/cap_recipes/tasks/thinking_sphinx/manage.rb",
|
83
|
+
"lib/cap_recipes/tasks/tomcat.rb",
|
84
|
+
"lib/cap_recipes/tasks/tomcat/install.rb",
|
85
|
+
"lib/cap_recipes/tasks/tomcat/manage.rb",
|
86
|
+
"lib/cap_recipes/tasks/tomcat/war.rb",
|
87
|
+
"lib/cap_recipes/tasks/utilities.rb",
|
88
|
+
"lib/cap_recipes/tasks/whenever.rb",
|
89
|
+
"lib/cap_recipes/tasks/whenever/hooks.rb",
|
90
|
+
"lib/cap_recipes/tasks/whenever/manage.rb",
|
91
|
+
"lib/cap_recipes/tasks/yum.rb",
|
92
|
+
"lib/cap_recipes/tasks/yum/manage.rb",
|
93
|
+
"lib/capify.rb",
|
94
|
+
"lib/templates/Capfile.tt",
|
95
|
+
"lib/templates/deploy.rb.tt",
|
96
|
+
"spec/cap/all/Capfile",
|
97
|
+
"spec/cap/helper.rb",
|
98
|
+
"spec/cap_recipes_spec.rb",
|
99
|
+
"spec/spec_helper.rb",
|
100
|
+
"specs.watchr"
|
101
|
+
]
|
102
|
+
s.homepage = %q{http://github.com/nesquena/cap-recipes}
|
103
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
104
|
+
s.require_paths = ["lib"]
|
105
|
+
s.rubyforge_project = %q{cap-recipes}
|
106
|
+
s.rubygems_version = %q{1.3.7}
|
107
|
+
s.summary = %q{Battle-tested capistrano recipes for passenger, delayed_job, and more}
|
108
|
+
s.test_files = [
|
109
|
+
"spec/cap_recipes_spec.rb",
|
110
|
+
"spec/spec_helper.rb",
|
111
|
+
"spec/cap/helper.rb",
|
112
|
+
"examples/advanced/deploy/production.rb",
|
113
|
+
"examples/advanced/deploy/experimental.rb",
|
114
|
+
"examples/advanced/deploy.rb",
|
115
|
+
"examples/simple/deploy.rb"
|
116
|
+
]
|
117
|
+
|
118
|
+
if s.respond_to? :specification_version then
|
119
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
120
|
+
s.specification_version = 3
|
121
|
+
|
122
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
123
|
+
else
|
124
|
+
end
|
125
|
+
else
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# =============================================================================
|
2
|
+
# GENERAL SETTINGS
|
3
|
+
# =============================================================================
|
4
|
+
|
5
|
+
set :application, "demo"
|
6
|
+
set :deploy_to, "/var/apps/#{application}"
|
7
|
+
set :deploy_via, :remote_cache
|
8
|
+
set :scm, :git
|
9
|
+
set :repository, "deploy@dev.demo.com:/home/demo.git"
|
10
|
+
set :git_enable_submodules, 1
|
11
|
+
set :keep_releases, 3
|
12
|
+
|
13
|
+
# =============================================================================
|
14
|
+
# STAGE SETTINGS
|
15
|
+
# =============================================================================
|
16
|
+
|
17
|
+
# set :default_stage, "experimental"
|
18
|
+
set :stages, %w(production experimental)
|
19
|
+
set :default_stage, "experimental"
|
20
|
+
require 'capistrano/ext/multistage'
|
21
|
+
|
22
|
+
# =============================================================================
|
23
|
+
# RECIPE INCLUDES
|
24
|
+
# =============================================================================
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'cap_recipes/tasks/whenever'
|
28
|
+
require 'cap_recipes/tasks/apache'
|
29
|
+
require 'cap_recipes/tasks/passenger'
|
30
|
+
require 'cap_recipes/tasks/memcache'
|
31
|
+
require 'cap_recipes/tasks/juggernaut'
|
32
|
+
require 'cap_recipes/tasks/delayed_job'
|
33
|
+
require 'cap_recipes/tasks/rails'
|
34
|
+
|
35
|
+
ssh_options[:paranoid] = false
|
36
|
+
default_run_options[:pty] = true
|
37
|
+
|
38
|
+
# PASSENGER
|
39
|
+
set :base_ruby_path, '/opt/ruby-enterprise' # not /usr
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Domain
|
2
|
+
role :web, "stage.app.com"
|
3
|
+
role :app, "stage.app.com"
|
4
|
+
role :db, "stage.app.com", :primary => true
|
5
|
+
|
6
|
+
# GENERAL
|
7
|
+
set :user, "deploy"
|
8
|
+
set :runner, "deploy"
|
9
|
+
set :password, "demo567"
|
10
|
+
set :use_sudo, true
|
11
|
+
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "demo")]
|
12
|
+
|
13
|
+
# Branch
|
14
|
+
set :branch, 'develop'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Domain
|
2
|
+
role :web, "demo.app.com"
|
3
|
+
role :app, "demo.app.com"
|
4
|
+
role :db, "demo.app.com", :primary => true
|
5
|
+
role :juggernaut, "juggernaut.app.com", :no_release => true
|
6
|
+
role :delayed_job, "dj.app.com", :no_release => true
|
7
|
+
role :memcache, "memcache.app.com", :no_release => true
|
8
|
+
|
9
|
+
# GENERAL
|
10
|
+
set :user, "deploy"
|
11
|
+
set :runner, "deploy"
|
12
|
+
set :password, "demo567"
|
13
|
+
set :use_sudo, true
|
14
|
+
set :juggernaut_role, :juggernaut
|
15
|
+
set :delayed_job_role, :delayed_job
|
16
|
+
set :memcache_role, :memcache
|
17
|
+
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "demo")]
|
18
|
+
|
19
|
+
# Branch
|
20
|
+
set :branch, 'master'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# =============================================================================
|
2
|
+
# GENERAL SETTINGS
|
3
|
+
# =============================================================================
|
4
|
+
|
5
|
+
role :web, "demo.app.com"
|
6
|
+
role :app, "demo.app.com"
|
7
|
+
role :db, "demo.app.com", :primary => true
|
8
|
+
|
9
|
+
set :application, "demo"
|
10
|
+
set :deploy_to, "/var/apps/#{application}"
|
11
|
+
set :deploy_via, :remote_cache
|
12
|
+
set :scm, :git
|
13
|
+
set :repository, "deploy@dev.demo.com:/home/demo.git"
|
14
|
+
set :git_enable_submodules, 1
|
15
|
+
set :keep_releases, 3
|
16
|
+
set :user, "deploy"
|
17
|
+
set :runner, "deploy"
|
18
|
+
set :password, "demo567"
|
19
|
+
set :use_sudo, true
|
20
|
+
set :branch, 'production'
|
21
|
+
|
22
|
+
# =============================================================================
|
23
|
+
# RECIPE INCLUDES
|
24
|
+
# =============================================================================
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'cap_recipes/tasks/whenever'
|
28
|
+
require 'cap_recipes/tasks/apache'
|
29
|
+
require 'cap_recipes/tasks/passenger'
|
30
|
+
require 'cap_recipes/tasks/memcache'
|
31
|
+
require 'cap_recipes/tasks/juggernaut'
|
32
|
+
require 'cap_recipes/tasks/delayed_job'
|
33
|
+
require 'cap_recipes/tasks/rails'
|
34
|
+
|
35
|
+
ssh_options[:paranoid] = false
|
36
|
+
default_run_options[:pty] = true
|
data/lib/cap_recipes.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.join(File.dirname(__FILE__), 'cap_recipes/tasks/*.rb')].sort.each { |lib| require lib }
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.join(File.dirname(__FILE__), 'apache/*.rb')].sort.each { |lib| require lib }
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../utilities')
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance(true).load do
|
4
|
+
|
5
|
+
namespace :apache do
|
6
|
+
|
7
|
+
desc 'Installs apache 2 and development headers to compile passenger'
|
8
|
+
task :install, :roles => :web do
|
9
|
+
puts 'Installing apache 2'
|
10
|
+
utilities.apt_install %w[apache2 apache2.2-common apache2-mpm-prefork apache2-utils
|
11
|
+
libexpat1 ssl-cert libapr1 libapr1-dev libaprutil1 libmagic1
|
12
|
+
libpcre3 libpq5 openssl apache2-prefork-dev]
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Capistrano::Configuration.instance(true).load do
|
2
|
+
|
3
|
+
set :apache_init_path, "/etc/init.d/apache2"
|
4
|
+
|
5
|
+
namespace :apache do
|
6
|
+
|
7
|
+
desc "Stops the apache web server"
|
8
|
+
task :stop, :roles => :web do
|
9
|
+
puts "Stopping the apache server"
|
10
|
+
sudo "#{apache_init_path} stop"
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Starts the apache web server"
|
14
|
+
task :start, :roles => :web do
|
15
|
+
puts "Starting the apache server"
|
16
|
+
sudo "#{apache_init_path} start"
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Restarts the apache web server"
|
20
|
+
task :restart, :roles => :web do
|
21
|
+
puts "Restarting the apache server"
|
22
|
+
sudo "#{apache_init_path} restart"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.join(File.dirname(__FILE__), 'aptitude/*.rb')].sort.each { |lib| require lib }
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../utilities')
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance(true).load do
|
4
|
+
namespace :aptitude do
|
5
|
+
desc "Updates all installed packages on aptitude package system"
|
6
|
+
task :updates do
|
7
|
+
sudo "apt-get -qy update"
|
8
|
+
utilities.apt_upgrade
|
9
|
+
sudo "apt-get -qy autoremove"
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Installs a specified aptitude package"
|
13
|
+
task :install do
|
14
|
+
deb_pkg_name = utilities.ask "Enter name of the package(s) you wish to install:"
|
15
|
+
raise "Please specify deb_pkg_name" if deb_pkg_name == ''
|
16
|
+
logger.info "Updating packages..."
|
17
|
+
sudo "aptitude update"
|
18
|
+
logger.info "Installing #{deb_pkg_name}..."
|
19
|
+
utilities.apt_install deb_pkg_name
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Removes a specified aptitude package"
|
23
|
+
task :remove do
|
24
|
+
deb_pkg_name = utilities.ask "Enter name of the package(s) you wish to remove:"
|
25
|
+
raise "Please specify deb_pkg_name" if deb_pkg_name == ''
|
26
|
+
logger.info "Updating packages..."
|
27
|
+
sudo "aptitude update"
|
28
|
+
logger.info "Removing #{deb_pkg_name}..."
|
29
|
+
utilities.sudo_with_input "apt-get remove --purge #{deb_pkg_name}", /^Do you want to continue\?/
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.join(File.dirname(__FILE__), 'backgroundrb/*.rb')].sort.each { |lib| require lib }
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance(true).load do
|
4
|
+
set :backgroundrb_host, 'localhost'
|
5
|
+
set :backgroundrb_env , 'production'
|
6
|
+
set :base_ruby_path, '/usr'
|
7
|
+
|
8
|
+
namespace :backgroundrb do
|
9
|
+
# ===============================================================
|
10
|
+
# PROCESS MANAGEMENT
|
11
|
+
# ===============================================================
|
12
|
+
|
13
|
+
desc "Stops the backgroundrb worker processes"
|
14
|
+
task :stop, :roles => :app do
|
15
|
+
run "cd #{current_path} && #{sudo} #{base_ruby_path}/bin/ruby script/backgroundrb stop"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Starts the backgroundrb worker processes"
|
19
|
+
task :start, :roles => :app do
|
20
|
+
run "cd #{current_path} && #{sudo} nohup #{base_ruby_path}/bin/ruby script/backgroundrb start"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Restarts a running backgroundrb server."
|
24
|
+
task :restart, :roles => :app do
|
25
|
+
backgroundrb.stop
|
26
|
+
sleep(5) # sleep for 5 seconds to make sure the server has mopped up everything
|
27
|
+
backgroundrb.start
|
28
|
+
end
|
29
|
+
|
30
|
+
# ===============================================================
|
31
|
+
# PROCESS CONFIGURATION
|
32
|
+
# ===============================================================
|
33
|
+
|
34
|
+
desc "Creates configuration file for the backgroundrb server"
|
35
|
+
task :configure, :roles => :app do
|
36
|
+
config = { :backgroundrb => {:ip => backgroundrb_host, :port => backgroundrb_port, :environment => backgroundrb_env} }
|
37
|
+
backgroundrb_yml = config.to_yaml
|
38
|
+
|
39
|
+
run "if [ ! -d #{shared_path}/config ]; then mkdir #{shared_path}/config; fi"
|
40
|
+
put(backgroundrb_yml, "#{shared_path}/config/backgroundrb.yml", :mode => 0644)
|
41
|
+
end
|
42
|
+
|
43
|
+
# ===============================================================
|
44
|
+
# FILE MANAGEMENT
|
45
|
+
# ===============================================================
|
46
|
+
|
47
|
+
desc "Symlinks the shared/config/backgroundrb yaml to release/config/"
|
48
|
+
task :symlink_config, :roles => :app do
|
49
|
+
run "ln -s #{shared_path}/config/backgroundrb.yml #{release_path}/config/backgroundrb.yml"
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Displays the backgroundrb log from the server"
|
53
|
+
task :tail do
|
54
|
+
stream "tail -f #{shared_path}/log/backgroundrb_#{backgroundrb_port}.log"
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Repair permissions to allow user to perform all actions"
|
58
|
+
task :repair_permissions, :roles => :app do
|
59
|
+
puts "Applying correct permissions to allow for proper command execution"
|
60
|
+
try_sudo "chown -R #{user}:#{user} #{current_path}"
|
61
|
+
try_sudo "chown -R #{user}:#{user} #{current_path}/tmp"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|