openminds_deploy 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +58 -0
- data/Rakefile +15 -0
- data/VERSION +1 -0
- data/lib/openminds_deploy/defaults.rb +40 -0
- data/lib/openminds_deploy/git.rb +7 -0
- data/lib/openminds_deploy/lighttpd.rb +40 -0
- data/lib/openminds_deploy/passenger.rb +33 -0
- data/lib/openminds_deploy/rails3.rb +23 -0
- data/lib/openminds_deploy/svn.rb +6 -0
- data/lib/openminds_deploy.rb +0 -0
- data/openminds_deploy.gemspec +46 -0
- metadata +77 -0
data/README.rdoc
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
= Openminds Deploy Gem
|
2
|
+
|
3
|
+
This is a set of defaults for deploying to the Openminds shared hosting servers. These include our best practices for deployment, and should make a very clean Capfile.
|
4
|
+
|
5
|
+
== Available recipes
|
6
|
+
* openminds_deploy/defaults[link:openminds_deploy/defaults.rb] - Defaults for every deployment.
|
7
|
+
* openminds_deploy/git[link:openminds_deploy/git.rb] - for deploying with git.
|
8
|
+
* openminds_deploy/svn[link:openminds_deploy/svn.rb] - for deploying with SVN.
|
9
|
+
* openminds_deploy/passenger[link:openminds_deploy/passenger.rb] - for deploying to a passenger account (zink, pro-004, pro-005, pro-006)
|
10
|
+
* openminds_deploy/lighttpd[link:openminds_deploy/lighttpd.rb] - for deploying to a lighttpd account (zuurstof, kobalt, koper)
|
11
|
+
|
12
|
+
== Example recipe
|
13
|
+
|
14
|
+
In this recipe we just set-up our user & application-name, the repository (git in this case) where our application can be found, the server we are deploying to, and require the necesarry deployment files.
|
15
|
+
|
16
|
+
The block around it is a conveniece rescue if someone would deploy with this Capfile that doesn't have this gem installed. The require's can be edited like you need.
|
17
|
+
|
18
|
+
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
19
|
+
|
20
|
+
set :user, "account_name"
|
21
|
+
set :application, "my_application"
|
22
|
+
|
23
|
+
set :repository, "git@server.openminds.be:git/my_application.git"
|
24
|
+
|
25
|
+
server 'server.openminds.be', :app, :web, :db, :primary => true
|
26
|
+
|
27
|
+
begin
|
28
|
+
require 'openminds_deploy/defaults'
|
29
|
+
require 'openminds_deploy/git'
|
30
|
+
require 'openminds_deploy/passenger'
|
31
|
+
require 'openminds_deploy/rails3'
|
32
|
+
rescue LoadError
|
33
|
+
$stderr.puts <<INSTALL
|
34
|
+
You need the openminds_deploy gem (which simplifies this Capfile) to deploy this application
|
35
|
+
Install the gem like this:
|
36
|
+
gem install openminds_deploy
|
37
|
+
INSTALL
|
38
|
+
exit 1
|
39
|
+
end
|
40
|
+
|
41
|
+
== Recipes in detail
|
42
|
+
=== openminds_deploy/defaults
|
43
|
+
This sets up variables like use_sudo and group_writable, enables SSH forwarding, and adds a task to link config/database.yml.
|
44
|
+
|
45
|
+
=== openminds_deploy/git
|
46
|
+
This sets up the SCM and enables git-submodules to be installed.
|
47
|
+
|
48
|
+
=== openminds_deploy/svn
|
49
|
+
This sets up the SCM to svn and adds a password-prompt (Don't keep your password in your SCM!)
|
50
|
+
|
51
|
+
=== openminds_deploy/passenger
|
52
|
+
This sets up all stop/start/restart tasks for Passenger
|
53
|
+
|
54
|
+
=== openminds_deploy/lighttpd
|
55
|
+
This sets up all stop/start/restart tasks for Lighttpd
|
56
|
+
|
57
|
+
=== openminds_deploy/rails3
|
58
|
+
This sets up bundling tasks with Bundler and does a basic check to see if the server you're on supports Rails 3.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
require 'openminds_jeweler'
|
4
|
+
Jeweler::Tasks.new do |gem|
|
5
|
+
gem.name = "openminds_deploy"
|
6
|
+
gem.summary = %Q{Common capistrano recipes for Openminds applications}
|
7
|
+
gem.description = %Q{The most commonly used tasks in Capistrano recipes}
|
8
|
+
gem.email = "jan@openminds.be"
|
9
|
+
# gem.homepage = "http://github.com/jomz/gorilla-capistrano-recipes"
|
10
|
+
gem.authors = ["Jan De Poorter"]
|
11
|
+
end
|
12
|
+
Jeweler::OpenmindsTask.new
|
13
|
+
rescue LoadError
|
14
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler openminds_jeweler"
|
15
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
@@ -0,0 +1,40 @@
|
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
|
+
|
3
|
+
configuration.load do
|
4
|
+
set :use_sudo, false
|
5
|
+
set :group_writable, false # Shared environment
|
6
|
+
set :keep_releases, 3 # 3 Releases should be enough
|
7
|
+
set :deploy_via, :remote_cache
|
8
|
+
|
9
|
+
default_run_options[:pty] = true
|
10
|
+
|
11
|
+
set(:deploy_to) { "/home/#{user}/apps/#{application}" }
|
12
|
+
|
13
|
+
ssh_options[:forward_agent] = true
|
14
|
+
|
15
|
+
# database.yml - We houden onze database.yml nooit versioned bij
|
16
|
+
namespace :dbconfig do
|
17
|
+
desc "Create database.yml in shared/config"
|
18
|
+
task :copy_database_config do
|
19
|
+
run "mkdir -p #{shared_path}/config"
|
20
|
+
put File.read('config/database.yml'), "#{shared_path}/config/database.yml"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Link in the production database.yml"
|
24
|
+
task :link do
|
25
|
+
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
after('deploy:symlink') do
|
30
|
+
dbconfig.link
|
31
|
+
end
|
32
|
+
|
33
|
+
after :setup do
|
34
|
+
dbconfig.copy_database_config
|
35
|
+
end
|
36
|
+
|
37
|
+
after :deploy do
|
38
|
+
deploy.cleanup
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
|
+
|
3
|
+
configuration.load do
|
4
|
+
# Lighttpd stuff
|
5
|
+
namespace :lighttpd do
|
6
|
+
desc "Restart the web server"
|
7
|
+
task :restart, :roles => :app do
|
8
|
+
run "lighty restart"
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Stop the web server"
|
12
|
+
task :stop, :roles => :app do
|
13
|
+
run "lighty stop"
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Start the web server"
|
17
|
+
task :start, :roles => :app do
|
18
|
+
run "lighty start"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Standard deploy actions overwritten
|
23
|
+
namespace :deploy do
|
24
|
+
desc "Restart your application"
|
25
|
+
task :restart do
|
26
|
+
lighttpd::restart
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Start your application"
|
30
|
+
task :start do
|
31
|
+
lighttpd::start
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Stop your application"
|
35
|
+
task :stop do
|
36
|
+
lighttpd::stop
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
|
+
|
3
|
+
configuration.load do
|
4
|
+
namespace :passenger do
|
5
|
+
desc "Restart the web server"
|
6
|
+
task :restart, :roles => :app do
|
7
|
+
run "touch #{current_release}/tmp/restart.txt"
|
8
|
+
end
|
9
|
+
|
10
|
+
[:start, :stop].each do |t|
|
11
|
+
desc "#{t} task is a no-op with passenger"
|
12
|
+
task t, :roles => :app do ; end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
namespace :deploy do
|
18
|
+
desc "Restart your application"
|
19
|
+
task :restart do
|
20
|
+
passenger::restart
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Start your application"
|
24
|
+
task :start do
|
25
|
+
passenger::start
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Stop your application"
|
29
|
+
task :stop do
|
30
|
+
passenger::stop
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/capistrano'
|
3
|
+
rescue LoadError
|
4
|
+
$stderr.puts <<INSTALL
|
5
|
+
The openminds_deploy/rails3 recipe requires bundler's deploy task. For this to work we need the bundler gem (>=1.0.0):
|
6
|
+
gem install bundler
|
7
|
+
INSTALL
|
8
|
+
end
|
9
|
+
|
10
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
11
|
+
|
12
|
+
configuration.load do
|
13
|
+
namespace :openminds do
|
14
|
+
task :check_rails3_compat do
|
15
|
+
if roles[:app].servers.any? {|server| %w(zuurstof.openminds.be kobalt.openminds.be koper.openminds.be zink.openminds.be).include?(server.host) }
|
16
|
+
abort "This server is not Rails 3 compatible. Mail support@openminds.be to move your account to a compatible server."
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
before "deploy:update_code", "openminds:check_rails3_compat"
|
22
|
+
before "deploy:setup", "openminds:check_rails3_compat"
|
23
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
configuration = Capistrano::Configuration.respond_to?(:instance) ? Capistrano::Configuration.instance(:must_exist) : Capistrano.configuration(:must_exist)
|
2
|
+
|
3
|
+
configuration.load do
|
4
|
+
set :scm, :svn
|
5
|
+
set :scm_password, Proc.new { CLI.password_prompt "SVN Password: "}
|
6
|
+
end
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
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{openminds_deploy}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jan De Poorter"]
|
12
|
+
s.date = %q{2010-10-05}
|
13
|
+
s.description = %q{The most commonly used tasks in Capistrano recipes}
|
14
|
+
s.email = %q{jan@openminds.be}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"lib/openminds_deploy.rb",
|
23
|
+
"lib/openminds_deploy/defaults.rb",
|
24
|
+
"lib/openminds_deploy/git.rb",
|
25
|
+
"lib/openminds_deploy/lighttpd.rb",
|
26
|
+
"lib/openminds_deploy/passenger.rb",
|
27
|
+
"lib/openminds_deploy/rails3.rb",
|
28
|
+
"lib/openminds_deploy/svn.rb",
|
29
|
+
"openminds_deploy.gemspec"
|
30
|
+
]
|
31
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
s.rubygems_version = %q{1.3.7}
|
34
|
+
s.summary = %q{Common capistrano recipes for Openminds applications}
|
35
|
+
|
36
|
+
if s.respond_to? :specification_version then
|
37
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
|
+
s.specification_version = 3
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
+
else
|
42
|
+
end
|
43
|
+
else
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: openminds_deploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jan De Poorter
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-05 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: The most commonly used tasks in Capistrano recipes
|
23
|
+
email: jan@openminds.be
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README.rdoc
|
30
|
+
files:
|
31
|
+
- README.rdoc
|
32
|
+
- Rakefile
|
33
|
+
- VERSION
|
34
|
+
- lib/openminds_deploy.rb
|
35
|
+
- lib/openminds_deploy/defaults.rb
|
36
|
+
- lib/openminds_deploy/git.rb
|
37
|
+
- lib/openminds_deploy/lighttpd.rb
|
38
|
+
- lib/openminds_deploy/passenger.rb
|
39
|
+
- lib/openminds_deploy/rails3.rb
|
40
|
+
- lib/openminds_deploy/svn.rb
|
41
|
+
- openminds_deploy.gemspec
|
42
|
+
has_rdoc: true
|
43
|
+
homepage:
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options:
|
48
|
+
- --charset=UTF-8
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
version: "0"
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.3.7
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: Common capistrano recipes for Openminds applications
|
76
|
+
test_files: []
|
77
|
+
|