recipiez 0.0.2 → 0.0.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/recipes/apache.rb CHANGED
@@ -1,41 +1,45 @@
1
- namespace :apache do
2
-
3
- desc "Setup passenger vhost"
4
- task :passenger_vhost do
5
- logger.info "generating .conf file"
6
- logger.info "placing #{application}.conf on remote server"
7
- apache_conf = "/etc/apache2/sites-available/#{application}"
8
- put render("passenger_vhost", binding), "#{application}.conf"
9
- sudo "mv #{application}.conf #{apache_conf}"
10
- sudo "a2ensite #{application}"
11
- sudo "/etc/init.d/apache2 reload"
12
- end
1
+ Capistrano::Configuration.instance(true).load do
2
+
3
+ namespace :apache do
4
+
5
+ desc "Setup passenger vhost"
6
+ task :passenger_vhost do
7
+ logger.info "generating .conf file"
8
+ logger.info "placing #{application}.conf on remote server"
9
+ apache_conf = "/etc/apache2/sites-available/#{application}"
10
+ put render("passenger_vhost", binding), "#{application}.conf"
11
+ sudo "mv #{application}.conf #{apache_conf}"
12
+ sudo "a2ensite #{application}"
13
+ sudo "/etc/init.d/apache2 reload"
14
+ end
13
15
 
14
16
 
15
- desc "PHP Vhost Setup"
16
- task :php_vhost do
17
+ desc "PHP Vhost Setup"
18
+ task :php_vhost do
17
19
 
18
- unless defined? apache_port
19
- set :apache_port, '80'
20
+ unless defined? apache_port
21
+ set :apache_port, '80'
22
+ end
23
+
24
+ logger.info "generating .conf file"
25
+ logger.info "placing #{application}.conf on remote server"
26
+ apache_conf = "/etc/apache2/sites-available/#{application}"
27
+ put render("php_vhost", binding), "#{application}.conf"
28
+ sudo "mv #{application}.conf #{apache_conf}"
29
+ sudo "a2ensite #{application}"
30
+ sudo "/etc/init.d/apache2 reload"
20
31
  end
21
32
 
22
- logger.info "generating .conf file"
23
- logger.info "placing #{application}.conf on remote server"
24
- apache_conf = "/etc/apache2/sites-available/#{application}"
25
- put render("php_vhost", binding), "#{application}.conf"
26
- sudo "mv #{application}.conf #{apache_conf}"
27
- sudo "a2ensite #{application}"
28
- sudo "/etc/init.d/apache2 reload"
29
- end
30
33
 
34
+ desc "enable php"
35
+ task :enable_php do
36
+ put render("php_handler", binding), "phphandler.conf"
37
+ apache_handler = "/etc/apache2/conf.d/phphandler"
38
+ sudo "mv phphandler.conf #{apache_handler}"
39
+ sudo "/etc/init.d/apache2 force-reload"
40
+ end
31
41
 
32
- desc "enable php"
33
- task :enable_php do
34
- put render("php_handler", binding), "phphandler.conf"
35
- apache_handler = "/etc/apache2/conf.d/phphandler"
36
- sudo "mv phphandler.conf #{apache_handler}"
37
- sudo "/etc/init.d/apache2 force-reload"
38
- end
39
42
 
43
+ end
40
44
 
41
45
  end
data/recipes/chef.rb CHANGED
@@ -1,8 +1,12 @@
1
- namespace :chef do
2
-
3
- desc "Runs chef client on all the app servers"
4
- task :client do
5
- sudo "chef-client"
1
+ Capistrano::Configuration.instance(true).load do
2
+
3
+ namespace :chef do
4
+
5
+ desc "Runs chef client on all the app servers"
6
+ task :client do
7
+ sudo "chef-client"
8
+ end
9
+
6
10
  end
7
-
8
- end
11
+
12
+ end
@@ -6,8 +6,10 @@ require 'activecollab_notifier'
6
6
  # Hook them into your deploy script with the *after* function.
7
7
  # Author: Alastair Brunton
8
8
 
9
+ Capistrano::Configuration.instance(true).load do
10
+
9
11
  namespace :recipiez do
10
-
12
+
11
13
  desc "generate config file used for db syncing etc"
12
14
  task :generate_config do
13
15
  if File.exists?('config/recipiez.yml')
@@ -16,8 +18,8 @@ namespace :recipiez do
16
18
  `cp vendor/plugins/deployment_recipiez/recipes/templates/recipiez.yml.example config/recipiez.yml`
17
19
  end
18
20
  end
19
-
20
-
21
+
22
+
21
23
  desc "Rename db file for deployment."
22
24
  task :rename_db_file do
23
25
  run "cp #{release_path}/config/database.#{rails_env} #{release_path}/config/database.yml"
@@ -38,10 +40,10 @@ namespace :recipiez do
38
40
  basecamp_auth, current_revision, get_rev_log)
39
41
  basecamp_notifier.notify
40
42
  end
41
-
43
+
42
44
  # You need to add the below line to your deploy.rb
43
- # set :activecollab_options, {:base_url => "http://projects.bla.com",
44
- # :project_id => 5, :ticket_id => 10,
45
+ # set :activecollab_options, {:base_url => "http://projects.bla.com",
46
+ # :project_id => 5, :ticket_id => 10,
45
47
  # :username => 'bla', :password => 'bla'}
46
48
  desc "Update activecollab with information of the deployment."
47
49
  task :update_activecollab do
@@ -183,46 +185,48 @@ namespace :recipiez do
183
185
  end
184
186
 
185
187
  end
186
-
188
+
187
189
  desc "Install bundler"
188
190
  task :bundler do
189
191
  sudo "gem install bundler --no-rdoc --no-ri"
190
192
  end
191
-
193
+
192
194
  desc "Install libxml and headers"
193
195
  task :libxml do
194
196
  sudo "apt-get install -y libxml2 libxml2-dev libxslt1-dev"
195
197
  end
196
-
197
-
198
+
199
+
198
200
  desc "Setup /var/www/apps"
199
201
  task :app_dir do
200
- sudo <<-CMD
201
- if [ ! -d "/var/www/apps" ]; then
202
- sudo mkdir -p /var/www/apps
202
+ sudo <<-CMD
203
+ if [ ! -d "/var/www/apps" ]; then
204
+ sudo mkdir -p /var/www/apps
203
205
  fi
204
- CMD
205
- sudo "chown -R #{user}:#{user} /var/www/apps"
206
- end
207
-
208
- desc "Add user to www-data group"
209
- task :www_group do
210
- sudo "sudo usermod -a -G www-data #{user}"
211
- sudo "sudo usermod -a -G #{user} www-data"
212
- end
206
+ CMD
207
+ sudo "chown -R #{user}:#{user} /var/www/apps"
208
+ end
213
209
 
214
- desc "Setup the deployment directories and fix permissions"
215
- task :setup do
216
- deploy::setup
217
- sudo "chown -R #{user}:#{user} #{deploy_to}"
218
- end
210
+ desc "Add user to www-data group"
211
+ task :www_group do
212
+ sudo "sudo usermod -a -G www-data #{user}"
213
+ sudo "sudo usermod -a -G #{user} www-data"
214
+ end
219
215
 
220
- end
216
+ desc "Setup the deployment directories and fix permissions"
217
+ task :setup do
218
+ deploy::setup
219
+ sudo "chown -R #{user}:#{user} #{deploy_to}"
220
+ end
221
221
 
222
- namespace :deploy do
223
- task :restart do
224
- # override this task
225
222
  end
223
+
224
+ namespace :deploy do
225
+ task :restart do
226
+ # override this task
227
+ end
228
+ end
229
+
226
230
  end
227
231
 
228
232
  # Internal helper to shell out and run a query. Doesn't select a database.
@@ -282,11 +286,11 @@ end
282
286
 
283
287
 
284
288
  def set_variables_from_yaml
285
-
289
+
286
290
  unless File.exists?("config/recipiez.yml")
287
291
  raise StandardError, "You need a config/recipiez.yml file which defines the database syncing settings. Run recipiez:generate_config"
288
292
  end
289
-
293
+
290
294
  global = YAML.load_file("config/recipiez.yml")
291
295
  app_config = global[rails_env]
292
296
  app_config.each_pair do |key, value|
data/recipes/logrotate.rb CHANGED
@@ -1,9 +1,13 @@
1
- namespace :logrotate do
2
- desc "Configures logrotate for the application"
3
- task :configure, :roles => :app do
4
- generated = render('logrotate', binding)
5
- puts generated
6
- put generated, "#{application}"
7
- sudo "mv #{application} /etc/logrotate.d/#{application}"
1
+ Capistrano::Configuration.instance(true).load do
2
+
3
+ namespace :logrotate do
4
+ desc "Configures logrotate for the application"
5
+ task :configure, :roles => :app do
6
+ generated = render('logrotate', binding)
7
+ puts generated
8
+ put generated, "#{application}"
9
+ sudo "mv #{application} /etc/logrotate.d/#{application}"
10
+ end
8
11
  end
9
- end
12
+
13
+ end
data/recipes/monit.rb CHANGED
@@ -1,46 +1,50 @@
1
- namespace :monit do
2
-
3
- desc "configures monit for nginx"
4
- task :nginx, :roles => :web do
5
- put render('nginx_monit', binding), "nginx.conf"
6
- sudo "mv nginx.conf /etc/monit/conf.d/nginx.conf"
7
- sudo "/etc/init.d/monit restart"
1
+ Capistrano::Configuration.instance(true).load do
2
+
3
+ namespace :monit do
4
+
5
+ desc "configures monit for nginx"
6
+ task :nginx, :roles => :web do
7
+ put render('nginx_monit', binding), "nginx.conf"
8
+ sudo "mv nginx.conf /etc/monit/conf.d/nginx.conf"
9
+ sudo "/etc/init.d/monit restart"
10
+ end
11
+
12
+ desc "configures monit for thin"
13
+ task :thin, :roles => :web do
14
+ put render('thin_monit', binding), "#{application}.conf"
15
+ sudo "mv #{application}.conf /etc/monit/conf.d/#{application}.conf"
16
+ sudo "/etc/init.d/monit restart"
17
+ end
18
+
19
+ desc "configures monit for apache"
20
+ task :apache, :roles => :web do
21
+ put render('apache_monit', binding), "apache_monit.conf"
22
+ sudo "mv apache_monit.conf /etc/monit/conf.d/apache_monit.conf"
23
+ sudo "/etc/init.d/monit restart"
24
+ end
25
+
26
+ desc "configures monit for mysql"
27
+ task :mysql, :roles => :db do
28
+ put render("mysql_monit", binding), "mysql_monit.conf"
29
+ sudo "mv mysql_monit.conf /etc/monit/conf.d/mysql_monit.conf"
30
+ sudo "/etc/init.d/monit restart"
31
+ end
32
+
33
+ desc "configures monit for mysql"
34
+ task :sshd, :roles => :web do
35
+ put render("sshd_monit", binding), "sshd_monit.conf"
36
+ sudo "mv sshd_monit.conf /etc/monit/conf.d/sshd_monit.conf"
37
+ sudo "/etc/init.d/monit restart"
38
+ end
39
+
40
+ task :configure, :roles => :web do
41
+ put render("monit_config", binding), 'monitrc'
42
+ sudo "mv monitrc /etc/monit/monitrc"
43
+ sudo "chown root:root /etc/monit/monitrc"
44
+ sudo "/etc/init.d/monit restart"
45
+ end
46
+
47
+
8
48
  end
9
-
10
- desc "configures monit for thin"
11
- task :thin, :roles => :web do
12
- put render('thin_monit', binding), "#{application}.conf"
13
- sudo "mv #{application}.conf /etc/monit/conf.d/#{application}.conf"
14
- sudo "/etc/init.d/monit restart"
15
- end
16
-
17
- desc "configures monit for apache"
18
- task :apache, :roles => :web do
19
- put render('apache_monit', binding), "apache_monit.conf"
20
- sudo "mv apache_monit.conf /etc/monit/conf.d/apache_monit.conf"
21
- sudo "/etc/init.d/monit restart"
22
- end
23
-
24
- desc "configures monit for mysql"
25
- task :mysql, :roles => :db do
26
- put render("mysql_monit", binding), "mysql_monit.conf"
27
- sudo "mv mysql_monit.conf /etc/monit/conf.d/mysql_monit.conf"
28
- sudo "/etc/init.d/monit restart"
29
- end
30
-
31
- desc "configures monit for mysql"
32
- task :sshd, :roles => :web do
33
- put render("sshd_monit", binding), "sshd_monit.conf"
34
- sudo "mv sshd_monit.conf /etc/monit/conf.d/sshd_monit.conf"
35
- sudo "/etc/init.d/monit restart"
36
- end
37
-
38
- task :configure, :roles => :web do
39
- put render("monit_config", binding), 'monitrc'
40
- sudo "mv monitrc /etc/monit/monitrc"
41
- sudo "chown root:root /etc/monit/monitrc"
42
- sudo "/etc/init.d/monit restart"
43
- end
44
-
45
-
46
- end
49
+
50
+ end
data/recipes/nginx.rb CHANGED
@@ -1,35 +1,37 @@
1
- namespace :nginx do
2
- desc "configures a vhost for the app, needs - num_servers, start_port"
3
- task :configure, :roles => :web do
4
- put render("nginx_vhost", binding), "#{application}.conf"
5
- sudo "mv #{application}.conf /etc/nginx/sites-available/#{application}.conf"
6
- begin
7
- sudo "ln -s /etc/nginx/sites-available/#{application}.conf /etc/nginx/sites-enabled/#{application}.conf"
8
- rescue
9
- # do nothing
10
- end
11
-
12
- begin
13
- stop
14
- rescue
15
- # do nothing
1
+ Capistrano::Configuration.instance(true).load do
2
+ namespace :nginx do
3
+ desc "configures a vhost for the app, needs - num_servers, start_port"
4
+ task :configure, :roles => :web do
5
+ put render("nginx_vhost", binding), "#{application}.conf"
6
+ sudo "mv #{application}.conf /etc/nginx/sites-available/#{application}.conf"
7
+ begin
8
+ sudo "ln -s /etc/nginx/sites-available/#{application}.conf /etc/nginx/sites-enabled/#{application}.conf"
9
+ rescue
10
+ # do nothing
11
+ end
12
+
13
+ begin
14
+ stop
15
+ rescue
16
+ # do nothing
17
+ end
18
+
19
+ begin
20
+ start
21
+ rescue
22
+ # do nothing
23
+ end
16
24
  end
17
25
 
18
- begin
19
- start
20
- rescue
21
- # do nothing
26
+ desc "Starts Nginx webserver"
27
+ task :start, :roles => :web do
28
+ sudo "/etc/init.d/nginx start"
22
29
  end
23
- end
24
30
 
25
- desc "Starts Nginx webserver"
26
- task :start, :roles => :web do
27
- sudo "/etc/init.d/nginx start"
28
- end
31
+ desc "Stops Nginx webserver"
32
+ task :stop, :roles => :web do
33
+ sudo "/etc/init.d/nginx stop"
34
+ end
29
35
 
30
- desc "Stops Nginx webserver"
31
- task :stop, :roles => :web do
32
- sudo "/etc/init.d/nginx stop"
33
36
  end
34
-
35
- end
37
+ end
data/recipes/thin.rb CHANGED
@@ -1,37 +1,40 @@
1
- namespace :thin do
2
-
3
- desc "configures thin, requires num_servers and start_port"
4
- task :configure, :roles => :app do
5
- sudo "thin config -C /etc/thin/#{application}.yml -c #{current_path} --servers #{num_servers} -e #{rails_env} --port #{start_port}"
6
- end
7
-
8
- desc "configures thin with rackup eg. Sinatra. Requires thin_port, rack_env"
9
- task :configure_rack, :roles => :app do
10
- sudo "thin config -C /etc/thin/#{application}.yml -c #{current_path} --servers #{num_servers} --port #{start_port} -e #{rack_env} -R #{current_path}/config.ru"
11
- end
12
-
13
- desc "install thin"
14
- task :install, :roles => :app do
15
- sudo "gem install thin"
16
- sudo "thin install"
17
- sudo "/usr/sbin/update-rc.d -f thin defaults"
18
- end
19
-
20
- desc "start thin"
21
- task :start, :roles => :app do
22
- sudo "/etc/init.d/thin start"
23
- sudo "/usr/bin/ruby /usr/bin/thin start -C /etc/thin/#{application}.yml"
24
- end
25
-
26
- desc "stop thin"
27
- task :stop, :roles => :app do
28
- sudo "/usr/bin/ruby /usr/bin/thin stop -C /etc/thin/#{application}.yml"
29
- end
30
-
31
- desc "restart thin"
32
- task :restart, :roles => :app do
33
- sudo "/usr/bin/ruby /usr/bin/thin restart -C /etc/thin/#{application}.yml"
34
- end
1
+ Capistrano::Configuration.instance(true).load do
2
+
3
+ namespace :thin do
4
+
5
+ desc "configures thin, requires num_servers and start_port"
6
+ task :configure, :roles => :app do
7
+ sudo "thin config -C /etc/thin/#{application}.yml -c #{current_path} --servers #{num_servers} -e #{rails_env} --port #{start_port}"
8
+ end
35
9
 
36
-
10
+ desc "configures thin with rackup eg. Sinatra. Requires thin_port, rack_env"
11
+ task :configure_rack, :roles => :app do
12
+ sudo "thin config -C /etc/thin/#{application}.yml -c #{current_path} --servers #{num_servers} --port #{start_port} -e #{rack_env} -R #{current_path}/config.ru"
13
+ end
14
+
15
+ desc "install thin"
16
+ task :install, :roles => :app do
17
+ sudo "gem install thin"
18
+ sudo "thin install"
19
+ sudo "/usr/sbin/update-rc.d -f thin defaults"
20
+ end
21
+
22
+ desc "start thin"
23
+ task :start, :roles => :app do
24
+ sudo "/etc/init.d/thin start"
25
+ sudo "/usr/bin/ruby /usr/bin/thin start -C /etc/thin/#{application}.yml"
26
+ end
27
+
28
+ desc "stop thin"
29
+ task :stop, :roles => :app do
30
+ sudo "/usr/bin/ruby /usr/bin/thin stop -C /etc/thin/#{application}.yml"
31
+ end
32
+
33
+ desc "restart thin"
34
+ task :restart, :roles => :app do
35
+ sudo "/usr/bin/ruby /usr/bin/thin restart -C /etc/thin/#{application}.yml"
36
+ end
37
+
38
+
39
+ end
37
40
  end
data/recipes/tolk.rb CHANGED
@@ -1,13 +1,17 @@
1
- namespace :tolk do
2
-
3
- desc "Runs tolk:sync on the remove server. Useful for when you update"
4
- task :sync do
5
- run "cd #{current_path};rake tolk:sync RAILS_ENV=#{rails_env}"
1
+ Capistrano::Configuration.instance(true).load do
2
+
3
+ namespace :tolk do
4
+
5
+ desc "Runs tolk:sync on the remove server. Useful for when you update"
6
+ task :sync do
7
+ run "cd #{current_path};rake tolk:sync RAILS_ENV=#{rails_env}"
8
+ end
9
+
10
+ desc "Runs tolk:dump_all on the remove server. Useful for when you update"
11
+ task :dump_all do
12
+ run "cd #{current_path};rake tolk:dump_all RAILS_ENV=#{rails_env}"
13
+ end
14
+
6
15
  end
7
-
8
- desc "Runs tolk:dump_all on the remove server. Useful for when you update"
9
- task :dump_all do
10
- run "cd #{current_path};rake tolk:dump_all RAILS_ENV=#{rails_env}"
11
- end
12
-
13
- end
16
+
17
+ end
data/recipiez.gemspec CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "recipiez"
7
- s.version = "0.0.2"
7
+ s.version = "0.0.3"
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Alastair Brunton"]
10
10
  s.email = ["info@simplyexcited.co.uk"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recipiez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: