uhl-cap-recipes 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 2
4
+ :patch: 3
5
5
  :build:
data/capscript ADDED
@@ -0,0 +1,5 @@
1
+ cap -f /etc/jenkins-capfile -s application=website-www -s repository=git@git.uhuila.cn:deploy/website-www.git -s play_name=ROOT -s play_path=./website/www play:pull
2
+ cap -f /etc/jenkins-capfile -s application=website-www -s repository=git@git.uhuila.cn:deploy/website-www.git -s play_path=./website/www -s tag=$BUILD_VERSION play:tag
3
+ cap -f /etc/jenkins-capfile -s application=website-www -s servers=192.168.18.223 -s repository=git@git.uhuila.cn:deploy/website-www.git -s tag=$BUILD_VERSION play:deploy
4
+ cap -f /etc/jenkins-capfile -s application=website-www -s servers=192.168.18.223 play:stop
5
+ cap -f /etc/jenkins-capfile -s application=website-www -s servers=192.168.18.223 play:start
data/config/deploy.rb CHANGED
@@ -3,7 +3,10 @@
3
3
  # GENERAL SETTINGS
4
4
  # =============================================================================
5
5
 
6
- role :app, "10.241.14.166"
6
+ # cap -s application=website-home -s repository=git@git.uhuila.cn:deploy/website-home.git -s play_name=ROOT -s play_path=./website/home play:pull
7
+ # cap -s application=website-home -s servers="192.168.18.223" -s repository=git@git.uhuila.cn:deploy/website-home.git play:deploy
8
+ # cap -s application=website-home -s servers="192.168.18.223" play:stop
9
+ # cap -s application=website-home -s servers="192.168.18.223" play:start
7
10
 
8
11
  set :application, "demo"
9
12
  set :deploy_to, "/var/apps/#{application}"
@@ -13,13 +16,12 @@ set :deploy_to, "/var/apps/#{application}"
13
16
  # set :git_enable_submodules, 1
14
17
  # set :keep_releases, 3
15
18
 
16
- set :user, "pm030"
19
+ set :user, "deploy"
17
20
  set :use_sudo, true
18
21
 
19
22
  ssh_options[:paranoid] = false
20
23
  default_run_options[:pty] = true
21
-
22
- set :user, "root"
24
+ default_run_options[:shell] = '/bin/bash'
23
25
 
24
26
  # =============================================================================
25
27
  # RECIPE INCLUDES
@@ -30,6 +32,5 @@ require 'rubygems'
30
32
  $LOAD_PATH.unshift(File.dirname(__FILE__))
31
33
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
32
34
 
33
- require 'cap_recipes/tasks/sdpjenkins'
34
- require 'cap_recipes/tasks/gitdeploy'
35
- require 'cap_recipes/tasks/sft'
35
+ require 'cap_recipes/tasks/play'
36
+ require 'cap_recipes/tasks/uhljenkins'
@@ -19,7 +19,6 @@ Capistrano::Configuration.instance(true).load do |configuration|
19
19
  "#{deploy_to}/#{application}"
20
20
  end
21
21
 
22
-
23
22
  set :local_base_dir do
24
23
  "#{`pwd`}".strip
25
24
  end
@@ -28,10 +27,17 @@ Capistrano::Configuration.instance(true).load do |configuration|
28
27
  "play-#{application}"
29
28
  end
30
29
 
30
+ set :service_check_name do
31
+ "#{application}"
32
+ end
33
+
31
34
  _cset :_config, Array.new
32
35
  _cset :build_name, "ROOT"
33
36
  _cset :build_path, "not set.war"
34
37
 
38
+ _cset :reeb_config_dir, "/etc/reeb"
39
+ _cset :reeb_config_repository, "git@git.uhuila.cn:configuration/product.git"
40
+
35
41
  _cset :servers, ""
36
42
 
37
43
  set :local_git_dir do
@@ -54,6 +60,13 @@ Capistrano::Configuration.instance(true).load do |configuration|
54
60
  desc "start service"
55
61
  task :start do
56
62
  sudo "/etc/init.d/#{service_name} start"
63
+ # sleep 1
64
+ # api_status = nil
65
+ # until api_status
66
+ # api_status = capture("echo `netstat -tln | grep 8080`")
67
+ # sleep 60
68
+ # end
69
+ # puts "API Started successfully."
57
70
  end
58
71
 
59
72
  desc "stop service"
@@ -132,6 +145,7 @@ Capistrano::Configuration.instance(true).load do |configuration|
132
145
  desc "deploy. use -s tag=xxx to set tag's name, if NOT set tag, pull the repository's last version."
133
146
  task :deploy do
134
147
  play.setup_remote
148
+ play.setup_or_update_reeb_config
135
149
  tag_name = configuration[:tag] || configuration[:build_version]
136
150
  unless tag_name.nil?
137
151
  # raise "NO tag. pls use -s tag=xxx set tag_name"
@@ -168,6 +182,19 @@ Capistrano::Configuration.instance(true).load do |configuration|
168
182
  ].join("; ")
169
183
  end
170
184
 
185
+ def self.setup_or_update_reeb_config
186
+ [
187
+ "if [ ! -e #{reeb_config_dir} ]",
188
+ "then sudo mkdir -p #{reeb_config_dir}",
189
+ "sudo chown #{user} #{deploy_to}",
190
+ "cd #{reeb_config_dir}",
191
+ "git clone #{reeb_config_repository} .",
192
+ "fi",
193
+ "cd #{reeb_config_dir}",
194
+ "git pull"
195
+ ].join("; ")
196
+ end
197
+
171
198
  def self.clone_repository_command
172
199
  [
173
200
  "if [ ! -e #{deploy_to_gitrepo} ]",
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "uhl-cap-recipes"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["crazycode"]
12
- s.date = "2012-03-30"
12
+ s.date = "2012-05-24"
13
13
  s.description = "capistrano recipes for my works"
14
14
  s.email = "crazycode@gmail.com"
15
15
  s.executables = ["cap-recipes"]
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "VERSION.yml",
26
26
  "bin/cap-recipes",
27
27
  "cap-recipes.gemspec",
28
+ "capscript",
28
29
  "config/deploy.rb",
29
30
  "examples/advanced/deploy.rb",
30
31
  "examples/advanced/deploy/experimental.rb",
@@ -61,7 +62,7 @@ Gem::Specification.new do |s|
61
62
  s.homepage = "http://github.com/crazycode/uhl-cap-recipes"
62
63
  s.require_paths = ["lib"]
63
64
  s.rubyforge_project = "uhl-cap-recipes"
64
- s.rubygems_version = "1.8.10"
65
+ s.rubygems_version = "1.8.24"
65
66
  s.summary = "Battle-tested capistrano recipes for passenger, delayed_job, and more"
66
67
 
67
68
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uhl-cap-recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-30 00:00:00.000000000 Z
12
+ date: 2012-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &15361360 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15361360
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: json
27
- requirement: &15360420 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *15360420
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: addressable
38
- requirement: &15359460 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *15359460
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  description: capistrano recipes for my works
48
63
  email: crazycode@gmail.com
49
64
  executables:
@@ -60,6 +75,7 @@ files:
60
75
  - VERSION.yml
61
76
  - bin/cap-recipes
62
77
  - cap-recipes.gemspec
78
+ - capscript
63
79
  - config/deploy.rb
64
80
  - examples/advanced/deploy.rb
65
81
  - examples/advanced/deploy/experimental.rb
@@ -112,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
128
  version: '0'
113
129
  requirements: []
114
130
  rubyforge_project: uhl-cap-recipes
115
- rubygems_version: 1.8.10
131
+ rubygems_version: 1.8.24
116
132
  signing_key:
117
133
  specification_version: 3
118
134
  summary: Battle-tested capistrano recipes for passenger, delayed_job, and more