-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add nohook script #29
base: master
Are you sure you want to change the base?
Conversation
Can you give an example of why you don't want to automatically add the hooks? |
We use capistrano roles to adapt our deployments to the needs of the (sub)-app we're deploying. For some roles, we don't need to compile any JS stuff, and since we don't use node/nvm, autoloading the script will be bad since currently hooks are ran on every server. |
If what you're saying is that this can be achieved by using roles, I don't see why we need another way of doing this. Also because like other Capistrano tasks, |
Although you might be able to unregister the after hooks, or you could conditionally redefine the |
I agree this follow the Rails guidelines of "Convention over configuration", but the nohooks scripts make it is easier to write clean code by splitting deployment into files that can be required only on some deploy configs. For instance I have a Rails app that I can deploy very differently (eg Action Cable, old Rails app with HTML views, new API servers) depending on the config file. I actually copied what I saw from the nice https://github.com/capistrano/passenger gem that has a nohook script in addition to an existing This also allows to really control the order in which hooks are added ad the order may be sensitive and not really easy to control from the capfile Here is what my deploy folder looks like :
and in each of my deploy "stages" (production, staging, etc.) I require those files depending on what I need. Only the api_production environment requires nvm while other environments do not |
Btw I've been using this in production for a few months now, no problem to report. It really does help since I'm updating the deploy configurations, and excluding node/yarn package construction lets me deploy much faster for those worker deploy scenarios where I don't need to compile JS gem 'capistrano-nvm',
git: 'https://github.com/Startouf/capistrano-nvm',
branch: 'feature/add-nohook-script',
require: false |
Ability to require the nvm tasks without adding automatically the nvm hooks