ey-deploy 0.2.4.pre2 → 0.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/LICENSE +1 -1
 - data/lib/ey-deploy/deploy.rb +5 -7
 - data/lib/ey-deploy/strategies/git.rb +32 -1
 - data/lib/ey-deploy/version.rb +1 -1
 - metadata +11 -14
 
    
        data/LICENSE
    CHANGED
    
    
    
        data/lib/ey-deploy/deploy.rb
    CHANGED
    
    | 
         @@ -34,18 +34,15 @@ module EY 
     | 
|
| 
       34 
34 
     | 
    
         
             
                # task
         
     | 
| 
       35 
35 
     | 
    
         
             
                def restart
         
     | 
| 
       36 
36 
     | 
    
         
             
                  puts "~> Restarting app servers"
         
     | 
| 
      
 37 
     | 
    
         
            +
                  puts "~> restarting app: #{c.latest_release}"
         
     | 
| 
       37 
38 
     | 
    
         
             
                  roles :app_master, :app, :solo do
         
     | 
| 
       38 
39 
     | 
    
         
             
                    restart_command = case c.stack
         
     | 
| 
       39 
40 
     | 
    
         
             
                    when "nginx_unicorn"
         
     | 
| 
       40 
     | 
    
         
            -
                      "/etc/init.d/unicorn_#{c.app}  
     | 
| 
      
 41 
     | 
    
         
            +
                      sudo("/etc/init.d/unicorn_#{c.app} deploy")
         
     | 
| 
       41 
42 
     | 
    
         
             
                    when "nginx_mongrel"
         
     | 
| 
       42 
     | 
    
         
            -
                      "monit restart all -g #{c.app}"
         
     | 
| 
      
 43 
     | 
    
         
            +
                      sudo("monit restart all -g #{c.app}")
         
     | 
| 
       43 
44 
     | 
    
         
             
                    when "nginx_passenger", "apache_passenger"
         
     | 
| 
       44 
     | 
    
         
            -
                      "touch #{c.latest_release}/tmp/restart.txt"
         
     | 
| 
       45 
     | 
    
         
            -
                    end
         
     | 
| 
       46 
     | 
    
         
            -
                    if restart_command
         
     | 
| 
       47 
     | 
    
         
            -
                      puts "~> restarting app: #{c.latest_release}"
         
     | 
| 
       48 
     | 
    
         
            -
                      sudo("cd #{c.current_path} && INLINEDIR=/tmp #{c.framework_envs} #{restart_command}")
         
     | 
| 
      
 45 
     | 
    
         
            +
                      sudo("touch #{c.latest_release}/tmp/restart.txt")
         
     | 
| 
       49 
46 
     | 
    
         
             
                    end
         
     | 
| 
       50 
47 
     | 
    
         
             
                    callback(:after_restart)
         
     | 
| 
       51 
48 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -109,6 +106,7 @@ module EY 
     | 
|
| 
       109 
106 
     | 
    
         
             
                    "ln -nfs #{c.shared_path}/system #{release_to_link}/public/system",
         
     | 
| 
       110 
107 
     | 
    
         
             
                    "ln -nfs #{c.shared_path}/pids #{release_to_link}/tmp/pids",
         
     | 
| 
       111 
108 
     | 
    
         
             
                    "ln -nfs #{c.shared_path}/config/database.yml #{release_to_link}/config/database.yml",
         
     | 
| 
      
 109 
     | 
    
         
            +
                    "ln -nfs #{c.shared_path}/config/mongrel_cluster.yml #{release_to_link}/config/mongrel_cluster.yml",
         
     | 
| 
       112 
110 
     | 
    
         
             
                    "chown -R #{c.user}:#{c.group} #{release_to_link}"
         
     | 
| 
       113 
111 
     | 
    
         
             
                    ].join(" && ")
         
     | 
| 
       114 
112 
     | 
    
         
             
                end
         
     | 
| 
         @@ -7,6 +7,7 @@ module EY 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                      strategy = klass.new(
         
     | 
| 
       9 
9 
     | 
    
         
             
                        :repository_cache => c.repository_cache,
         
     | 
| 
      
 10 
     | 
    
         
            +
                        :app => c.app,
         
     | 
| 
       10 
11 
     | 
    
         
             
                        :repo => c.repo,
         
     | 
| 
       11 
12 
     | 
    
         
             
                        :branch => c.branch
         
     | 
| 
       12 
13 
     | 
    
         
             
                      )
         
     | 
| 
         @@ -20,6 +21,7 @@ module EY 
     | 
|
| 
       20 
21 
     | 
    
         | 
| 
       21 
22 
     | 
    
         
             
                  def initialize(opts)
         
     | 
| 
       22 
23 
     | 
    
         
             
                    @opts = opts
         
     | 
| 
      
 24 
     | 
    
         
            +
                    set_up_git_ssh(@opts[:app])
         
     | 
| 
       23 
25 
     | 
    
         
             
                  end
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
27 
     | 
    
         
             
                  def fetch
         
     | 
| 
         @@ -31,13 +33,42 @@ module EY 
     | 
|
| 
       31 
33 
     | 
    
         
             
                  end
         
     | 
| 
       32 
34 
     | 
    
         | 
| 
       33 
35 
     | 
    
         
             
                  def checkout
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
                    `#{git} reset --hard origin/#{opts[:branch]}`
         
     | 
| 
       35 
37 
     | 
    
         
             
                  end
         
     | 
| 
       36 
38 
     | 
    
         | 
| 
       37 
39 
     | 
    
         
             
                private
         
     | 
| 
       38 
40 
     | 
    
         
             
                  def git
         
     | 
| 
       39 
41 
     | 
    
         
             
                    "git --git-dir #{opts[:repository_cache]}/.git --work-tree #{opts[:repository_cache]}"
         
     | 
| 
       40 
42 
     | 
    
         
             
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  def set_up_git_ssh(app)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    # hold references to the tempfiles so they don't get finalized
         
     | 
| 
      
 46 
     | 
    
         
            +
                    # unexpectedly; tempfile finalization unlinks the files
         
     | 
| 
      
 47 
     | 
    
         
            +
                    @git_ssh = Tempfile.open("git-ssh")
         
     | 
| 
      
 48 
     | 
    
         
            +
                    @config = Tempfile.open("git-ssh-config")
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    @config.write "StrictHostKeyChecking no\n"
         
     | 
| 
      
 51 
     | 
    
         
            +
                    @config.write "CheckHostIP no\n"
         
     | 
| 
      
 52 
     | 
    
         
            +
                    @config.write "PasswordAuthentication no\n"
         
     | 
| 
      
 53 
     | 
    
         
            +
                    @config.write "IdentityFile ~/.ssh/#{app}-deploy-key\n"
         
     | 
| 
      
 54 
     | 
    
         
            +
                    @config.chmod(0600)
         
     | 
| 
      
 55 
     | 
    
         
            +
                    @config.close
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                    @git_ssh.write "#!/bin/sh\n"
         
     | 
| 
      
 58 
     | 
    
         
            +
                    @git_ssh.write "unset SSH_AUTH_SOCK\n"
         
     | 
| 
      
 59 
     | 
    
         
            +
                    @git_ssh.write "ssh -F \"#{@config.path}\" $*\n"
         
     | 
| 
      
 60 
     | 
    
         
            +
                    @git_ssh.chmod(0700)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    # NB: this file _must_ be closed before git looks at it.
         
     | 
| 
      
 62 
     | 
    
         
            +
                    #
         
     | 
| 
      
 63 
     | 
    
         
            +
                    # Linux won't let you execve a file that's open for writing,
         
     | 
| 
      
 64 
     | 
    
         
            +
                    # so if this file stays open, then git will complain about
         
     | 
| 
      
 65 
     | 
    
         
            +
                    # being unable to exec it and will exit with a message like
         
     | 
| 
      
 66 
     | 
    
         
            +
                    #
         
     | 
| 
      
 67 
     | 
    
         
            +
                    # fatal: exec /tmp/git-ssh20100417-21417-d040rm-0 failed.
         
     | 
| 
      
 68 
     | 
    
         
            +
                    @git_ssh.close
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                    ENV['GIT_SSH'] = @git_ssh.path
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
       41 
72 
     | 
    
         
             
                end
         
     | 
| 
       42 
73 
     | 
    
         
             
              end
         
     | 
| 
       43 
74 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ey-deploy/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ey-deploy
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              prerelease:  
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 0
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 2
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 4
         
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
       10 
     | 
    
         
            -
              version: 0.2.4.pre2
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.2.4
         
     | 
| 
       11 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
12 
     | 
    
         
             
            - EY Cloud Team
         
     | 
| 
         @@ -15,21 +14,21 @@ autorequire: ey-deploy 
     | 
|
| 
       15 
14 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
15 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
16 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010-04- 
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2010-04-19 00:00:00 -07:00
         
     | 
| 
       19 
18 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
19 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
20 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
       23 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 21 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
       25 
23 
     | 
    
         
             
                requirements: 
         
     | 
| 
       26 
24 
     | 
    
         
             
                - - ">="
         
     | 
| 
       27 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       28 
26 
     | 
    
         
             
                    segments: 
         
     | 
| 
       29 
27 
     | 
    
         
             
                    - 0
         
     | 
| 
       30 
28 
     | 
    
         
             
                    version: "0"
         
     | 
| 
       31 
     | 
    
         
            -
               
     | 
| 
       32 
     | 
    
         
            -
               
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: *id001
         
     | 
| 
      
 30 
     | 
    
         
            +
              name: json
         
     | 
| 
      
 31 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
       33 
32 
     | 
    
         
             
            description: A gem that deploys ruby applications on EY Cloud instances
         
     | 
| 
       34 
33 
     | 
    
         
             
            email: cloud@engineyard.com
         
     | 
| 
       35 
34 
     | 
    
         
             
            executables: 
         
     | 
| 
         @@ -108,13 +107,11 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       108 
107 
     | 
    
         
             
                  version: "0"
         
     | 
| 
       109 
108 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
       110 
109 
     | 
    
         
             
              requirements: 
         
     | 
| 
       111 
     | 
    
         
            -
              - - " 
     | 
| 
      
 110 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       112 
111 
     | 
    
         
             
                - !ruby/object:Gem::Version 
         
     | 
| 
       113 
112 
     | 
    
         
             
                  segments: 
         
     | 
| 
       114 
     | 
    
         
            -
                  -  
     | 
| 
       115 
     | 
    
         
            -
                   
     | 
| 
       116 
     | 
    
         
            -
                  - 1
         
     | 
| 
       117 
     | 
    
         
            -
                  version: 1.3.1
         
     | 
| 
      
 113 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 114 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
       118 
115 
     | 
    
         
             
            requirements: []
         
     | 
| 
       119 
116 
     | 
    
         | 
| 
       120 
117 
     | 
    
         
             
            rubyforge_project: 
         
     |