winton-ubistrano 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -41,8 +41,10 @@ Getting started
41
41
 
42
42
  ### Ubify your project
43
43
 
44
- cd your\_project
45
- ubify .
44
+ <pre>
45
+ cd your_project
46
+ ubify .
47
+ </pre>
46
48
 
47
49
  * Runs <code>capify</code>
48
50
  * Creates <code>config/deploy.example.rb</code>
@@ -64,7 +66,9 @@ set :ubistrano, {
64
66
  },
65
67
 
66
68
  :mysql => {
67
- :password => ''
69
+ :root_password => '',
70
+ :app_password => ''
71
+ # Ubistrano creates a mysql user for each app
68
72
  },
69
73
 
70
74
  :production => {
@@ -84,7 +88,7 @@ require 'ubistrano'
84
88
 
85
89
  Ubistrano uses the same Capistrano options you've come to love, but provides defaults and a few extra options as well.
86
90
 
87
- Edit deploy.rb to the best of your ability. If setting up an EC2 instance, be sure to provide your AWS keys. Your IP address will be provided later.
91
+ Edit deploy.rb to the best of your ability. If setting up an EC2 instance, be sure to provide your AWS keys. Your IP address will be provided later. Provide passwords even if they haven't been created yet.
88
92
 
89
93
  Feel free to move any options into or out of the stage groups.
90
94
 
@@ -93,7 +97,9 @@ Create your EC2 instance
93
97
 
94
98
  ### From your app directory
95
99
 
96
- cap ec2
100
+ <pre>
101
+ cap ec2
102
+ </pre>
97
103
 
98
104
  ### Example output
99
105
 
@@ -107,7 +113,9 @@ Set up your Ubuntu Hardy server
107
113
 
108
114
  ### From your app directory
109
115
 
110
- cap ubuntu
116
+ <pre>
117
+ cap ubuntu
118
+ </pre>
111
119
 
112
120
  ### Example output
113
121
 
@@ -39,6 +39,7 @@ Capistrano::Configuration.instance(:must_exist).load do
39
39
  apache.virtual_host.create
40
40
  deploy.start
41
41
  apache.reload
42
+ puts space(msg(:logrotate_suggest))
42
43
  end
43
44
 
44
45
  desc "Stop servers and destroy all files"
@@ -209,6 +209,9 @@ See #{File.expand_path '../../', File.dirname(__FILE__)}/templates/ubuntu/iptabl
209
209
  when :logrotate
210
210
  "May I add a logrotate entry for this application?
211
211
  See #{File.expand_path '../../', File.dirname(__FILE__)}/templates/log/rotate.conf.erb"
212
+ when :logrotate_suggest
213
+ "All finished! Run `cap log:rotate` to add log rotating.
214
+ "
212
215
  when :mysqltuner
213
216
  "Would you like to install MySQLTuner and receive instructions for running it?"
214
217
  when :mysqltuner_instructions
data/lib/ubistrano/log.rb CHANGED
@@ -3,7 +3,7 @@ Capistrano::Configuration.instance(:must_exist).load do
3
3
  namespace :log do
4
4
  desc "Add logrotate entry for this application"
5
5
  task :rotate, :roles => :app do
6
- if yes(msg(:iptables))
6
+ if yes(msg(:logrotate))
7
7
  upload_from_erb '/etc/rotate.conf', binding, :folder => 'log'
8
8
  sudo_each [
9
9
  'cp -f /etc/logrotate.conf /etc/logrotate2.conf',
@@ -16,7 +16,7 @@ Capistrano::Configuration.instance(:must_exist).load do
16
16
  desc "Create database user"
17
17
  task :user, :roles => :db do
18
18
  mysql_run [
19
- "CREATE USER '#{application}'@'localhost' IDENTIFIED BY '#{mysql_password}'",
19
+ "CREATE USER '#{application}'@'localhost' IDENTIFIED BY '#{mysql_app_password}'",
20
20
  "GRANT ALL PRIVILEGES ON #{db_table}.* TO '#{application}'@'localhost'"
21
21
  ]
22
22
  end
@@ -57,7 +57,7 @@ Capistrano::Configuration.instance(:must_exist).load do
57
57
 
58
58
  desc "Restore remote database from backup"
59
59
  task :restore, :roles => :db do
60
- run_each "bunzip2 < #{shared_path}/db_backups/#{backup_name}.bz2 | mysql -u #{application} --password=#{mysql_password} #{db_table}"
60
+ run_each "bunzip2 < #{shared_path}/db_backups/#{backup_name}.bz2 | mysql -u #{application} --password=#{mysql_app_password} #{db_table}"
61
61
  end
62
62
 
63
63
  desc "Backup database to local"
@@ -71,7 +71,7 @@ Capistrano::Configuration.instance(:must_exist).load do
71
71
  task :to_server, :roles => :db do
72
72
  run_each [
73
73
  "mkdir -p #{shared_path}/db_backups",
74
- "mysqldump --add-drop-table -u #{application} -p#{mysql_password} #{db_table}_production | bzip2 -c > #{shared_path}/db_backups/#{backup_name}.bz2"
74
+ "mysqldump --add-drop-table -u #{application} -p#{mysql_app_password} #{db_table}_production | bzip2 -c > #{shared_path}/db_backups/#{backup_name}.bz2"
75
75
  ]
76
76
  end
77
77
 
@@ -15,6 +15,20 @@ Capistrano::Configuration.instance(:must_exist).load do
15
15
  upload_from_erb "#{shared_path}/config/config.ru", binding, :folder => 'sinatra'
16
16
  end
17
17
 
18
+ desc "Creates database.yml in the shared config"
19
+ task :database, :roles => :app do
20
+ run "mkdir -p #{shared_path}/config"
21
+ Dir[File.expand_path('../../templates/rails/*', File.dirname(__FILE__))].each do |f|
22
+ upload_from_erb "#{shared_path}/config/#{File.basename(f, '.erb')}", binding, :folder => 'rails'
23
+ end
24
+ end
25
+
26
+ desc "Creates config.ru in shared config"
27
+ task :rack, :roles => :app do
28
+ run "mkdir -p #{shared_path}/config"
29
+ upload_from_erb "#{shared_path}/config/config.ru", binding, :folder => 'sinatra'
30
+ end
31
+
18
32
  desc "Copies files in the shared config folder into our app"
19
33
  task :to_app, :roles => :app do
20
34
  run "cp -Rf #{shared_path}/config/* #{release_path}"
@@ -1,8 +1,8 @@
1
1
  development: &defaults
2
2
  adapter: mysql
3
3
  database: <%= db_table %>
4
- username: <%= user %>
5
- password: <%= mysql_password %>
4
+ username: <%= application %>
5
+ password: <%= mysql_app_password %>
6
6
  host: localhost
7
7
  socket: /var/run/mysqld/mysqld.sock
8
8
 
@@ -5,7 +5,7 @@ Sinatra::Application.default_options.merge!(
5
5
  :run => false,
6
6
  :env => :production,
7
7
  :raise_errors => true,
8
- :app_file => 'app.rb',
8
+ :app_file => 'init.rb',
9
9
  :root => '<%= deploy_to %>/current',
10
10
  :views => '<%= deploy_to %>/current/views',
11
11
  :public => '<%= deploy_to %>/current/public'
@@ -15,5 +15,5 @@ log = File.new('<%= deploy_to %>/shared/log/sinatra.log', 'a')
15
15
  STDOUT.reopen(log)
16
16
  STDERR.reopen(log)
17
17
 
18
- require 'app'
18
+ require 'init'
19
19
  run Sinatra.application
data/ubistrano.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ubistrano'
3
- s.version = '1.2.3'
3
+ s.version = '1.2.4'
4
4
  s.date = '2008-02-22'
5
5
 
6
6
  s.summary = "Provision and deploy to an Ubuntu/God/Apache/Passenger stack using Capistrano"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: winton-ubistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh