Root privileges to install ruby gems on Openshift

放肆的年华 提交于 2019-12-02 12:52:50

问题


How can I get root privileges in my Openshift app? I need to install additional gems to my Openshift virtual machine and it's impossible to do it without superuser privileges.

For login, I'm using SSH: ssh generated-hash@myapp-myns.rhcloud.com

I've already entered my id_key.pub to the Openshift web interface and I'm doing SSH with no password.


回答1:


To install additional gems in openshift see this forum, copied from ramr answer:

So what you would need to do is add a Gemfile + Gemfile.lock to your app and then do a git push -- see https://github.com/openshift/rails-example for an example Gemfile+Gemfile.lock.

Steps to do that: 1. Create an appropriate Gemfile -- probably something like:

source 'http://rubygems.org'  

gem 'whois'  
gem "minitest"  

local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")  
if File.exists?(local_gemfile)  
  puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`  
  instance_eval File.read(local_gemfile)  
end  

On your workstation do a bundler install bundle install (you might need to gem install bundler before you can use bundler). That should create a Gemfile.lock - add that and the Gemfile and commit git add Gemfile Gemfile.lock, git commit Gemfile Gemfile.lock -m 'added deps' Push changes to your OpenShift App git push HTH



来源:https://stackoverflow.com/questions/13296732/root-privileges-to-install-ruby-gems-on-openshift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!