博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何将OpenShift与eclipse集合使用
阅读量:2437 次
发布时间:2019-05-10

本文共 6794 字,大约阅读时间需要 22 分钟。

转自:https://openshift.redhat.com/community/blogs/getting-started-with-openshift-eclipse-integration

At  we have long provided command line tools for the creation, management, monitoring and deployment of your application code to the OpenShift cloud.  This is great if you live and die on the command line.  What about the developers who want a nice integrated experience with their IDE?  We have a solution for that:  JBoss Tools now provides OpenShift integration from inside of Eclipse.

Lets get started on how to install, configure, and use this new toolset to make your next cloud deployment a few mouse clicks away.

 

Step 1:  Install Eclipse

Point your browser at the eclipse  page and select the installation package for your needs.  For this blog post, I will be using the Eclipse IDE for Java Developers package.

 

After downloading eclipse, extract the archive and you will have an eclipse directory.  Inside of this directory, you will have an Eclipse executable that will start the IDE.

Step 2: Install JBoss Tools

Once you have Eclipse up and running, the next step is to install the JBoss Tools package that provides the integration.  You can install JBoss Tools from the . Make sure that the version of JBoss Tools that you are using matches the version of Eclipse that you are using (Helios. Indigo, Juno, etc.).

 

Expand JBoss Tools and select JBoss OpenShift Tools.

 

Once the JBoss OpenShift tools have been installed, you will need to restart Eclipse.

 

Step 3:  Create an OpenShift Project

Now that we have the toolset installed, it’s time to create our cloud project and begin development.  Select File -> New -> Other -> Expand OpenShift -> OpenShift Application and click Next.

 

 

Before you can start creating and deploying your projects, you will need to authenticate with the  web services via the dialog provided.

 

 

If you do not already have an OpenShift account, click the sign up button or head on over to the OpenShift web  and create a new account. 

After creating your account, you will also need to specify a domain that you want to use for your applications.  The domain is used to create the unique URL for your running application with the following template: applicationName-domainName.rhcloud.com. The domain you select will be used for all of your deployed applications on the Red Hat Cloud.

Once you have successfully authenticated to the OpenShift web services, you will be presented with the Setup OpenShift Application Wizard.  The dialog provides the following functionality:

  • Use an existing application that is already deployed on your OpenShift account
  • View details for existing application
  • Create new application
  • Add cartridges to your application
  • Specify your gear size
  • Enable scaling for your application

 

 

Note: Although in this blog post, we will be creating a new application, if you want to continue development on an existing application, select use an existing application and click browse.  This will create a new Eclipse project and perform a git clone on your existing git repository.

In order to create a new application, give your application a name and select which cartridge or application server that your deployment will target.  At the time of this writing, OpenShift provides support for , , , , ,, and diy.

 

Step 4: Configure your ssh keys

In order to communicate via git to your repository, we need to configure our  keys.  If this is the first time you have used OpenShift, and go through the domain creation wizard, a key will be created and automatically uploaded for you.

 

If you are an existing OpenShift user, we will need to use your existing key or create a new one.  Fortunately, we provide a UI to accomplish this task as well. Click the SSH2 Preferences link provided in order to create your keys.

 

 

If you don’t already have a ssh key created on your machine, select the Key Management tab -> Generate RSA Key.  Provide a passphrase if you desire and then click Save Private Key.  You will also want to copy your public key that is displayed so that we can add it to OpenShift.

 

 

Now that you have a key pair generated, we need to tell OpenShift what our public key is.  Login to OpenShift website, click Manage your Apps, click on My Account, and select to Add a new key.

 

 

Give your new key a name of JBossTools and paste the key into the textfield provided.

 

 

Step 5: Clone your repo

After creating and publishing your public ssh key to OpenShift, we are ready to clone our repo and begin development.  Switch back over to your Eclipse IDE and click the finish button.  This will create your project and clone the private git repository that lives on the OpenShift servers.

Step 6: Code

This is what you love to do.

 

Step 7: Update maven configuration

You may notice an error marker next your project after you have cloned your git repository.  This is easily fixed by updating your maven project configuration.  Right click on your project, select maven, and then update project configuration.

Step 8: Deploy your code to the cloud

Once you have modified some of your source files, click the server tab at the bottom of the screen.  You should see your OpenShift application listed.  In order to push your changes live, right click on your application and select publish.

Once the push process is complete, point your browser to applicatonName-namespace.rhcloud.com and you should see your brand new application deployed on the cloud.

 

Step 9: View the log files for your application

An important step in developing software is the ability to view your server log files.  In order to view the server log files, select the server tab, right click on your application, select OpenShift, and then tail files.

This will open up the console view tab and allow you to monitor your logs files on the system.

 

Step 10:  Use port forwarding to connect to remote databases.

When developing database driven applications, it is essential that you have access to connect to your database in both your development and production environments.  Doing this without opening yourself up to security concerns is often a place where developers that are not intimately familiar with system administration and firewall configuration may stumble.

With OpenShift port forwarding, developers are now able to connect to their remote services while using local client tools without having to worry about the details of configuring complicated firewall rules.

In order to use port forwarding from inside of Eclipse, select the server tab, right click on your application, select OpenShift and then port forwarding.

Note:

All of the functionality exposed via the eclipse plugin is also available for you to use in your own projects.  We have provided a java client that communicates with the OpenShift web services on github.  If you have interest it communicating directly to OpenShift via the API(s), .

转载地址:http://grgmb.baihongyu.com/

你可能感兴趣的文章
谴责一些个人网页制作者 (转)
查看>>
自动过滤选择的组合框 (转)
查看>>
More Effective C++ 条款15 (转)
查看>>
singleton模式的一种变体:double-checked locking (转)
查看>>
自定义 IE 鼠标右键弹出式 (转)
查看>>
C与C++中的异常处理16 (转)
查看>>
给 perl hacker 们看的 (转)
查看>>
CWinApp::CWinApp (转)
查看>>
CoolSysHold (转)
查看>>
C与C++中的异常处理15 (转)
查看>>
C与C++中的异常处理14 (转)
查看>>
CWinApp::SetRegistryKey (转)
查看>>
CWinApp::InitInstance (转)
查看>>
C与C++中的异常处理17 (转)
查看>>
加密算法源代码库 Encryption Source Code Base (转)
查看>>
替代System.Web.Mail的新类库(新增邮件列表功能) (转)
查看>>
CEO施密特:Google最大挑战是控制增长 (转)
查看>>
Apache Developers'C Language Style Guide -- 最优代码风格(我认为) (转)
查看>>
Google的技术剖析:创始人Sergey Brin 和 Lawrence Page的研究论文 (转)
查看>>
当COM遇见.NET (转)
查看>>