capistrano recipe #157

Merged
merged 5 commits into from Oct 19, 2012

Projects

None yet

4 participants

@plentz

initial implementation of a capistrano recipe. reviews are welcome.

base for this:

@plentz

btw, I think that would be cool if that kind of information(socket location, etc) could stay at project's config.rb. maybe we can check for the config file existence and - if it exists - just use it, otherwise we use our sane defaults. thoughts?

@evanphx evanphx and 1 other commented on an outdated diff Oct 16, 2012
lib/puma/capistrano.rb
@@ -0,0 +1,25 @@
+Capistrano::Configuration.instance.load do
+ after "deploy:stop", "puma:stop"
+ after "deploy:start", "puma:start"
+ after "deploy:restart", "puma:restart"
+
+ _cset(:puma_role) { :app }
+
+ namespace :puma do
+ desc "Start puma"
+ task :start, :roles => lambda { fetch(:puma_role) }, :on_no_matching_servers => :continue do
+ run "cd #{current_path} && RAILS_ENV=#{stage} #{fetch(:bundle_cmd, "bundle")} exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false
@evanphx
evanphx Oct 16, 2012

Since this is going into 2.0, let's use the new -d (daemonize) rather than backgrounding it.

@plentz
plentz Oct 16, 2012

it can be done just by removing the last & and adding the -d, right? anyway, we should add the -d and --daemon to the -h option list :)

@plentz
plentz Oct 16, 2012

nevermind. just found that the daemon option isn't released to rubygems yet.

@plentz

well, using -d option to daemonize the process worked fine, but I can't figure out how to get the output of that process to redirect it's log to our log file.

@evanphx evanphx and 1 other commented on an outdated diff Oct 16, 2012
lib/puma/capistrano.rb
@@ -0,0 +1,27 @@
+puts 1
@evanphx
evanphx Oct 16, 2012

Why is this here?

@plentz
plentz Oct 16, 2012

I've worked more hours then I should yesterday :)

@evanphx
Puma member

So, log wise. I've just pushed a change such that the default logging is only enabled in development mode (which is rational). In that case, the rack app will need to provide it's own logging (and thus configure where to send the logs).

@evanphx evanphx merged commit 0c88ebc into puma:master Oct 19, 2012

1 check failed

Details default The Travis build failed
@linjunpop

@evanphx, @plentz Also update README file?

@sairam

The current code does not create sockets directory if it does not exist. (Setup should be handled to do that )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment