在Windows环境下搭建OpenShift环境,安装客户端工具rhc,首先需要安装Ruby和Git,参阅https://developers.openshift.com/en/getting-started-client-tools.html#windows。
在正确安装Ruby和Git之后,使用RubyGems包管理器(Ruby内置)安装OpenShift的客户端工具rhc。
官方提供的方式为:gem install rhc,但可能是网络原因所致,执行命令后提示错误信息:
ERROR: Could not find a valid gem 'rhc' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNREFUS
ED: No connection could be made because the target machine actively refused it.
- connect(2) (https://rubygems.org/latest_specs.4.8.gz)
参阅StackOverFlow的一个解答:http://stackoverflow.com/questions/19745960/unable-to-install-any-gem-by-ruby-in-windows
“This is most likely due to running over a secure (https) connection to rubygems.org. Look at the help for “gem sources –h”, remove the https version and add http://rubygems.org”
问题仍然没有解决。
实际上,gem install支持本地方式安装,即将gem包下载到本地后再执行gem install --local,参阅http://stackoverflow.com/questions/220176/how-can-i-install-a-local-gem
rhc-1.30.2依赖的gem包列表如下:
- http://rubygems.org/downloads/archive-tar-minitar-0.5.2.gem
- http://rubygems.org/downloads/commander-4.2.0.gem
- http://rubygems.org/downloads/highline-1.6.21.gem
- http://rubygems.org/downloads/httpclient-2.4.0.gem
- http://rubygems.org/downloads/net-scp-1.2.1.gem
- http://rubygems.org/downloads/net-ssh-2.9.1.gem
- http://rubygems.org/downloads/net-ssh-gateway-1.2.0.gem
- http://rubygems.org/downloads/net-ssh-multi-1.2.0.gem
- http://rubygems.org/downloads/open4-1.3.4.gem
- http://rubygems.org/downloads/rhc-1.30.2.gem
将上述gem文件下载至本地目录下,然后在该目录下执行
gem install rhc --local . hc-1.30.2.gem
原文地址http://bookshadow.com/weblog/2014/09/19/local-install-openshift-rhc-for-windows/
后来好不容易能在线gem install rhc了,但是一rhc setup就报错,想起来ruby devkit没装
其实就在rubyInstaller的下面。另外我从前虽然在mac下,也是直接让eclipse去发布maven项目的,那样就不用rhc命令行这么麻烦。
还有由于怀疑ruby版本的问题,gem install pik来代替rvm查看和切换ruby版本。
还有为了follow人家的tornado与angular项目,把python的pip也装了。
事已至此,干脆把我的createjs项目就放在python后台上面吧:
rhc create-app createjs python-2.7 postgresql-9.2 --from-code=https://github.com/haimingpro/createjs.git
postgresql-9.2 那截我删了,暂时不想要数据库了,何况还是个我没听过的,数据库和Jenkins都可以后面加,不像后台得拆掉重建。。
然而ruby卸载了重装了,devkit也成功有效的工作着,还是setup不了rhc。
最后还是这篇文章救了我!
C:Ruby23-x64devkit>rhc setup C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/commander-4.2.0/lib/commander/user_interaction.rb:328: warning: constant ::
TimeoutError is deprecated OpenShift Client Tools (RHC) Setup Wizard This wizard will help you upload your SSH keys, set your application namespace, and check that other programs like Git are properly installed. If you have your own OpenShift server, you can specify it now. Just hit enter to use the server for OpenShift Online: openshift.redhat.com. Enter the server hostname: |openshift.redhat.com| Interrupted 终止批处理操作吗(Y/N)?
说到底还是编译的 Ruby 2.3.0 缺少 openssl但是make这种解决方式不适合windows,
说白了装一个名叫net-ssh的gem药到病除。