-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Capistrano rbenv uses bundle instead of bundler (#252)
- Loading branch information
Showing
1 changed file
with
1 addition
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @uxxman. How do you come up with this?
Here is some details on how this commit breaks deploy #259 (comment)
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capistrano-rbenv
https://github.com/capistrano/rbenv/blob/1fb7509fea5960513ac06d41e694609fdde3509e/lib/capistrano/tasks/rbenv.rake#L50
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So we have to overwrite this var instead.
I guess we should add this to readme.
SSHKit.config.command_map[:bundle] = "#{fetch(:rbenv_path)}/bin/rbenv exec bundler"
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Paprikas : go ahead
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seuros @uxxman What about rvm? How systemd config file looks for those who use rvm?
Also I think that the whole line looks wrong now for systemd. (mean whats inside SSHKit.config.command_map[:bundle])
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rvm handles thing similarly
https://github.com/capistrano/rvm/blob/9cfef39cf0022839dca6b5b330dfefeb5fc363e7/lib/capistrano/tasks/rvm.rake#L53
SSHKit.config.command_map is capistrano specific, capistrano runs commands via ssh on a remote server, this command map holds executable path for each command.
RVM => https://github.com/capistrano/rvm/blob/9cfef39cf0022839dca6b5b330dfefeb5fc363e7/lib/capistrano/tasks/rvm.rake#L41
Rbenv => https://github.com/capistrano/rbenv/blob/1fdb93a6dd4a4ab3fb786c995055cf6949daf7a4/lib/capistrano/tasks/rbenv.rake#L23
So if use install git on the server at /use/local/custom/git/bin, SSHKit.config.command_map can map git to this path, so in capistrano tasks you can just write execute :git
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uxxman Should we use another var for ruby executable, since executable with ENV vars makes systemd config file incorrect?
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruby executables and paths are set by their respective capistrano tasks (capistrano-rbenv or capistrano-rvm).
Capistrano-sidekiq is only responsible for the sidekiq executable. The systemd configuration is just a template here, the deployed version has exact absolute values.
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean SSHKit.config.command_map[:bundle] includes ENV vars. So result config will contain
ExecStart=RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.7.1 /usr/local/rbenv/bin/rbenv exec bundle exec sidekiq -e production
and that is incorrect format.
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, env vars are not printed with SSHKit.config.command_map. This what I get when the systemd ERB template gets compiled,
ExecStart=$HOME/.rbenv/bin/rbenv exec bundle exec sidekiq -e production
6ef104f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that the problem is in my config. Default usage of rbenv_prefix option leads to bad exec. (didn't remove it after switching to systemd)
Thank you. Case closed :D