Capistrano 3 Plugin Conventions

34 views
Skip to first unread message

Pj Kelly

unread,
Mar 17, 2015, 7:03:31 PM3/17/15
to capis...@googlegroups.com
Hello All,

I'm wondering if anyone is aware of or has opinions on how capistrano plugins should be setup.  The specific scenario I'm thinking about is whether plugins should automatically add their functionality in via callbacks, or leave it to the user of the plugin to call tasks defined where they see fit.  Personally I can see both sides of the argument - having a plugin be plug-and-play by just requiring it in your Capfile is super nice, however having the flexibility to call it wherever makes sense in your particular deployment flow is also nice.

I'm aware that you can easily override already defined tasks if need be, but just curious if the maintainers of Capistrano have an opinion on how plugins should be authored.

Thanks in advance.

Lee Hambley

unread,
Mar 18, 2015, 4:07:19 AM3/18/15
to Capistrano
Hi Pj,

I can't think of any examples off hand which automatically plug themselves into the workflow, I'm not even sure that Bundler does the right thing with the gems loading them automatically?

What exactly did you have in mind? I do rather like that usually installing a plugin means it's in the Gemfile *and* in the Capfile/deploy.rb, but I don't have any dogmatic preference one way or another, because mostly I *think* they nearly all (?) require a loader-line in the Cap config itself.

Not sure that helps, but hit us back, and we can talk about it.

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/ae146a74-8e3f-4ebb-b5ee-676f5c52c393%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pj Kelly

unread,
Mar 18, 2015, 11:23:17 PM3/18/15
to capis...@googlegroups.com
Hey Lee,

Thanks for the reply.  A little clarification here: I'm wondering whether you think requiring the plugin in your Capfile should automatically add the plugin's functionality to your deployment via callbacks, or if plugins should let the user specify how the plugin should be used in their deploy.rb.

An example of this is the capistrano/passenger plugin.  The plugin as it stands right now defines a deploy:restart task and calls sets it to run after the :publishing task.  My opinion is that this is a bit too presumptuous for a plugin and that, at the very least, it should not use the deploy namespace.  For the way our apps are setup, we like defining our own deploy:restart task that contains everything related to "restarting" - restarting apps, workers and any other supporting services required.

At the end of the day, this really comes down to personal preference, but I'm just curious if y'all have an opinion on whether a) there should be a convention established for capistrano plugins and b) what you think it should be so we (as a community) can author plugins in a consistent way.

Thanks!

Lee Hambley

unread,
Mar 19, 2015, 5:25:06 AM3/19/15
to Capistrano
I'd tend to agree it ought perhaps to have been `passenger:restart`, and that probably it's upto the user where to hook that in (i.e include the plugin, and then explicitly write an `after` hook). It'd encourage people to look at the docs i.e "passenger:sometask"… "ohh that must come from capistrano-passenger".

However, no concrete advice :)

Pj Kelly

unread,
Mar 19, 2015, 12:02:21 PM3/19/15
to capis...@googlegroups.com
Thanks for your thoughts Lee.
Reply all
Reply to author
Forward
0 new messages