crazycode-cap-recipes 0.4.6 → 0.4.8

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: 4
4
- :patch: 6
4
+ :patch: 8
5
5
  :build:
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{crazycode-cap-recipes}
8
- s.version = "0.4.6"
8
+ s.version = "0.4.8"
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 = %q{2011-08-24}
12
+ s.date = %q{2011-08-26}
13
13
  s.default_executable = %q{cap-recipes}
14
14
  s.description = %q{Battle-tested capistrano recipes for debian, passenger, apache, hudson, delayed_job, juggernaut, rubygems, backgroundrb, rails and more}
15
15
  s.email = %q{crazycode@gmail.com}
@@ -84,7 +84,12 @@ Gem::Specification.new do |s|
84
84
  "lib/cap_recipes/tasks/rubygems.rb",
85
85
  "lib/cap_recipes/tasks/rubygems/install.rb",
86
86
  "lib/cap_recipes/tasks/rubygems/manage.rb",
87
+ "lib/cap_recipes/tasks/sdpdeploy/autoinstall.rb",
88
+ "lib/cap_recipes/tasks/sdpdeploy/iis.rb",
89
+ "lib/cap_recipes/tasks/sdpdeploy/sft.rb",
90
+ "lib/cap_recipes/tasks/sdpdeploy/sfttask.rb",
87
91
  "lib/cap_recipes/tasks/sdpjenkins.rb",
92
+ "lib/cap_recipes/tasks/sft.rb",
88
93
  "lib/cap_recipes/tasks/templates/hudson.erb",
89
94
  "lib/cap_recipes/tasks/templates/mongod.conf.erb",
90
95
  "lib/cap_recipes/tasks/templates/mongodb.init.erb",
@@ -66,10 +66,15 @@ Capistrano::Configuration.instance(true).load do |configuration|
66
66
 
67
67
  system "cd #{local_gitrepo}; git checkout #{branch}; git fetch; git merge origin/#{branch};"
68
68
 
69
- war_config.each do |config|
70
- puts "name=#{config[:name]}, war=#{config[:war]}"
71
- puts update_repository_local_command(config[:name], config[:war])
72
- system update_repository_local_command(config[:name], config[:war])
69
+
70
+ if defined? war_name
71
+ puts "name=#{war_name}, war=#{war_path}"
72
+ system update_repository_local_command(war_name, war_path)
73
+ else
74
+ war_config.each do |config|
75
+ puts "name=#{config[:name]}, war=#{config[:war]}"
76
+ system update_repository_local_command(config[:name], config[:war])
77
+ end
73
78
  end
74
79
 
75
80
  system "cd #{local_gitrepo}; git add .; git commit -m 'tag with #{tag_name}'; git tag #{tag_name};"
@@ -0,0 +1,78 @@
1
+ Capistrano::Configuration.instance(true).load do
2
+ namespace :autointall do
3
+
4
+ desc "GITgetgitDir_fromGitserver"
5
+ task :autoInstallfileGetorUpdate, :max_hosts=>1 do
6
+ run %{
7
+ mkdir -p /opt/applications/;mkdir /opt/logs;
8
+ mkdir -p /opt/autoinstalldir;cd /opt/autoinstalldir;pwd;
9
+ git init;
10
+ git remote add origin gituser@gitsource.shengpay.com:/opt/gitroot/autoinstalldir.git;
11
+ git remote -v;
12
+ git fetch;git fetch -t;git fetch;
13
+ git pull origin master;
14
+ ls -a;git status;
15
+ }
16
+ end
17
+
18
+
19
+ task :install_Nginx,:mas_hosts=>1 do
20
+ run %{
21
+ cd /opt/autoinstalldir; sh nginx-install.sh;
22
+ }
23
+ end
24
+
25
+ task :install_JDK,:mas_hosts=>1 do
26
+ run %{
27
+ cd /opt/autoinstalldir; sh java-install.sh;
28
+ }
29
+ end
30
+
31
+ task :install_jboss,:mas_hosts=>1 do
32
+ run %{
33
+ cd /opt/autoinstalldir; sh jboss-install.sh;
34
+ }
35
+ end
36
+
37
+ task :install_memcached,:mas_hosts=>1 do
38
+ run %{
39
+ cd /opt/autoinstalldir; sh memcached-install.sh;
40
+ }
41
+ end
42
+
43
+ desc "for memcache "
44
+ task :install_ttserver,:mas_hosts=>1 do
45
+ run %{
46
+ cd /opt/autoinstalldir; sh tt-install.sh;
47
+ }
48
+ end
49
+
50
+ desc "tomcat install task"
51
+ task :tomcat_install, :max_hosts=>1 do
52
+ run %{
53
+ cd /opt/autoinstalldir; sh tomcat-install.sh ;
54
+ echo "usage sh createInstance.sh -d tcServer1 -n 10000 -a 8010 -h 8080 -s 8440 -j 6900 to create tomcat instance";
55
+ }
56
+ end
57
+
58
+ desc "tomcat instance create task"
59
+ task :tomcat_instance_create, :max_hosts=>1 do
60
+ run %{
61
+ cd /opt/autoinstalldir/templateHome/bin ;
62
+ pwd;
63
+ ls -lhrt createInstance.sh;
64
+ sh createInstance.sh -d #{instanceName} -n `expr 10000 + #{instanceNum}` -a `expr 8010 + #{instanceNum}` -h `expr 8080 + #{instanceNum}` -s `expr 8440 + #{instanceNum}` -j `expr 6900 + #{instanceNum}`;
65
+ chown tomcat:tomcat /opt/tomcat -R; chmod +x /opt/tomcat/*/bin/*
66
+ }
67
+ end
68
+
69
+ desc " cmd from web"
70
+ task :cmd_diy,:mas_hosts=>1 do
71
+ run %{
72
+ #{diy_cmd}
73
+ }
74
+ end
75
+
76
+ end
77
+
78
+ end
@@ -0,0 +1,72 @@
1
+ Capistrano::Configuration.instance(true).load do
2
+ namespace :atiiscmd do
3
+
4
+ desc "recycleApplicationPool"
5
+ task :recycleApplicationPool, :max_hosts=>1 do
6
+ run %{
7
+ cscript //Nologo "C:\\windows\\system32\\iisapp.vbs" /a #{iispool} /r
8
+ }
9
+ end
10
+
11
+ desc "iis website status"
12
+ task :iis_site_status, :max_hosts=>1 do
13
+ run %{
14
+ cscript //Nologo "C:\\windows\\system32\\iisweb.vbs" /query #{iiswebsite}
15
+ }
16
+ end
17
+
18
+ desc "iis website status all"
19
+ task :iis_site_status_all, :max_hosts=>1 do
20
+ run %{
21
+ cscript //Nologo "C:\\windows\\system32\\iisweb.vbs" /query
22
+ }
23
+ end
24
+
25
+ desc "iis website start"
26
+ task :iis_site_start, :max_hosts=>1 do
27
+ run %{
28
+ cscript //Nologo "C:\\windows\\system32\\iisweb.vbs" /start #{iiswebsite}
29
+ }
30
+ end
31
+
32
+ desc "iis website stop"
33
+ task :iis_site_stop, :max_hosts=>1 do
34
+ run %{
35
+ cscript //Nologo "C:\\windows\\system32\\iisweb.vbs" /stop #{iiswebsite}
36
+ }
37
+ end
38
+
39
+ desc "iis iisreset stop"
40
+ task :iis_stop, :max_hosts=>1 do
41
+ run %{
42
+ iisreset /stop
43
+ }
44
+ end
45
+
46
+ desc "iis iisreset start"
47
+ task :iis_start, :max_hosts=>1 do
48
+ run %{
49
+ iisreset /start
50
+ }
51
+ end
52
+
53
+ desc "iis iisreset status"
54
+ task :iis_status, :max_hosts=>1 do
55
+ run %{
56
+ iisreset /status
57
+ }
58
+ end
59
+
60
+ desc "iis iisreset restart"
61
+ task :iis_restart, :max_hosts=>1 do
62
+ run %{
63
+ iisreset /restart
64
+ }
65
+ end
66
+
67
+ desc "iis website deploy dir"
68
+ task :iis_dp_dir_info, :max_hosts=>1 do
69
+ run " grep -nE 'ServerComment|Path' /cygdrive/c/WINDOWS/system32/inetsrv/MetaBase.xml |grep -vE 'tPath|rPath|默认|允许' "
70
+ end
71
+ end
72
+ end
@@ -0,0 +1 @@
1
+ Dir[File.join(File.dirname(__FILE__), 'sdpdeploy/*.rb')].sort.each { |lib| require lib }
@@ -0,0 +1,272 @@
1
+ Capistrano::Configuration.instance(true).load do
2
+ namespace :atdp do
3
+
4
+ begin
5
+ puts "#{su_user}"
6
+ rescue => error then
7
+ su_user_real="#{user}";puts "su user is user #{user}"
8
+ else
9
+ su_user_real="#{su_user}";puts "su user is su_user #{su_user}"
10
+ end
11
+
12
+ begin
13
+ puts "#{servicename}"
14
+ rescue => error then
15
+ scstop="echo there no win service;";
16
+ scstart="echo there no win service;";
17
+ else
18
+ scstop=" sc stop #{servicename} |grep STATE; date;echo ping ;ping 127.0.0.1 -n 15 >> /dev/null ; date ; sc query #{servicename} |grep STATE; "
19
+ scstart=" sc start #{servicename} |grep STATE; date;echo ping ;ping 127.0.0.1 -n 15 >> /dev/null ; date ; sc query #{servicename} |grep STATE;"
20
+ end
21
+
22
+ begin
23
+ puts "#{iispool}"
24
+ rescue => error then
25
+ recyclepool="echo there no iis pool name;";
26
+ else
27
+ recyclepool=" cscript //Nologo \"C:\\windows\\system32\\iisapp.vbs\" /a #{iispool} /r; "
28
+ end
29
+
30
+ def getgitcmd(git_path,tag_name)
31
+ gitstatDirls="ls -a;git status;echo ------------------------------;"
32
+ git_cmd0="git reset --hard;git fetch;git fetch -t;git reset --merge #{tag_name};"
33
+ git_cmd1="cd #{git_path}; #{gitstatDirls} #{git_cmd0} #{gitstatDirls} #{git_cmd0} #{gitstatDirls}"
34
+ return git_cmd1
35
+ end
36
+
37
+
38
+
39
+
40
+ desc "default cmds : git-tag and restart "
41
+ task :lux_git_restart, :max_hosts=>1 do
42
+ _git_cmd=getgitcmd(git_path,tag_name)
43
+ run %{
44
+ #{_git_cmd}
45
+ su - #{su_user_real} -c "#{appserver_cmd} restart" ;
46
+ su - #{su_user_real} -c "#{appserver_cmd} status";
47
+ }
48
+ end
49
+
50
+ desc "default cmds : stop git-tag start "
51
+ task :luxstop_git_start, :max_hosts=>1 do
52
+ _git_cmd=getgitcmd(git_path,tag_name)
53
+ run %{
54
+ su - #{su_user_real} -c "#{appserver_cmd} stop" ;
55
+ #{_git_cmd}
56
+ su - #{su_user_real} -c "#{appserver_cmd} start" ;
57
+ su - #{su_user_real} -c "#{appserver_cmd} status";
58
+ }
59
+ end
60
+
61
+ desc "new git cmd include GBK SCREstart no pre to prod "
62
+ task :git_up_tag_new, :max_hosts=>1 do
63
+ _git_cmd=getgitcmd(git_path,tag_name)
64
+ if webistrano_project != "allpreverificationconfirm" && tag_name =~ /pre_/i
65
+ then capcmd="echo !!pre tag should not to production!!"
66
+ else
67
+ if webistrano_stage =~ /gbk/i then
68
+ gitcmd="pwd;export LANG=zh_CN.GBK;#{_git_cmd}"
69
+ else
70
+ gitcmd= _git_cmd
71
+ end
72
+ if git_path =~ /website/i then
73
+ capcmd=" #{gitcmd} #{recyclepool}"
74
+ else
75
+ capcmd="#{scstop} #{gitcmd} #{scstart}"
76
+ end
77
+ end
78
+ run %{#{capcmd}}
79
+ end
80
+
81
+
82
+
83
+
84
+ desc "stop server or service"
85
+ task :luxstop_serv, :max_hosts=>1 do
86
+ run %{
87
+ su - #{su_user_real} -c "#{appserver_cmd} stop" ;
88
+ su - #{su_user_real} -c "#{appserver_cmd} status";
89
+ }
90
+ end
91
+
92
+ desc "start server or service"
93
+ task :luxstart_serv, :max_hosts=>1 do
94
+ run %{
95
+ su - #{su_user_real} -c "#{appserver_cmd} start" ;
96
+ su - #{su_user_real} -c "#{appserver_cmd} status";
97
+ }
98
+ end
99
+
100
+ desc "restart server or service"
101
+ task :luxrestart_serv, :max_hosts=>1 do
102
+ run %{
103
+ su - #{su_user_real} -c "#{appserver_cmd} restart" ;
104
+ su - #{su_user_real} -c "#{appserver_cmd} status";
105
+ }
106
+ end
107
+
108
+ desc "status server or service"
109
+ task :luxstatus_serv, :max_hosts=>1 do
110
+ run %{
111
+ su - #{su_user_real} -c "#{appserver_cmd} status;ps -efjH|grep java"
112
+ }
113
+ end
114
+
115
+ desc "custom test cmd"
116
+ task :custom_test, :max_hosts=>1 do
117
+ run %{
118
+ #{custom_test_cmd}
119
+ }
120
+ end
121
+
122
+
123
+
124
+
125
+ desc "backup git path "
126
+ task :backup_gitpath do
127
+ run %{
128
+ tar -czf #{git_path}.`date +%Y.%m.%d-%H.%M.%S`.tgz #{git_path};
129
+ ls --full-time -sh #{git_path}.`date +%Y.%m.%d`*
130
+ }
131
+ end
132
+
133
+ desc "recycleApplicationPool"
134
+ task :iisrecycleApplicationPool do
135
+ run %{
136
+ cscript //Nologo "C:\\windows\\system32\\iisapp.vbs" /a #{iispool} /r
137
+ }
138
+ end
139
+
140
+ desc "startApplicationPool"
141
+ task :iisstartApplicationPool, :max_hosts=>1 do
142
+ run %{
143
+ cscript "C:\\Inetpub\\AdminScripts\\adsutil.vbs" START_SERVER W3SVC/AppPools/#{iispool}
144
+ }
145
+ end
146
+
147
+
148
+
149
+
150
+ desc "service start"
151
+ task :winstartservice, :max_hosts=>1 do
152
+ run %{
153
+ #{scstart}
154
+ }
155
+ end
156
+
157
+ desc "service stop"
158
+ task :winstopservice, :max_hosts=>1 do
159
+ run %{
160
+ #{scstop}
161
+ }
162
+ end
163
+
164
+ desc "service restart"
165
+ task :winServiceRestart, :max_hosts=>1 do
166
+ run %{
167
+ #{scstop}
168
+ #{scstart} }
169
+ end
170
+
171
+
172
+
173
+
174
+ desc "push product to git server !!!!!no git log"
175
+ task :GITdailypushprod_togitserv, :max_hosts=>1 do
176
+ run %{
177
+ cd #{git_path};
178
+ pwd;ls -a;git status;
179
+ git add . ;
180
+ git commit -am "product webistrano auto `date +%Y.%m.%d-%H.%M.%S` `pwd` " ;
181
+ git push origin master ;
182
+ ls -a;git status;
183
+ }
184
+ end
185
+
186
+ desc "push product to git server"
187
+ task :GITinitpushprod_togitserv, :max_hosts=>1 do
188
+ run %{
189
+ cd #{git_path};
190
+ pwd;ls -a;
191
+ git init;
192
+ git add . ;
193
+ git commit -am "product webistrano auto `date +%Y.%m.%d-%H.%M.%S` `pwd` " ;
194
+ git remote add origin gituser@gitsource.shengpay.com:#{git_repopath} ;
195
+ git remote -v;
196
+ git push origin master ;
197
+ ls -a;git status
198
+ }
199
+ end
200
+
201
+ desc "init stage git in dp server"
202
+ task :GITonlyInitgit_indpserv, :max_hosts=>1 do
203
+ run %{
204
+ cd #{git_path};
205
+ pwd;ls -a;
206
+ git init;
207
+ git remote add origin gituser@gitsource.shengpay.com:#{git_repopath} ;
208
+ git remote -v;
209
+ ls -a;git status
210
+ }
211
+ end
212
+
213
+ desc "GITgetgitDir_fromGitserver"
214
+ task :GITinitgetgitDirfromGitserver, :max_hosts=>1 do
215
+ run %{
216
+ dir=`date +%Y%m%d%H%M%S`; cd /tmp;pwd;git clone gituser@gitsource.shengpay.com:#{git_repopath} $dir;
217
+ cd #{git_path};pwd;ls -a; cp -r /tmp/$dir/.git ./; ls -a;git status;
218
+ }
219
+ end
220
+
221
+
222
+
223
+ desc "push product to git server"
224
+ task :Git_Ip_initpushprod_togitserv, :max_hosts=>1 do
225
+ run %{
226
+ cd #{git_path};
227
+ pwd;ls -a;
228
+ git init;
229
+ git add . ;
230
+ git commit -am "product webistrano auto `date +%Y.%m.%d-%H.%M.%S` `pwd` " ;
231
+ git remote add origin gituser@114.80.132.203:#{git_repopath} ;
232
+ git remote -v;
233
+ git push origin master ;
234
+ ls -a;git status
235
+ }
236
+ end
237
+
238
+ desc "init stage git in dp server"
239
+ task :Git_Ip_onlyInitgit_indpserv, :max_hosts=>1 do
240
+ run %{
241
+ cd #{git_path};
242
+ pwd;ls -a;
243
+ git init;
244
+ git remote add origin gituser@114.80.132.203:#{git_repopath} ;
245
+ git remote -v;
246
+ ls -a;git status
247
+ }
248
+ end
249
+
250
+ desc "GITgetgitDir_fromGitserver"
251
+ task :Git_Ip_InitGetGitDir_fromGitserver, :max_hosts=>1 do
252
+ run %{
253
+ dir=`date +%Y%m%d%H%M%S`; cd /tmp;pwd;git clone gituser@114.80.132.203:#{git_repopath} $dir;
254
+ cd #{git_path};pwd;ls -a; cp -r /tmp/$dir/.git ./; ls -a;git status;
255
+ }
256
+ end
257
+
258
+
259
+
260
+
261
+ desc "get iis info"
262
+ task :iisinfo, :max_hosts=>1 do
263
+ run %{
264
+ cscript.exe "c:\\Inetpub\\AdminScripts\\adsutil.vbs" ENUM /P W3SVC/AppPools;
265
+ cscript //Nologo "C:\\windows\\system32\\iisweb.vbs" /query |awk -F")" '{print $1}'|awk -F"(" '{print $2}'|grep W3SVC|grep -vE "W3SVC/1$" |xargs -I {} cscript.exe "c:\\Inetpub\\AdminScripts\\adsutil.vbs" ENUM_ALL {}|grep -E "AppPoolId|Path|Comment"
266
+ }
267
+ end
268
+
269
+ end
270
+
271
+ end
272
+
@@ -20,7 +20,7 @@ Capistrano::Configuration.instance(true).load do |configuration|
20
20
  _cset :release_pattern, "*.war"
21
21
  _cset :upload_dir, ""
22
22
  _cset :shell_commands, "cd #{upload_dir}; ls -all"
23
- _cset :build_version, "unset version"
23
+ _cset :build_version, ""
24
24
 
25
25
  role :app, :primary => true do
26
26
  CmdbService.get_app_role("#{cse_base}", deploy_unit_code, deploy_stage)
@@ -0,0 +1 @@
1
+ Dir[File.join(File.dirname(__FILE__), 'sft/*.rb')].sort.each { |lib| require lib }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 6
9
- version: 0.4.6
8
+ - 8
9
+ version: 0.4.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - crazycode
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-24 00:00:00 +08:00
17
+ date: 2011-08-26 00:00:00 +08:00
18
18
  default_executable: cap-recipes
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -131,7 +131,12 @@ files:
131
131
  - lib/cap_recipes/tasks/rubygems.rb
132
132
  - lib/cap_recipes/tasks/rubygems/install.rb
133
133
  - lib/cap_recipes/tasks/rubygems/manage.rb
134
+ - lib/cap_recipes/tasks/sdpdeploy/autoinstall.rb
135
+ - lib/cap_recipes/tasks/sdpdeploy/iis.rb
136
+ - lib/cap_recipes/tasks/sdpdeploy/sft.rb
137
+ - lib/cap_recipes/tasks/sdpdeploy/sfttask.rb
134
138
  - lib/cap_recipes/tasks/sdpjenkins.rb
139
+ - lib/cap_recipes/tasks/sft.rb
135
140
  - lib/cap_recipes/tasks/templates/hudson.erb
136
141
  - lib/cap_recipes/tasks/templates/mongod.conf.erb
137
142
  - lib/cap_recipes/tasks/templates/mongodb.init.erb