chrisrec 0.1.3 → 0.2.0

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.
Files changed (60) hide show
  1. data/Manifest +9 -53
  2. data/README +14 -0
  3. data/Rakefile +1 -1
  4. data/chrisrec.gemspec +11 -12
  5. data/lib/chrisrec.rb +6 -11
  6. data/{lib → retired/lib}/backgroundrb/backgroundrb.rb +0 -0
  7. data/{lib → retired/lib}/gitosis/gitosis.rb +0 -0
  8. data/{lib → retired/lib}/memcached/memcached.rb +0 -0
  9. data/{lib → retired/lib}/starling/starling.rb +0 -0
  10. data/{lib → retired/lib}/workling/workling.rb +0 -0
  11. data/{pkg/chrisrec-0.1.2 → retired}/template/starling/monit.conf.erb +0 -0
  12. data/{pkg/chrisrec-0.1.2 → retired}/template/starling/starling-init-script.erb +0 -0
  13. data/{pkg/chrisrec-0.1.2 → retired}/template/workling/monit.conf.erb +0 -0
  14. data/{pkg/chrisrec-0.1.2 → retired}/template/workling/workling-init-script.erb +0 -0
  15. data/template/static/httpd-vhost-static.conf.erb +2 -2
  16. metadata +30 -100
  17. data/pkg/chrisrec-0.1.2/Manifest +0 -88
  18. data/pkg/chrisrec-0.1.2/README +0 -1
  19. data/pkg/chrisrec-0.1.2/Rakefile +0 -21
  20. data/pkg/chrisrec-0.1.2/chrisrec.gemspec +0 -30
  21. data/pkg/chrisrec-0.1.2/lib/backgroundrb/backgroundrb.rb +0 -22
  22. data/pkg/chrisrec-0.1.2/lib/chrisrec.rb +0 -14
  23. data/pkg/chrisrec-0.1.2/lib/console/console.rb +0 -19
  24. data/pkg/chrisrec-0.1.2/lib/daemon/daemon.rb +0 -134
  25. data/pkg/chrisrec-0.1.2/lib/gitosis/gitosis.rb +0 -131
  26. data/pkg/chrisrec-0.1.2/lib/jekyll/jekyll.rb +0 -87
  27. data/pkg/chrisrec-0.1.2/lib/memcached/memcached.rb +0 -140
  28. data/pkg/chrisrec-0.1.2/lib/munin/munin.rb +0 -135
  29. data/pkg/chrisrec-0.1.2/lib/mysql/mysql.rake +0 -95
  30. data/pkg/chrisrec-0.1.2/lib/mysql/mysql.rb +0 -51
  31. data/pkg/chrisrec-0.1.2/lib/rake/rake.rb +0 -19
  32. data/pkg/chrisrec-0.1.2/lib/rakecron/rakecron.rb +0 -35
  33. data/pkg/chrisrec-0.1.2/lib/starling/starling.rb +0 -124
  34. data/pkg/chrisrec-0.1.2/lib/static/static.rb +0 -80
  35. data/pkg/chrisrec-0.1.2/lib/tomcat/tomcat.rb +0 -202
  36. data/pkg/chrisrec-0.1.2/lib/workling/workling.rb +0 -72
  37. data/pkg/chrisrec-0.1.2/template/daemon/daemon-init-script.erb +0 -59
  38. data/pkg/chrisrec-0.1.2/template/daemon/monit.conf.erb +0 -4
  39. data/pkg/chrisrec-0.1.2/template/jekyll/httpd-vhost-jekyll.conf.erb +0 -16
  40. data/pkg/chrisrec-0.1.2/template/memcached/memcached-conf.erb +0 -1
  41. data/pkg/chrisrec-0.1.2/template/memcached/memcached.erb +0 -59
  42. data/pkg/chrisrec-0.1.2/template/memcached/monit.conf.erb +0 -8
  43. data/pkg/chrisrec-0.1.2/template/memcached/start-memcached.erb +0 -118
  44. data/pkg/chrisrec-0.1.2/template/munin/httpd-vhost-munin.conf.erb +0 -20
  45. data/pkg/chrisrec-0.1.2/template/munin/munin.conf.erb +0 -70
  46. data/pkg/chrisrec-0.1.2/template/munin/munin_nginx_vhost.conf.erb +0 -24
  47. data/pkg/chrisrec-0.1.2/template/rakecron/rakecron.erb +0 -12
  48. data/pkg/chrisrec-0.1.2/template/static/httpd-vhost-static.conf.erb +0 -16
  49. data/pkg/chrisrec-0.1.2/template/tomcat/conf/server.xml.erb +0 -33
  50. data/pkg/chrisrec-0.1.2/template/tomcat/conf/web.xml +0 -1194
  51. data/pkg/chrisrec-0.1.2/template/tomcat/logs/empty.txt +0 -1
  52. data/pkg/chrisrec-0.1.2/template/tomcat/monit.conf.erb +0 -8
  53. data/pkg/chrisrec-0.1.2/template/tomcat/temp/empty.txt +0 -1
  54. data/pkg/chrisrec-0.1.2/template/tomcat/tomcat.erb +0 -28
  55. data/pkg/chrisrec-0.1.2/template/tomcat/webapps/empty.txt +0 -1
  56. data/pkg/chrisrec-0.1.2/template/tomcat/work/empty.txt +0 -1
  57. data/template/starling/monit.conf.erb +0 -14
  58. data/template/starling/starling-init-script.erb +0 -69
  59. data/template/workling/monit.conf.erb +0 -4
  60. data/template/workling/workling-init-script.erb +0 -56
@@ -1,124 +0,0 @@
1
- Capistrano::Configuration.instance(:must_exist).load do
2
- namespace :chrisrec do
3
- namespace :starling do
4
-
5
- set :starling_port, 15151
6
- set :starling_address, "127.0.0.1"
7
- set :starling_user, "starling"
8
- set :starling_group, "starling"
9
- set :starling_spool_dir, "/var/spool/starling"
10
- set :starling_run_dir, "/var/run"
11
- set :starling_log_dir, "/var/log"
12
-
13
- set :local_template_dir, "#{File.dirname(__FILE__)}/../../template"
14
-
15
- # Installation
16
- desc "Installs the Starling gem"
17
- task :install, :roles => :cache do
18
- sudo("gem install eventmachine --no-rdoc --no-ri")
19
- sudo("gem install starling-starling --source http://gems.github.com -v 0.9.9 --no-rdoc --no-ri")
20
-
21
- deprec2.mkdir(starling_spool_dir, :via => :sudo)
22
- # deprec2.mkdir(starling_run_dir, :via => :sudo)
23
- # deprec2.mkdir(starling_log_dir, :via => :sudo)
24
-
25
- create_starling_user_and_group
26
- set_perms_for_starling_dirs
27
- symlink_starling_for_rubyee if ruby_vm_type == :ree
28
- end
29
-
30
- # Configure
31
-
32
- SYSTEM_CONFIG_FILES[:starling] = [
33
- {:template => 'starling-init-script.erb',
34
- :path => 'starling/etc/init.d/starling',
35
- :mode => 0755,
36
- :owner => 'root:root'},
37
-
38
- {:template => 'monit.conf.erb',
39
- :path => "starling/etc/monit.d/monit_starling.conf",
40
- :mode => 0600,
41
- :owner => 'root:root'}
42
- ]
43
-
44
- # Generating Configuration Files
45
- desc "Generate configuration file(s) for Starling from template(s)"
46
- task :config_gen do
47
- SYSTEM_CONFIG_FILES[:starling].each do |file|
48
- deprec2.render_template(:starling, file)
49
- end
50
- end
51
-
52
- desc 'Deploy configuration files(s) for Starling'
53
- task :config, :roles => :cache do
54
- deprec2.push_configs(:starling, SYSTEM_CONFIG_FILES[:starling])
55
- symlink_init_d
56
- symlink_monit_d
57
-
58
- activate
59
- end
60
-
61
- desc "Stop starling"
62
- task :stop , :roles => :cache do
63
- sudo "/etc/init.d/starling_#{starling_port} stop"
64
- end
65
-
66
- desc "Start starling"
67
- task :start , :roles => :cache do
68
- sudo "/etc/init.d/starling_#{starling_port} start"
69
- end
70
-
71
- desc "Start the starling server"
72
- task :restart, :roles => :cache do
73
- stop
74
- sleep(2)
75
- start
76
- end
77
-
78
- task :activate, :roles => :cache do
79
- send(run_method, "update-rc.d starling_#{starling_port} defaults")
80
- end
81
-
82
- task :deactivate, :roles => :cache do
83
- send(run_method, "update-rc.d -f starling_#{starling_port} remove")
84
- end
85
-
86
- # User/Group creation & permission assignment
87
- # These were based off the tasks used in the mongrel recipe -
88
- # as this was probably the nicest way to ensure these tasks
89
- # were doing the right thing.
90
- desc "create user and group for starling to run as"
91
- task :create_starling_user_and_group, :roles => :cache do
92
- deprec2.groupadd(starling_group)
93
- deprec2.useradd(starling_user, :group => starling_group, :homedir => false)
94
- # Set the primary group for the starling user (in case user already existed
95
- # when previous command was run)
96
- sudo "usermod --gid #{starling_group} #{starling_user}"
97
- end
98
-
99
- desc "set group ownership and permissions on dirs starling needs to write to"
100
- task :set_perms_for_starling_dirs, :roles => :cache do
101
- sudo "chgrp -R #{starling_group} #{starling_spool_dir}"
102
- sudo "chmod -R g+w #{starling_spool_dir}"
103
- # sudo "chgrp -R #{starling_group} #{starling_run_dir} #{starling_log_dir}"
104
- # sudo "chmod -R g+w #{starling_run_dir} #{starling_log_dir}"
105
- end
106
-
107
- task :symlink_starling_for_rubyee, :roles => :cache do
108
- # This ensures we symlink from the REE common directory, NOT the
109
- # actual REE install directory (so when we change the REE version,
110
- # we don't have to fuddle around again).
111
- sudo "ln -fs #{ree_short_path}/bin/starling /usr/local/bin/starling"
112
- end
113
-
114
- task :symlink_init_d, :roles => :cache do
115
- sudo "ln -fs #{deploy_to}/starling/starling/etc/init.d/starling /etc/init.d/starling_#{starling_port}"
116
- end
117
-
118
- task :symlink_monit_d, :roles => :cache do
119
- sudo "ln -fs #{deploy_to}/starling/starling/etc/monit.d/monit_starling.conf /etc/monit.d/monit_starling_#{starling_port}.conf"
120
- end
121
-
122
- end
123
- end
124
- end
@@ -1,80 +0,0 @@
1
- Capistrano::Configuration.instance(:must_exist).load do
2
- namespace :chrisrec do
3
- namespace :static do
4
-
5
- set :local_template_dir, "#{File.dirname(__FILE__)}/../../template"
6
-
7
- desc "Install static site"
8
- task :install, :roles => :app do
9
- top.deprec.rails.setup_user_perms
10
- top.deprec.rails.create_app_user_and_group
11
- top.deprec.rails.setup_paths
12
- top.deprec.rails.setup_shared_dirs
13
-
14
- top.chrisrec.static.deploy.setup
15
- end
16
-
17
- PROJECT_CONFIG_FILES[:static] = [
18
-
19
- {:template => "httpd-vhost-static.conf.erb",
20
- :path => 'conf/httpd-vhost-static.conf',
21
- :mode => 0755,
22
- :owner => 'root:root'}
23
- ]
24
-
25
-
26
- desc "Generate configuration file(s) for static site from template(s)"
27
- task :config_gen do
28
- PROJECT_CONFIG_FILES[:static].each do |file|
29
- deprec2.render_template(:static, file)
30
- end
31
- end
32
-
33
- desc 'Deploy configuration files(s) for static site'
34
- task :config, :roles => :web do
35
- deprec2.push_configs(:static, PROJECT_CONFIG_FILES[:static])
36
- symlink_apache_vhost
37
-
38
- top.deprec.apache.restart
39
- end
40
-
41
- task :symlink_apache_vhost, :roles => :web do
42
- sudo "ln -sf #{deploy_to}/static/conf/httpd-vhost-static.conf /etc/apache2/sites-available/#{application}"
43
- sudo "ln -sf #{deploy_to}/static/conf/httpd-vhost-static.conf /etc/apache2/sites-enabled/#{application}"
44
- end
45
-
46
- namespace :deploy do
47
- desc 'deploy'
48
- task :default do
49
- strategy.deploy!
50
-
51
- run "rm -f #{current_path} && ln -s #{latest_release}/www #{current_path}"
52
-
53
- top.deprec.apache.restart
54
- end
55
-
56
- desc 'setup'
57
- task :setup do
58
- dirs = [deploy_to, releases_path]
59
- sudo "mkdir -p #{dirs.join(' ')}"
60
- sudo "chgrp -R #{group} #{dirs.join(' ')}"
61
- sudo "chmod g+w #{dirs.join(' ')}"
62
- end
63
-
64
- desc 'rollback'
65
- task :rollback do
66
- if previous_release
67
- run "rm #{current_path}; ln -s #{previous_release} #{current_path}"
68
- else
69
- abort "could not rollback the code because there is no prior release"
70
- end
71
-
72
- run "if [ `readlink #{current_path}` != #{current_release} ]; then rm -rf #{current_release}; fi"
73
-
74
- top.deprec.apache.restart
75
- end
76
- end
77
-
78
- end
79
- end
80
- end
@@ -1,202 +0,0 @@
1
- Capistrano::Configuration.instance(:must_exist).load do
2
- namespace :chrisrec do
3
- namespace :tomcat do
4
-
5
- set :maven_env, "production"
6
- set :tomcat_war, "MyAppName"
7
-
8
- set :tomcat_address, '127.0.0.1'
9
- set :tomcat_port, 8080
10
- set :tomcat_shutdown_port, 8009
11
- set :tomcat_ssl_port, 8443
12
-
13
- set :local_template_dir, "#{File.dirname(__FILE__)}/../../template"
14
-
15
- desc "Install tomcat"
16
- task :install, :roles => :app do
17
- version = 'apache-tomcat-6.0.20'
18
- set :src_package, {
19
- :file => version + '.tar.gz',
20
- # :md5sum => 'a08851f7fa7b15e92ee6320b7a79c321 tomcat-1.2.2.tar.gz',
21
- :dir => version,
22
- :url => "http://apache.16degrees.com.au/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz",
23
- :unpack => "tar zxf #{version}.tar.gz;"
24
- }
25
-
26
- deprec2.download_src(src_package, src_dir)
27
- deprec2.unpack_src(src_package, src_dir)
28
-
29
- sudo "sudo mv #{src_dir}/#{version} /usr/local/tomcat"
30
-
31
- install_java
32
- end
33
-
34
- task :install_java do
35
- # puts "sudo vi /etc/apt/sources.list"
36
- sudo "chmod 666 /etc/apt/sources.list"
37
- sudo "grep 'multiverse$' /etc/apt/sources.list || sudo echo \"\"\n\"deb http://archive.ubuntu.com/ubuntu/ intrepid multiverse\" >> /etc/apt/sources.list"
38
- sudo "chmod 644 /etc/apt/sources.list"
39
-
40
- apt.update
41
- apt.install( {:base => %w(maven2)}, :stable )
42
-
43
- top.chrisrec.tomcat.deploy.setup
44
-
45
- puts "*******************"
46
- puts "*******************"
47
- puts "******************* cannot automate the sun java install"
48
- puts "******************* run : sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk"
49
- puts "*******************"
50
- puts "*******************"
51
-
52
- end
53
-
54
- # Configure
55
- SYSTEM_CONFIG_FILES[:tomcat] = [
56
- {:template => 'tomcat.erb',
57
- :path => 'tomcat/etc/init.d/tomcat',
58
- :mode => 0755,
59
- :owner => 'root:root'},
60
-
61
- {:template => 'monit.conf.erb',
62
- :path => "tomcat/etc/monit.d/monit_tomcat.conf",
63
- :mode => 0600,
64
- :owner => 'root:root'},
65
-
66
- {:template => 'conf/server.xml.erb',
67
- :path => "conf/server.xml",
68
- :mode => 0644,
69
- :owner => 'root:root'},
70
-
71
- {:template => 'conf/web.xml',
72
- :path => "conf/web.xml",
73
- :mode => 0644,
74
- :owner => 'root:root'},
75
-
76
- {:template => 'temp/empty.txt',
77
- :path => "temp/empty.txt",
78
- :mode => 0644,
79
- :owner => 'root:root'},
80
-
81
- {:template => 'logs/empty.txt',
82
- :path => "logs/empty.txt",
83
- :mode => 0644,
84
- :owner => 'root:root'},
85
-
86
- {:template => 'webapps/empty.txt',
87
- :path => "webapps/empty.txt",
88
- :mode => 0644,
89
- :owner => 'root:root'},
90
-
91
- {:template => 'work/empty.txt',
92
- :path => "work/empty.txt",
93
- :mode => 0644,
94
- :owner => 'root:root'}
95
- ]
96
-
97
- # Generating Configuration Files
98
- desc "Generate configuration file(s) for tomcat from template(s)"
99
- task :config_gen do
100
- SYSTEM_CONFIG_FILES[:tomcat].each do |file|
101
- deprec2.render_template(:tomcat, file)
102
- end
103
- end
104
-
105
- desc 'Deploy configuration files(s) for tomcat'
106
- task :config, :roles => :app do
107
-
108
- deprec2.push_configs(:tomcat, SYSTEM_CONFIG_FILES[:tomcat])
109
- symlink_init_d
110
- symlink_monit_d
111
-
112
- activate
113
- end
114
-
115
- desc "Stop tomcat"
116
- task :stop , :roles => :app do
117
- sudo "/etc/init.d/tomcat_#{tomcat_port} stop"
118
- end
119
-
120
- desc "Start tomcat"
121
- task :start , :roles => :app do
122
- sudo "/etc/init.d/tomcat_#{tomcat_port} start"
123
- end
124
-
125
- desc "Start the tomcat server"
126
- task :restart, :roles => :app do
127
- stop
128
- sleep(2)
129
- start
130
- end
131
-
132
- task :activate, :roles => :app do
133
- send(run_method, "update-rc.d tomcat_#{tomcat_port} defaults")
134
- end
135
-
136
- task :deactivate, :roles => :app do
137
- send(run_method, "update-rc.d -f tomcat_#{tomcat_port} remove")
138
- end
139
-
140
- task :symlink_init_d, :roles => :app do
141
- sudo "ln -fs #{deploy_to}/tomcat/tomcat/etc/init.d/tomcat /etc/init.d/tomcat_#{tomcat_port}"
142
- end
143
-
144
- task :symlink_monit_d, :roles => :app do
145
- sudo "ln -fs #{deploy_to}/tomcat/tomcat/etc/monit.d/monit_tomcat.conf /etc/monit.d/monit_tomcat_#{tomcat_port}.conf"
146
- end
147
-
148
- namespace :deploy do
149
- desc 'deploy'
150
- task :default do
151
- strategy.deploy!
152
-
153
- top.chrisrec.tomcat.stop
154
-
155
- run "rm -f #{current_path} && ln -s #{latest_release} #{current_path}"
156
- if dependent_projects
157
- dependent_projects.each do | project |
158
- name = project.scan(/:(.*)/).flatten.to_s
159
- run "git clone #{project} #{current_path}/#{name}"
160
- run "cd #{current_path}/#{name} && mvn clean -P #{maven_env}"
161
- run "cd #{current_path}/#{name} && mvn compile -P #{maven_env}"
162
- run "cd #{current_path}/#{name} && mvn install -P #{maven_env}"
163
- end
164
- end
165
-
166
- run "cd #{current_path} && mvn clean -P #{maven_env}"
167
- run "cd #{current_path} && mvn compile -P #{maven_env}"
168
- run "cd #{current_path} && mvn package -P #{maven_env}"
169
-
170
- sudo "rm -f #{deploy_to}/tomcat/webapps/#{tomcat_war}.war"
171
- sudo "rm -rf #{deploy_to}/tomcat/webapps/#{tomcat_war}"
172
-
173
- sudo "cp #{current_path}/target/#{tomcat_war}.war #{deploy_to}/tomcat/webapps"
174
-
175
- top.chrisrec.tomcat.start
176
- end
177
-
178
- desc 'setup'
179
- task :setup do
180
- dirs = [deploy_to, releases_path]
181
- sudo "mkdir -p #{dirs.join(' ')}"
182
- sudo "chgrp -R #{group} #{dirs.join(' ')}"
183
- sudo "chmod g+w #{dirs.join(' ')}"
184
- end
185
-
186
- desc 'rollback'
187
- task :rollback do
188
- if previous_release
189
- run "rm #{current_path}; ln -s #{previous_release} #{current_path}"
190
- else
191
- abort "could not rollback the code because there is no prior release"
192
- end
193
-
194
- run "if [ `readlink #{current_path}` != #{current_release} ]; then rm -rf #{current_release}; fi"
195
-
196
- top.chrisrec.tomcat.restart
197
- end
198
- end
199
-
200
- end
201
- end
202
- end
@@ -1,72 +0,0 @@
1
- Capistrano::Configuration.instance(:must_exist).load do
2
- namespace :chrisrec do
3
- namespace :workling do
4
-
5
- set :local_template_dir, "#{File.dirname(__FILE__)}/../../template"
6
-
7
- SYSTEM_CONFIG_FILES[:workling] = [
8
- {:template => 'workling-init-script.erb',
9
- :path => 'workling/etc/init.d/workling',
10
- :mode => 0755,
11
- :owner => 'root:root'},
12
-
13
- {:template => 'monit.conf.erb',
14
- :path => "workling/etc/monit.d/monit_workling.conf",
15
- :mode => 0600,
16
- :owner => 'root:root'}
17
- ]
18
-
19
- # Generating Configuration Files
20
- desc "Generate configuration file(s) for workling from template(s)"
21
- task :config_gen do
22
- SYSTEM_CONFIG_FILES[:workling].each do |file|
23
- deprec2.render_template(:workling, file)
24
- end
25
- end
26
-
27
- desc 'Deploy configuration files(s) for workling'
28
- task :config, :roles => :app do
29
- deprec2.push_configs(:workling, SYSTEM_CONFIG_FILES[:workling])
30
- symlink_init_d
31
- symlink_monit_d
32
-
33
- activate
34
- end
35
-
36
- desc "Stop workling"
37
- task :stop , :roles => :app do
38
- sudo "/etc/init.d/workling_#{starling_port} stop"
39
- end
40
-
41
- desc "Start workling"
42
- task :start , :roles => :app do
43
- sudo "/etc/init.d/workling_#{starling_port} start"
44
- end
45
-
46
- desc "Start the workling server"
47
- task :restart, :roles => :app do
48
- stop
49
- sleep(2)
50
- start
51
- end
52
-
53
- task :activate, :roles => :app do
54
- send(run_method, "update-rc.d workling_#{starling_port} defaults")
55
- end
56
-
57
- task :deactivate, :roles => :app do
58
- send(run_method, "update-rc.d -f workling_#{starling_port} remove")
59
- end
60
-
61
-
62
- task :symlink_init_d do
63
- sudo "ln -fs #{deploy_to}/workling/workling/etc/init.d/workling /etc/init.d/workling_#{starling_port}"
64
- end
65
-
66
- task :symlink_monit_d do
67
- sudo "ln -fs #{deploy_to}/workling/workling/etc/monit.d/monit_workling.conf /etc/monit.d/monit_workling_#{starling_port}.conf"
68
- end
69
-
70
- end
71
- end
72
- end