Red Hat OpenShift Express"

From Documentation
m (correct highlight (via JWB))
 
(14 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
= Get Your OpenShift Ready =
 
= Get Your OpenShift Ready =
*Apply a new OpenShift account if you don't have Red Hat Network (RHN) account.
+
*Apply a new OpenShift account if you don't have a Red Hat Network (RHN) account.
*Refer to [http://docs.redhat.com/docs/en-US/OpenShift_Express/1.0/html/User_Guide/index.html OpenShift User Guide] for installing required client tools.
+
*If you prefer to use Eclipse, you can install Eclipse plugin to create OpenShift domain and application without following the prerequisites and steps listed below. Here is the [https://www.redhat.com/openshift/community/blogs/deploying-java-apps-to-the-cloud-with-the-openshift-eclipse-plug-in video] that demonstrates how you can use Eclipse plugin to do so. If you are doing so, you do not need to follow the next a few steps.
 +
*Refer to [https://access.redhat.com/documentation/en-US/OpenShift_Online/2.0/html/Client_Tools_Installation_Guide/index.html OpenShift User Guide] for required client tools.
 
*#Prerequisites for Red Hat Enterprise Linux or Fedora:
 
*#Prerequisites for Red Hat Enterprise Linux or Fedora:
 
*#*RHEL 6 and up or Fedora 14 and up.
 
*#*RHEL 6 and up or Fedora 14 and up.
Line 23: Line 24:
 
*#*[http://rubyforge.org/projects/rubygems RubyGems]
 
*#*[http://rubyforge.org/projects/rubygems RubyGems]
  
= Create a OpenShift domain name =
+
= Create an OpenShift domain name =
Run '''rhc-create-domain''' command to create a unique domain name for your applications.
+
Run '''rhc-create-domain''' command to create an unique domain name for your application.
 
<source lang="bash">
 
<source lang="bash">
 
$ rhc-create-domain -n DomainName -l rhlogin -p password
 
$ rhc-create-domain -n DomainName -l rhlogin -p password
Line 47: Line 48:
 
*-l '''''rhlogin''''' — your OpenShift Express or RHN account.
 
*-l '''''rhlogin''''' — your OpenShift Express or RHN account.
 
*-p '''''password''''' — your OpenShift Express or RHN password.
 
*-p '''''password''''' — your OpenShift Express or RHN password.
Visit http://AppName-DomainName.rhcloud.com/ to see the default OpenShift page.
+
Once it is done the application is on the cloud, you can visit http://AppName-DomainName.rhcloud.com/ to see the default OpenShift page.
  
 
== Import into Eclipse IDE (Optional) ==
 
== Import into Eclipse IDE (Optional) ==
*Run the command to support to Eclipse.
+
If you wish to use Eclipse,
 +
*Run the following command to support Eclipse.
 
<source lang="bash">
 
<source lang="bash">
 
$ mvn eclipse:eclipse
 
$ mvn eclipse:eclipse
 
</source>
 
</source>
*Refer [[ZK_Installation_Guide/Setting_up_IDE/Maven/Create_and_Run_ZK_Application_with_Maven_Archetype#Import_a_Maven_project_into_Eclipse|here]] to import into Eclipse.
+
*Refer to [[ZK_Installation_Guide/Setting_up_IDE/Maven/Create_and_Run_ZK_Application_with_Maven_Archetype#Import_a_Maven_project_into_Eclipse|here]] to import into Eclipse.
  
 
= Deploy changes to OpenShift =
 
= Deploy changes to OpenShift =
To deploy an application to the cloud, you must make changes in the git directory location specified during the application creation process.<br/>
+
Once you have created an OpenShift application in your local machine following the steps above, the application is at the same time deployed to the cloud. To update and make changes to your application, you have to make changes in the git directory specified during the application creation process.<br/>
There are two options to deploy changes. You can use either option to deploy your application.
+
There are two options to deploy the changes:
  
== Option 1: Uploading content in a Maven src structure ==
+
== Option 1: Upload contents in a Maven src structure ==
 
This option is simple and recommended. Just push the source code with "git push" command.
 
This option is simple and recommended. Just push the source code with "git push" command.
 
<source lang="bash">
 
<source lang="bash">
Line 69: Line 71:
 
</source>
 
</source>
 
Then OpenShift will build your project on cloud.
 
Then OpenShift will build your project on cloud.
Visit http://AppName-DomainName.rhcloud.com/ to see your application.
+
Once it's done you can visit http://AppName-DomainName.rhcloud.com/ to see your application.
  
== Option 2: Uploading prebuilt content ==
+
== Option 2: Upload prebuilt contents ==
To avoid OpenShift build your project automatically, you have to remove pom.xml file.
+
If you do not wish OpenShift to build your project automatically, you have to remove <b>pom.xml</b> file and all the source code.
 
<source lang="bash">
 
<source lang="bash">
 
$ cd AppName
 
$ cd AppName
$ git rm -r pom.xml
+
$ git rm -r src/ pom.xml
 
</source>
 
</source>
Then copy the prebuilt war file into '''deployments''' folder and rename to ROOT.war<ref>By default the warName is ROOT within the pom.xml file. This will render the webapp contents at http://app_name-namespace.rhcloud.com.<br/>If you change the warName in pom.xml to app_name or if the warName in deployments folder is app_name.war, then your base URL would become http://app_name-namespace.rhcloud.com/app_name.</ref>
+
Then, copy the pre-built war file into '''deployments''' folder and rename it to ROOT.war<ref> By default the <code>warName</code> is ROOT within the <b>pom.xml</b> file. This will render the ''webapp'' contents at http://app_name-namespace.rhcloud.com.<br/>If you change the <code>warName</code> in <b>pom.xml</b> to "''app_name''" or if the <code>warName</code> in deployments folder is "''app_name.war''", then your base URL would become http://app_name-namespace.rhcloud.com/app_name.</ref>
 
<source lang="bash">
 
<source lang="bash">
 
$ cp target/prebuilt.war deployments/ROOT.war
 
$ cp target/prebuilt.war deployments/ROOT.war
Line 84: Line 86:
 
$ git push origin master
 
$ git push origin master
 
</source>
 
</source>
Visit http://appName-domainName.rhcloud.com/ to see the result
+
Once it's done you can visit http://appName-domainName.rhcloud.com/ to see the result
 
 
 
----
 
----
 
<references/>
 
<references/>
 +
 +
= Sample =
 +
*[http://sourceforge.net/projects/zkforge/files/Small%20Talks/ZK%20Sandbox%20for%20OpenShift/? Download] the sample maven project named openshift_zksandbox.zip.
 +
*Sandbox sample is deployed on OpenShift at http://zksandbox-zksupport.rhcloud.com/.
  
 
{{ZKInstallationGuidePageFooter}}
 
{{ZKInstallationGuidePageFooter}}

Latest revision as of 12:39, 19 January 2022


Red Hat OpenShift Express



Get Your OpenShift Ready

  • Apply a new OpenShift account if you don't have a Red Hat Network (RHN) account.
  • If you prefer to use Eclipse, you can install Eclipse plugin to create OpenShift domain and application without following the prerequisites and steps listed below. Here is the video that demonstrates how you can use Eclipse plugin to do so. If you are doing so, you do not need to follow the next a few steps.
  • Refer to OpenShift User Guide for required client tools.
    1. Prerequisites for Red Hat Enterprise Linux or Fedora:
    2. Prerequisites for Other Linuxes:
      • Root access
      • Ruby 1.8 or higher installed or available to be installed
      • Install the required packages: git, ruby, rubygems, and the ruby 1.8 development package.
    3. Prerequisites for Mac:
      • git
    4. Prerequisites for Windows:
      • Cygwin with the following optional components:
        • openssh
        • ruby
        • make
        • gcc
        • git
      • RubyGems

Create an OpenShift domain name

Run rhc-create-domain command to create an unique domain name for your application.

$ rhc-create-domain -n DomainName -l rhlogin -p password
  • -n DomainName — specifies the domain that you want to create. This must contain a maximum of 16 alphanumeric characters.
  • -l rhlogin — your OpenShift Express or RHN account.
  • -p password — your OpenShift Express or RHN password.

Create a Maven Application

Run rhc-create-app command and OpenShift will create a maven project with default page automatically.

$ rhc-create-app -a AppName -t Type -l rhlogin -p password
  • -a AppName — The name of the application to create (maximum of 32 alphanumeric characters).
  • -t Type — The framework type to create. OpenShift Express currently supports the following application types:
    • php-5.3 — for PHP applications
    • wsgi-3.2 — for Web Server Gateway Interface applications
    • rack-1.1 — for Ruby Webserver Interface applications
    • perl-5.10 — for Perl applications
    • jbossas-7.0 — for JBoss AS applications (used for ZK project)
    • raw-0.1 — a raw cartridge type used to create applications of no specific type
  • -l rhlogin — your OpenShift Express or RHN account.
  • -p password — your OpenShift Express or RHN password.

Once it is done the application is on the cloud, you can visit http://AppName-DomainName.rhcloud.com/ to see the default OpenShift page.

Import into Eclipse IDE (Optional)

If you wish to use Eclipse,

  • Run the following command to support Eclipse.
$ mvn eclipse:eclipse
  • Refer to here to import into Eclipse.

Deploy changes to OpenShift

Once you have created an OpenShift application in your local machine following the steps above, the application is at the same time deployed to the cloud. To update and make changes to your application, you have to make changes in the git directory specified during the application creation process.
There are two options to deploy the changes:

Option 1: Upload contents in a Maven src structure

This option is simple and recommended. Just push the source code with "git push" command.

$ cd AppName
$ git add .
$ git commit -a -m "Commit Message"
$ git push origin master

Then OpenShift will build your project on cloud. Once it's done you can visit http://AppName-DomainName.rhcloud.com/ to see your application.

Option 2: Upload prebuilt contents

If you do not wish OpenShift to build your project automatically, you have to remove pom.xml file and all the source code.

$ cd AppName
$ git rm -r src/ pom.xml

Then, copy the pre-built war file into deployments folder and rename it to ROOT.war[1]

$ cp target/prebuilt.war deployments/ROOT.war
$ git add .
$ git commit -a -m "Commit Message"
$ git push origin master

Once it's done you can visit http://appName-domainName.rhcloud.com/ to see the result


  1. By default the warName is ROOT within the pom.xml file. This will render the webapp contents at http://app_name-namespace.rhcloud.com.
    If you change the warName in pom.xml to "app_name" or if the warName in deployments folder is "app_name.war", then your base URL would become http://app_name-namespace.rhcloud.com/app_name.

Sample



Last Update : 2022/01/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.