capistrano-postgresql 4.8.1 → 4.9.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.
- checksums.yaml +4 -4
 - data/README.md +9 -12
 - data/lib/capistrano/postgresql/helper_methods.rb +3 -3
 - data/lib/capistrano/postgresql/version.rb +1 -1
 - data/lib/capistrano/tasks/postgresql.rake +17 -9
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 375eca70ee0863b2ac3397cb4405ed44cd64f4039e563e7022ee254b4c804221
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: efc67d023365b4c9d106d176c7cd3874b6911bf6b1ca0a2fb60d1f1eeff6a3b4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c7cd4f58152e609273af9732f6e2bdffde273c4c2ce3c7f0e4d674bcd1026d9ae14f85a81a13ddbc455f031531b2ac8b01b34ba36f94532c1b050d1ad19732ca
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4a16961feefadef88c15d545e20a0ea0274e7c3d3c7dd194186a66d3180d0e58f93f10b08d378a92adaaaf05a5100e301bede93f217d8497416cddc50a720d54
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -42,20 +42,17 @@ Then: 
     | 
|
| 
       42 
42 
     | 
    
         
             
            If you're deploying a standard rails app, all you need to do is put
         
     | 
| 
       43 
43 
     | 
    
         
             
            the following in `Capfile` file:
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
      
 45 
     | 
    
         
            +
            ```
         
     | 
| 
      
 46 
     | 
    
         
            +
            require 'capistrano/postgresql' 
         
     | 
| 
      
 47 
     | 
    
         
            +
            ```
         
     | 
| 
       46 
48 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
            Make sure the `deploy_to` path exists and has the right privileges on the
         
     | 
| 
       48 
     | 
    
         
            -
            server (i.e. `/var/www/myapp`). Warning: The ~ symbol (i.e. `~/myapp`) is not supported 
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
            * Make sure the `deploy_to` path exists and has the right privileges on the
         
     | 
| 
      
 50 
     | 
    
         
            +
            server (i.e. `/var/www/myapp`). Warning: The ~ symbol (i.e. `~/myapp`) is not supported.
         
     | 
| 
      
 51 
     | 
    
         
            +
            * Within your app/config/deploy/{env}.rb files, you need to specify at least one :app and one :db server. 
         
     | 
| 
      
 52 
     | 
    
         
            +
            * It's also suggested to specify `:primary => true` on the end of your primary :db server line.
         
     | 
| 
      
 53 
     | 
    
         
            +
            * Optionally, you can run psql commands WITHOUT sudo if needed. Set the following (which defaults to false): `set :pg_without_sudo, true`
         
     | 
| 
       52 
54 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
            Optionally, you can run psql commands WITHOUT sudo if needed. Set the following:
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                set :pg_without_sudo, true # defaults to false
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
            To setup the server(s), run:
         
     | 
| 
      
 55 
     | 
    
         
            +
            Finally, to setup the server(s), run:
         
     | 
| 
       59 
56 
     | 
    
         | 
| 
       60 
57 
     | 
    
         
             
                $ bundle exec cap production setup
         
     | 
| 
       61 
58 
     | 
    
         | 
| 
         @@ -49,13 +49,13 @@ module Capistrano 
     | 
|
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
                  # location of database.yml file on clients
         
     | 
| 
       51 
51 
     | 
    
         
             
                  def database_yml_file
         
     | 
| 
       52 
     | 
    
         
            -
                    raise(":deploy_to in your app/config/deploy 
     | 
| 
      
 52 
     | 
    
         
            +
                    raise(":deploy_to in your app/config/deploy/#{fetch(:rails_env)}.rb file cannot contain ~") if shared_path.to_s.include?('~') # issues/27
         
     | 
| 
       53 
53 
     | 
    
         
             
                    shared_path.join('config/database.yml')
         
     | 
| 
       54 
54 
     | 
    
         
             
                  end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                  # location of  
     | 
| 
      
 56 
     | 
    
         
            +
                  # location of archetypal database.yml file created on primary db role when user and database are first created
         
     | 
| 
       57 
57 
     | 
    
         
             
                  def archetype_database_yml_file
         
     | 
| 
       58 
     | 
    
         
            -
                    raise(":deploy_to in your app/config/deploy 
     | 
| 
      
 58 
     | 
    
         
            +
                    raise(":deploy_to in your app/config/deploy/#{fetch(:rails_env)}.rb file cannot contain ~") if shared_path.to_s.include?('~') # issues/27
         
     | 
| 
       59 
59 
     | 
    
         
             
                    deploy_path.join('db/database.yml')
         
     | 
| 
       60 
60 
     | 
    
         
             
                  end
         
     | 
| 
       61 
61 
     | 
    
         
             
                end
         
     | 
| 
         @@ -123,7 +123,7 @@ namespace :postgresql do 
     | 
|
| 
       123 
123 
     | 
    
         
             
                  next if db_user_exists?
         
     | 
| 
       124 
124 
     | 
    
         
             
                  # If you use CREATE USER instead of CREATE ROLE the LOGIN right is granted automatically; otherwise you must specify it in the WITH clause of the CREATE statement.
         
     | 
| 
       125 
125 
     | 
    
         
             
                  unless psql_on_db fetch(:pg_system_db), '-c', %Q{"CREATE USER \\"#{fetch(:pg_username)}\\" PASSWORD '#{fetch(:pg_password)}';"}
         
     | 
| 
       126 
     | 
    
         
            -
                    error  
     | 
| 
      
 126 
     | 
    
         
            +
                    error "postgresql: creating database user \"#{fetch(:pg_username)}\" failed!"
         
     | 
| 
       127 
127 
     | 
    
         
             
                    exit 1
         
     | 
| 
       128 
128 
     | 
    
         
             
                  end
         
     | 
| 
       129 
129 
     | 
    
         
             
                end
         
     | 
| 
         @@ -165,14 +165,22 @@ namespace :postgresql do 
     | 
|
| 
       165 
165 
     | 
    
         | 
| 
       166 
166 
     | 
    
         
             
              desc 'Postgresql setup tasks'
         
     | 
| 
       167 
167 
     | 
    
         
             
              task :setup do
         
     | 
| 
       168 
     | 
    
         
            -
                puts "* ============================= * \n All psql commands will be run #{fetch(:pg_without_sudo) ? 'without sudo' : 'with sudo'}\n You can modify this in your deploy 
     | 
| 
       169 
     | 
    
         
            -
                 
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
       171 
     | 
    
         
            -
                 
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
      
 168 
     | 
    
         
            +
                puts "* ============================= * \n All psql commands will be run #{fetch(:pg_without_sudo) ? 'without sudo' : 'with sudo'}\n You can modify this in your app/config/deploy/#{fetch(:rails_env)}.rb by setting the pg_without_sudo boolean \n* ============================= *"
         
     | 
| 
      
 169 
     | 
    
         
            +
                if release_roles(:app).empty?
         
     | 
| 
      
 170 
     | 
    
         
            +
                  puts "There are no servers in your app/config/deploy/#{fetch(:rails_env)}.rb with a :app role... Skipping Postgresql setup."
         
     | 
| 
      
 171 
     | 
    
         
            +
                else
         
     | 
| 
      
 172 
     | 
    
         
            +
                  invoke 'postgresql:remove_app_database_yml_files' # Deletes old yml files from all servers. Allows you to avoid having to manually delete the files on your app servers to get a new pool size for example. Don't touch the archetype file to avoid deleting generated passwords.
         
     | 
| 
      
 173 
     | 
    
         
            +
                  if release_roles(:db).empty? # Test to be sure we have a :db role host
         
     | 
| 
      
 174 
     | 
    
         
            +
                    puts "There is no server in your app/config/deploy/#{fetch(:rails_env)}.rb with a :db role... Skipping Postgresql setup."
         
     | 
| 
      
 175 
     | 
    
         
            +
                  else
         
     | 
| 
      
 176 
     | 
    
         
            +
                    invoke 'postgresql:create_db_user'
         
     | 
| 
      
 177 
     | 
    
         
            +
                    invoke 'postgresql:create_database'
         
     | 
| 
      
 178 
     | 
    
         
            +
                    invoke 'postgresql:add_hstore'
         
     | 
| 
      
 179 
     | 
    
         
            +
                    invoke 'postgresql:add_extensions'
         
     | 
| 
      
 180 
     | 
    
         
            +
                    invoke 'postgresql:generate_database_yml_archetype'
         
     | 
| 
      
 181 
     | 
    
         
            +
                    invoke 'postgresql:generate_database_yml'
         
     | 
| 
      
 182 
     | 
    
         
            +
                  end
         
     | 
| 
      
 183 
     | 
    
         
            +
                end
         
     | 
| 
       176 
184 
     | 
    
         
             
              end
         
     | 
| 
       177 
185 
     | 
    
         
             
            end
         
     | 
| 
       178 
186 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: capistrano-postgresql
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 4.9.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Bruno Sutic
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2018- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2018-03-09 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: capistrano
         
     |