sosedoff / capistrano-unicorn

Capistrano integration for Unicorn! - NEEDS MAINTAINER
MIT License
401 stars 141 forks source link

capistrano-unicorn with capistrano 3.x #82

Open sepastian opened 11 years ago

sepastian commented 11 years ago

Hi, I have rewritten capistrano-unicorn to work with capistrano 3.x, check out sepastian-capistrano-unicorn.

This is still in an early stage and not at all tested; but I can use it to deploy my projects with capistrano 3.x. Some changes I made:

Could you please have a look at this? What are you plans for supporting capistrano 3.x? Thoughts? How about creating a new branch for capistrano 3.x support?

jloosfelt commented 11 years ago

Hey @sepastian, what you did is wonderful, you are in the perfect timing for me. Except that it does not work (yet) here but maybe my config is wrong somewhere

https://gist.github.com/jloosfelt/7106348

sepastian commented 11 years ago

Hi @jloosfelt, thanks for trying. Obviously, this is still at a very early stage and I am still quite new to Capistrano myself. I think I forgot to update the syntax for on roles in some places, just fixed that. Could you try again?

See https://github.com/sepastian/capistrano-unicorn/commit/ef20bc27dc8f6759821c9515ef33da5c900bfddb

jloosfelt commented 11 years ago

still not working, I've updated my gist https://gist.github.com/jloosfelt/7106348

kyledecot commented 11 years ago

@sepastian I'm attempting to use your forked version but I've run into an issue. I was going to submit an issue for it but it appears that you don't have issues turned on for your project.

sepastian commented 11 years ago

Please try again, @kyledecot, issues should be turned on now.

inbeom commented 10 years ago

@jloosfelt @kyledecot, how about using my fork? I've run it without errors on my environment.

https://github.com/inbeom/capistrano-unicorn/tree/capistrano3

emoreth commented 10 years ago

@inbeom version worked for me as well. But not @sepastian T.T

umhan35 commented 10 years ago

I used @inbeom fork. I have the following code to make it work: set :unicorn_rack_env, :production in deploy/production.rb and set :unicorn_bin, 'unicorn_rails' in deploy.rb

Here is the code in Gemfil dev group: gem 'capistrano-unicorn', require: false, github: 'inbeom/capistrano-unicorn', branch: 'capistrano3'

tomafc330 commented 10 years ago

I can't seem to have capistrano see the tasks after I did what @umhan35 above:

tcc@venuespot-beta:~/ba$ bundle exec cap -T
cap bundler:install                # Install the current Bundler environment
cap deploy                         # Deploy a new release
cap deploy:check                   # Check required files and directories exist
cap deploy:check:directories       # Check shared and release directories exist
cap deploy:check:linked_dirs       # Check directories to be linked exist in shared
cap deploy:check:linked_files      # Check files to be linked exist in shared
cap deploy:check:make_linked_dirs  # Check directories of files to be linked exist in shared
cap deploy:cleanup                 # Clean up old releases
cap deploy:cleanup_assets          # Cleanup expired assets
cap deploy:cleanup_rollback        # Remove and archive rolled-back release
cap deploy:compile_assets          # Compile assets
cap deploy:finished                # Finished
cap deploy:finishing               # Finish the deployment, clean up server(s)
cap deploy:finishing_rollback      # Finish the rollback, clean up server(s)
cap deploy:log_revision            # Log details of the deploy
cap deploy:migrate                 # Runs rake db:migrate if migrations are set
cap deploy:normalise_assets        # Normalise asset timestamps
cap deploy:published               # Published
cap deploy:publishing              # Publish the release
cap deploy:revert_release          # Revert to previous release timestamp
cap deploy:reverted                # Reverted
cap deploy:reverting               # Revert server(s) to previous release
cap deploy:rollback                # Rollback to previous release
cap deploy:rollback_assets         # Rollback assets
cap deploy:started                 # Started
cap deploy:starting                # Start a deployment, make sure server(s) ready
cap deploy:symlink:linked_dirs     # Symlink linked directories
cap deploy:symlink:linked_files    # Symlink linked files
cap deploy:symlink:release         # Symlink release to current
cap deploy:symlink:shared          # Symlink files and directories from shared to release
cap deploy:updated                 # Updated
cap deploy:updating                # Update server(s) by setting up a new release
cap install                        # Install Capistrano, cap install STAGES=staging,production
cap sidekiq:quiet                  # Quiet sidekiq (stop accepting new work)
cap sidekiq:restart                # Restart sidekiq
cap sidekiq:start                  # Start sidekiq
cap sidekiq:stop                   # Stop sidekiq
tcc@venuespot-beta:~/venuespot$ 

Any suggestions?

shardnit commented 10 years ago

@tommytcchan do you have following in your project's Capfile?

require 'capistrano/unicorn'
umhan35 commented 10 years ago

@tommytcchan also the after deploy:restart hook

tomafc330 commented 10 years ago

@nsa310 Thanks you're right.. I had require 'capistrano-unicorn instead of require capistrano/unicorn from the previous version. @umhan35 thanks

tomafc330 commented 10 years ago

Just an FYI, it seems that both unicorn_env and unicorn_rack_env vars have to be set if it's deploying to something other than production.

unicorn_env        beta
unicorn_rack_env   beta
pmontrasio commented 10 years ago

I managed to make cap -T show the tasks with

Gemfile:

gem 'capistrano-unicorn', require: false, github: 'inbeom/capistrano-unicorn', branch: 'capistrano3'

Capfile:

require 'capistrano/unicorn'

If I use this repository and require 'capistrano-unicorn' I get

$ bundle exec cap -T 
cap aborted!
undefined method `instance' for Capistrano::Configuration:Class
~/.rvm/gems/ruby-2.1.0@xyz/gems/capistrano-unicorn-0.1.10/lib/capistrano-unicorn/capistrano_integration.rb:224:in `<top (required)>'
~/.rvm/gems/ruby-2.1.0@xyz/gems/capistrano-unicorn-0.1.10/lib/capistrano-unicorn.rb:2:in `require'
~/.rvm/gems/ruby-2.1.0@xyz/gems/capistrano-unicorn-0.1.10/lib/capistrano-unicorn.rb:2:in `<top (required)>'
...

By the way, @inbeom please fix the README of the capistrano3 branch because it says

And load it into your deployment script config/deploy.rb:
require 'capistrano-unicorn'

Wrong file and wrong require. I write it here because this is where google seems to direct people looking for the gem and it might be more useful here than there.

asanger commented 10 years ago

Interesting. Using the forked repo from above, I run into an error saying that it can't load 'capistrano-unicorn'. Is this now working properly for you?

pmontrasio commented 10 years ago

It works with the settings at the top of my comment. The big difference between @inbeom 's repository and this one is that for the former we must require capistrano/unicorn and not capistrano-unicorn. With that the tasks show up in cap -T

That said, I can't make them do any useful work. Example: cap production unicorn:start (or stop) hangs on

Command: kill -0 `cat ` > /dev/null 2>&1

which probably means that there is a shell variable evaluated to an empty string, but that's a different story and worth of a different issue if I can understand what's going on.

DavidBennettPIO commented 10 years ago

just as a note, I have been using this with capistrano 3.1

https://github.com/tablexi/capistrano3-unicorn

Working well for me so far :)