OpenShift Deployment

Hi, I am new to the opening shift. I do not know how to create a repository and implement our project in it. I configured it on the command line. After successfully installing rhc through the command line, I get confused with the information provided on the Open Shift website regarding the downloading of the application not about pressing and committing. I got the idea of ​​committing and pushing, but I had no idea of ​​deploying or downloading the application for the first time. Please help me, I got stuck a lot of time in advance

+6
source share
4 answers

Application Deployment and Creation

All OpenShift applications are built around the Git source control workflow — you localize the code, and then push your changes to the server. The server then launches a few hooks to create and configure your application, and finally restarts your application. If desired, applications can be created using Jenkins or run using hot deployment, which speeds up code deployment to OpenShift.

Making changes to your application As a developer in OpenShift, you make code changes on your local machine, check these changes locally, and then "push" these changes to OpenShift. One of the main advantages of Git is that it does not require a constant online presence to run. You can easily register (in Git terminology, “commit”) and relay the changes locally before deciding whether to change these changes in OpenShift.

Each OpenShift application you create has its own Git repository, which you can access. If you create the application from the command line, rhc will automatically download a copy of this repository (Git calls this clone) to your local system. If you are creating an application from the web console, you need to tell Git to clone the repository. Find the Git URL from the application page, and then run:

$ git clone <git_url> <directory to create> 

After making changes, you need to “add” and “commit” these changes. "add" tells Git that the file or set of files will become part of a larger check, and "commit" completes the check. Git requires that each commit has a message to describe it.

 $ git add . $ git commit -m "A checkin to my application" 

Finally, you are ready to submit your changes to your application - you will “push” these changes with:

 $ git push 

The output from the push command will contain information from OpenShift about your deployment -

Source Click me

+7
source

There are two options for deploying content to Tomcat Server in OpenShift. Both options can be used together (i.e. build one archive from the original and the other pre-built)

1) (Preferred). You can upload your content in the Maven src structure, as this is an example project and git push has an application built and deployed. To do this, you need your pom.xml to the root of your repository and the maven-war plugin, as in this example, to move the output from the assembly to the webapps directory. By default, warName is ROOT in pom.xml. This will result in webapp content that will be displayed at http://app_name-namespace.rhcloud.com/ . If you change warName in pom.xml to app_name, your base url will then become http://app_name-namespace.rhcloud.com/app_name .

Note. If you are building locally, you will also want to add any weekend wars under webapps from build to your .gitignore file.

Note. If you use scaled EWS2.0, you need the application to be deployed in the root context (i.e. http://app_name-namespace.rhcloud.com/ ) for the HAProxy load-balancer to recognize the instance of EWS2.0 is active.

or

2) You can git push pre-built wars in webapps /. To do this with the default repo, you first need to run 'git rm -r src / pom.xml' from the root of your repo.

The main workflows for deploying pre-created content (each operation will require the associated git add / commit / push operations):

A) Add new zipped content and deploy it:

  • cp target / example.war webapps /

B) Undeploy the currently deployed content:

  • git rm webapps / example.war

C) Replace the currently deployed zipped content with the new version and deploy it:

  • cp target / example.war webapps /

Note. You can get the uri information above from running "show domain rhc"

If you have already made large files in your git repository, you rewrite or reset the history of these files in git to an earlier point in time, and then "git push -force" to apply these changes to the remote OpenShift server. git gc on a remote OpenShift repository can be forced (Note: tidy also performs other cleanups, including cleanup log files and tmp dirs):

rhc app tidy -a appname

If you choose option 1) or 2) the end result will be the application being deployed to the webapps directory. The webapps directory in Tomcat Distribution is the location that end users can place their deployment content (for example, war, ear, jar, sar files) to have it automatically deployed at server time.

+7
source

Here is a really good tutorial prepared by an open source guy with source code, so you might be wrong with it. https://www.openshift.com/blogs/spring-polyglot-persistence-part-1

To summarize - if you have an application in some kind of repository, just create an application so that it creates a folder with git repo in your directory

 rhc app create notebook jbossas-7 -l <openshift_login_email> -d 

Go to the newly created directory and replace the default name change code with your repo

 git rm -rf src/ pom.xml git commit -am "removed default files" git remote add notebook -m master git://github.com/shekhargulati/notebook-part1.git git pull -s recursive -X theirs notebook master git push 

You should see your build of Java applications.

+1
source

What type of application is your application? Java / PHP / Python ...? If this is a PHP based application, then the open source PHP code must go into the "php" directory. Whenever you create an application using rhc commands, a local repository is created within which you will find a README document listing the deployment steps. Alternatively, you can refer to the OpenShift user guide:

https://www.openshift.com/sites/default/files/documents/OpenShift-2.0-User_Guide-en-US_5.pdf

0
source

Source: https://habr.com/ru/post/945584/


All Articles