You've instructed capistrano to invoke method deploy.notify_via_boxcar when you
call task production.
If you wanted to deploy you still have to tell capistrano to deploy
cap production deploy
But the way you've wired your notify task it will fire before deploying.
Again, EVERY task fires on all matching servers.
You have to control which servers match by filtering them with roles and
options specified at the task level AND optionally at the command level.
I would suggest in your case you shouldn't explicitly call
deploy.notify_via_boxcar instead use an after hook
after "deploy:restart", "deploy:notify_via_boxcar"
Then in task :notify_via_boxcar
Append ,:once => true to the run invocation that actually triggers the
notification.
You shouldn't use on :exit for this because there are plenty of reasons to use
cap to do things other than deploy and you don't want notifications triggered
those times.
On Jul 22, 2011, at 8:32 AM, Eric Lubow wrote:
> Specifically what I am getting at is a notification.
>
> I have a deploy task that deploys the website to all my webheads.
> Abbreviated task follows:
>
> task :production do
> set :default_environment {}
> roles :app one.foo.com, two.foo.com, three.foo.com
> deploy.notify_via_boxcar
> end
>
> This deploys to all 3 servers. I want a deploy notification (via
> Boxcar) which is a deploy task. Originally I had it running via
> "after 'deploy:update_code'", but that runs it on every machine. I
> just want the notification to fire when the whole task of deploying to
> all servers is complete. When I put it in the :production task (like
> above), it doesn't do the normal deploy tasks. Where should I put it
> to only fire on the completion? I remember reading something about
> on :exit, but I couldn't find the docs to implement that.
>
> -e
>
> On Jul 21, 11:36 am, Donovan Bray wrote:
>> Tasks run in parallel on all matching servers, if you have a task that you
>> need to only run on any one of the servers, like maybe a rake task that
>> changes data in the db, you only need one server to run that command
>>
>> You can create a role with one server as suggested, you can also pass :once
>> => true to the run or sudo comand
>>
>> run 'my command', :once => true
>>
>> It will only run on the first matching server.
>>
>> out = capture 'my command'
>> logger.info out
>>
>> Would do the same thing, but I would only use that form if you wanted to do
>> something with the output than just echo it back to the console.
>>
>> On Jul 21, 2011, at 5:19 AM, Lee Hambley wrote:
>>
>>
>>
>>
>>
>>
>>
>>> Eric,
>>
I am trying to figure out how to get a task to only fire one time.
>>
>>> Tasks run once, they shouldn't run "once per server" they do run "once on
>>> each server"
>>
>>> If you then have a task that should run on only one server in your group,
>>> you need to isolate it somehow, name it with a responsibility, or give it a
>>> tag, such as how the default recipe names a primary DB server.
>>> --
>>> * You received this message because you are subscribed to the Google Groups
>>> "Capistrano" group.
>>> * To post to this group, send email to capistrano@googlegroups.com
>>> * To unsubscribe from this group, send email to
>>> capistrano+unsubscr...@googlegroups.com For more options, visit this group
>>> athttp://groups.google.com/group/capistrano?hl=en
>
> --
> * You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> * To post to this group, send email to capistrano@googlegroups.com
> * To unsubscribe from this group, send email to
> capistrano+unsubscr...@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/capistrano?hl=en
--
* You received this message because you are subscribed to the Google Groups
"Capistrano" group.
* To post to this group, send email to capistrano@googlegroups.com
* To unsubscribe from this group, send email to
capistrano+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/capistrano?hl=en