Skip to content
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

Executing code locally with mixed rvm types #62

Open
rkrdo opened this issue Jan 30, 2015 · 5 comments
Open

Executing code locally with mixed rvm types #62

rkrdo opened this issue Jan 30, 2015 · 5 comments

Comments

@rkrdo
Copy link

rkrdo commented Jan 30, 2015

I'm trying to run a task that involves the run_locally method, but whenever Capistrano tries to execute this task, it tries to use the server's rvm type which is different from my type (system vs user), is there a way to tell Capistrano to check what type to use during a run_locally block?

@betesh
Copy link

betesh commented Apr 1, 2015

This is part of a much wider issue, which is that capistrano-rvm assumes all servers you are deploying to have the same RVM environment. I would like to see the more general issue addressed. Has anyone put any thought into how we would do that?

I realize it's a limitation of capistrano that it uses a single SSHKit command map for all servers/roles, so capistrano-rvm might be the wrong place to address this. Are there any open tickets for this at the moment?

@fabn
Copy link

fabn commented May 3, 2015

I just got the same issue. I don't know capistrano internals, however I think that run_locally should not use rvm wrapper at all. The local env is developer responsibility and he should care to make commands working with no prefix or anything else. Is this something that can be fixed in this gem?

@betesh
Copy link

betesh commented May 3, 2015

@fabn A good workaround is to use a String instead of a Symbol, i.e.

run_locally do
  execute "rake my_task" # instead of execute :rake, :my_task
end

@jeremywadsack
Copy link

Also just ran into this. Thanks @betesh for the workaround.

It seems to me that capistrano-rvm would need to determine the rvm environment (system or user or no rvm) on each server as it connects to it, and keep a hash that maps the server to the rvm command. However, I don't know how to work around the single prefix for all servers.

@betesh
Copy link

betesh commented Feb 9, 2016

Most capistrano plugins seem to have made the assumption that the needed command prefixes are the same on all servers--as I mentioned above, there's a limitation in SSHKit which doesn't give them much of an option.

For instance, there is a limitation in capistrano-passenger when you are running multiple instances of passenger and need to specify an instance ID--the instance ID is different on every server. capistrano-rvm assumes you are running the same version of rvm on every server. You can work around that by setting rvm_ruby_version to default, but that assumes you have the ability to make the targeted RVM version the default on each respective server, and that all servers use RVM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants