Yesterday toss a day on the OpenShift DIY support spring-boot environment, so want to end up is also for the needs of friends a reference.
This article is mainly applicable to the case where application was deployed locally with eclipse, and if there is already a ready-made proj that needs to be deployed, refer to the code on my git (https://OpenShift Github.com/rxcai/openshift-diy-spring-boot-sample) This sample original author is Kolorobot , because I found it in the configuration of Maven when I started to try Mirror failed to download resulting in a deployment error, so the modification commits his code.
Below to get to the chase:
How to DIY a support spring-boot environment on OpenShift
Why do you want to DIY? The most important reason is that the current version of the ready-made template maven on OpenShift is too low, and spring-boot requires maven 3.2+ or Gradle 1.12+. So if you want to deploy Spring-boot project to OpenShift, be sure to DIY. In addition, the ready-made template JDK still stays at 7, so if you need 8, you also need to DIY. Now that's it.
The first is of course the installation of OpenShift RHC the OpenShift Client Tools, known as RHC.
For specific steps, refer to: https://developers.openshift.com/en/managing-client-tools.html
Its environmental requirements are ruby 1.8.7 or + and Git
My system is the Mac OS X 10.8.5 system comes with Ruby 1.8.7 and Git 1.8.5.2.
After confirming that the environment meets the requirements, install RHC with the command line
sudo gem install RHC
If there's a problem, the official recommends run
The sudo gem update is an update of its dependent libraries.
However , things have never been so smooth, so fairy tales are deceptive ...
I met the same problem as this man https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=1190896 Although he is Linux all my problems and his almost identical.
Description of problem:
After installing rhc using `gem install rhc` on a RHEL 6.6 system, the following error is seen when running ‘rhc setup‘:
# rhc setup
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require‘: /usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:236: syntax error, unexpected ‘.‘, expecting kEND (SyntaxError)
.compact
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:462: odd number list for Hash
title: @title,
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:462: syntax error, unexpected ‘:‘, expecting ‘}‘
title: @title,
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:463: syntax error, unexpected ‘:‘, expecting ‘=‘
percent_complete: percent_complete,
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:464: syntax error, unexpected ‘:‘, expecting ‘=‘
progress_bar: progress_bar,
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:465: syntax error, unexpected ‘:‘, expecting ‘=‘
step: @step,
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:466: syntax error, unexpected ‘:‘, expecting ‘=‘
steps_remaining: steps_remaining,
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:467: syntax error, unexpected ‘:‘, expecting ‘=‘
total_steps: @total_steps,
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:468: syntax error, unexpected ‘:‘, expecting ‘=‘
time_elapsed: ‘%0.2fs‘ % time_elapsed,
^
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:468: syntax error, unexpected ‘,‘, expecting kEND
/usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander/user_interaction.rb:470: syntax error, unexpected ‘}‘, expecting kEND
}.merge! @tokens
^
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require‘
from /usr/lib/ruby/gems/1.8/gems/commander-4.3.0/lib/commander.rb:27
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require‘
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require‘
from /usr/lib/ruby/gems/1.8/gems/rhc-1.34.2/lib/rhc.rb:30
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require‘
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require‘
from /usr/lib/ruby/gems/1.8/gems/rhc-1.34.2/lib/rhc/cli.rb:1
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require‘
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require‘
from /usr/lib/ruby/gems/1.8/gems/rhc-1.34.2/bin/rhc:18
from /usr/bin/rhc:23:in `load‘
from /usr/bin/rhc:23
Version-Release number of selected component (if applicable):
rhc-1.34.2
How reproducible:
Always
Steps to Reproduce:
1. Install ruby and rubygems on a RHEL-6.6 system
2. Install rhc using `gem install rhc`
3. Run any rhc command
Additional info:
# uname -r
2.6.32-504.8.1.el6.x86_64
# rpm -qa | grep ruby
ruby-1.8.7.374-3.el6_6.x86_64
rubygems-1.8.24-6.el6op.noarch
ruby-libs-1.8.7.374-3.el6_6.x86_64
# gem list
*** LOCAL GEMS ***
archive-tar-minitar (0.5.2)
commander (4.3.0)
highline (1.6.21)
httpclient (2.6.0.1)
net-scp (1.2.1)
net-ssh (2.9.2)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.2.0)
open4 (1.3.4)
rhc (1.34.2)
Downgrading the ‘commander‘ gem to 4.2.0 resolves the issue:
# gem install commander -v 4.2.0
The guy who submitted the bug was 2015 02 09, which was a few days ago, trying to install the latest RHC, and I tried to install the version all the time. And judging from his description, he is also 1.8 ruby, guessing his environment is similar to mine. So is the process of searching the solution, in the stakoverflow above to see a few similar problems, one after the attempt, such as the Highline version, such as the net-ssh version, and so on, all I can find the failure.
So I think, is it possible because the latest version of RHC and Doc there is a time lag, perhaps the latest RHC has not supported Ruby 1.8.7, but Doc has not been updated? Based on this suspicion, I updated Ruby, who was reluctant to update. Fortunately, the result is good, and the installation behind it is flowing. I'm not sure if it's because the latest version of RHC already does not support Ruby 1.8.7, but I can only say it works for me, try to update Ruby. Just guessing, I also left a message to the friend, see if there will be a reply.
After installing the RHC, is to configure your RHC, run RHC Setup to configure your various things, such as OpenSSL related, here is a fool-like operation.
After the configuration of RHC is really to enter the theme.
Two create a application in your OpenShift DIY environment
rhc app create <app_name> diy-0.1
This command creates an applicationBootusingDIYcartridge and clones the repository toBootdirectory.
And then, for example, the database. These operations, you can be in the Web console after the addition is very convenient, not necessarily you need to join in RHC immediately, if necessary
rhc cartridge add <support_db_version> -app <app_name>
Now go to your application directory and delete the following files/folders
git rm -rf .openshift README.md diy misc
Commit The changes:
git commit -am "Removed template application source code"
The next step is the key :
First download from my Git bin (https://github.com/RxCAI/openshift-diy-spring-boot-sample). Openshift/action_hooks folder and Settings.xml file into your local application git bin, then git add these two documents, then git commit--all, and finally
The basic template is a ready-to-be pushed:
git push
Note that push may take some time, not clear the domestic speed, but I in Europe public city WiFi, about a minute or so. At this point, your most basic DIY environment Maven 3.5 + JDK 8 has been configured, and you have created a simple application on your Openshift. The next thing to do is to integrate into your eclipse so that you can continue to develop locally and then remotely push to your OpenShift server.
Three in the local Eclipse integrated openshift development environment, continue on your work
The first step in integrating your on-premises environment is to load the OpenShift plugin in your eclipse. Search for JBoss tools in your Eclipse market, and then just install OpenShift tools.
After installing the plugin, new one OpenShift project, after configuring the OpenSSL thing, select Use my existing OpenShift application select you RHC before using application create
It is also important to note in the subsequent configuration that when you select a local git bin, you will remember to select the one that was created before RHC create application .
At this point, you've completed the DIY JDK 8 + Maven 3.5 environment on OpenShift, and you can continue to develop your project in local Eclipse, control the version with Git, and push to publish to the server.
Follow up on local eclipse configuration issues and spring-boot development, Welcome to Exchange, I am new to OpenShift & Spring-boot either:)
Finally, if you need to create a project that is managed with Gradle, refer to Https://github.com/RxCAI/openshift-diy-spring-boot-gradle
Happy New Year, the memory of domestic food ...
by Rxcai
14/02/2015
How to do a DIY deployment on OpenShift Spring-boot and develop it locally with eclipse