winton-ubistrano 1.2.3 → 1.2.4
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/README.markdown +14 -6
 - data/lib/ubistrano/deploy.rb +1 -0
 - data/lib/ubistrano/helpers.rb +3 -0
 - data/lib/ubistrano/log.rb +1 -1
 - data/lib/ubistrano/mysql.rb +3 -3
 - data/lib/ubistrano/sinatra.rb +14 -0
 - data/templates/rails/database.yml.erb +2 -2
 - data/templates/sinatra/config.ru.erb +2 -2
 - data/ubistrano.gemspec +1 -1
 - metadata +1 -1
 
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -41,8 +41,10 @@ Getting started 
     | 
|
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
            ### Ubify your project
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
                : 
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
      
 116 
     | 
    
         
            +
            <pre>
         
     | 
| 
      
 117 
     | 
    
         
            +
            cap ubuntu
         
     | 
| 
      
 118 
     | 
    
         
            +
            </pre>
         
     | 
| 
       111 
119 
     | 
    
         | 
| 
       112 
120 
     | 
    
         
             
            ### Example output
         
     | 
| 
       113 
121 
     | 
    
         | 
    
        data/lib/ubistrano/deploy.rb
    CHANGED
    
    
    
        data/lib/ubistrano/helpers.rb
    CHANGED
    
    | 
         @@ -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(: 
     | 
| 
      
 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',
         
     | 
    
        data/lib/ubistrano/mysql.rb
    CHANGED
    
    | 
         @@ -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 '#{ 
     | 
| 
      
 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=#{ 
     | 
| 
      
 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#{ 
     | 
| 
      
 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 
     | 
    
         | 
    
        data/lib/ubistrano/sinatra.rb
    CHANGED
    
    | 
         @@ -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}"
         
     | 
| 
         @@ -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 => ' 
     | 
| 
      
 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 ' 
     | 
| 
      
 18 
     | 
    
         
            +
            require 'init'
         
     | 
| 
       19 
19 
     | 
    
         
             
            run Sinatra.application
         
     | 
    
        data/ubistrano.gemspec
    CHANGED