Please help me how to deploy war on openshift app.I have put our war file in webapps folder and push code but my war is not deployed.
after this default page will be open on app url.Please help me.
If you would like to deploy pre compiled java applications to your OpenShift gear, but you don't want to waste space by storing them in your git repository, then these directions are for you!
Create an application on OpenShift and select either the Tomcat 6 (JBoss EWS 1.0) or Tomcat 7 (JBoss EWS 2.0) cartridges.
Use the git clone command to download the source code for your application to your computer.
Remove the src directory and the pom.xml file from your application that you cloned to your computer.
DO NOT place your WAR files into the webapps directory.
Next, you need to do a git commit -am "some message here" to make sure that your changes are committed. Lastly, you need to do a git push to deploy your changes to your OpenShift gear.
Now comes the fun part, you need to use SCP or SFTP (with public key authentication of course) to upload your files to the correct location on your gear.
You need to place your WAR files into this folder: app-root/dependencies/jbossews/webapps on your gear.
If you run rhc tail $appname, shortly after the transfer is done you will see entries appear in the logs showing that your WAR file has been deployed and at what context.
The WAR files that you add into the webapps directory will be deployed at a context that matches the name of the WAR file.
For Example:
If you add a file called mywebsite.war, it will be available at app-domain.rhcloud.com/mywebsite. If there is an application that you would like to be available at app-domain.rhcloud.com/ (also known as the root context) then you should name that file ROOT.war.
If you need to replace them, just upload a new copy, or if you want to remove them, just ssh into your server and delete the file you uploaded and it will be un-deployed.
Related
I am using phpstorm 7 on my windows host for a git project. The files are synced with a VM via phpstorm's remote server feature, so each time a save is made, the changed file is also upoloaded to my VM.
I am having difficulties when I am pulling newer versions from Git because the only way to send the changed files to my VM is to upload a full copy of the project via phpstorm. Or of course I can send them individually but it also takes too much effort.
So my question is if there is a feature or plugin for phpstorm which automatically uploads only the changed files after a git checkout.
Thank you!
You can :
sync src code with option deployement to delete the file that no existing in target location
create a external tools for sync
create macro that launch a git pull and after launch a sync
create external tools for sync AND others for pulling git branch
When you create a macro or external tools don't forget that you can launch those with a shortcut.
I'm starting a new web app with Openshift (jboss, mysql). It's the first time I use openshift and after reading through some doc and experimenting a bit with it, I'm having one question regarding best practices for the architecture of my app.
There will be some files generated by- or uploaded to the application (resources). I'd like those files to be outside the deployment folder so they are not erased/overwritten when the app deploys again. I have browsed through the directories and I was wondering:
is it ok to use the /var/lib/openshift/[openshift-id]/app-root/data folder for these files?
Yes, you should use your ~/app-root/data folder for any files that you want to not be erased when you do a git push, there is also an environment variable that you can use that points to that folder called OPENSHIFT_DATA_DIR. Please note that if you are using a scaled application, that folder is not shared among your gears.
I am trying to move an old Wordpress install to Openshift.
So I setup two gears, one running MySQL (Gear #1) and the other is setup to be a scalable PHP5 gear (Gear #2). I have manually restored the database data to Gear #1 and manually restored original Wordpress files in Gear #2 under ~/app-root/runtime/repo. The app is running fine now with everything in place.
However, when I try to raise the max number of scalable PHP5 gears from 1 to 2, the app stopped working and showing only the default gear landing page, just like what an empty gear would show. Setting maximum scalable gears back to 1 then the app would work again.
Is it true that the Wordpress files (or any other PHP or web files under ~/app-root/runtime/repo) must be checked in with Git in Gear #2, in order for scaling up to Gear #3+ to work properly? If so, is there anyway I can check-in the files that I already have in Gear #2 from within itself? If not, how can I check-in the set of files that I already have from the old Wordpress install?
Thank you for your help in advance!
Cheers,
KC
If you want to get the files on your web gear into git you have two options:
1.) SSH or SFTP into your gear and copy the files to your local workstation, then clone your git repo to your local machine, and copy the files into it, git commit & git push. Then your files will be deployed properly.
2.) SSH into your gear, initialize a git repo in your app-root/repo folder, and then setup your git repo in that gear (the one openshift created) as a remote and add/commit/push your files, then you can do a clone on your local workstation and a push and everything should deploy correctly.
I spoke with operations about this:
We do an rsync from the app-deployments directory, which are the files that were in git. So it does seem at this point that git must be used for scaled applications to work correctly. Please add your use case to http://openshift.com/ideas
Hi I am new to open shift . I don't know how to create repository and deploying our project to it. I have configured it through command prompt. After installing rhc successfully through command prompt I am getting confusion of help given on Open Shift site regarding uploading the application not about pushing and commiting. I got the idea about commiting and pushing but I did not get the idea about deploying or uploading the application first time . Please help me I am getting stuck for a lot of time thanks in advance
Deploying and Building Application
All OpenShift applications are built around a Git source control workflow - you code locally, then push your changes to the server. The server then runs a number of hooks to build and configure your application, and finally restarts your application. Optionally, applications can elect to be built using Jenkins, or run using "hot deployment" which speeds up the deployment of code to OpenShift.
Making Changes to your Application
As a developer on OpenShift, you make code changes on your local machine, check those changes in locally, and then "push" those changes to OpenShift. One of the primary advantages of Git is that it does not require a continuous online presence in order to run. You can easily check in (in Git terminology, 'commit') and revert changes locally before deciding to upload those changes to OpenShift.
Every OpenShift application you create has its own Git repository that only you can access. If you create your application from the command line, rhc will automatically download a copy of that repository (Git calls this 'cloning') to your local system. If you create an application from the web console, you'll 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>
Once you make changes, you'll need to 'add' and 'commit' those changes - 'add' tells Git that a file or set of files will become part of a larger check in, and 'commit' completes the check in. Git requires that each commit have a message to describe it.
$ git add .
$ git commit -m "A checkin to my application"
Finally, you're ready to send your changes to your application - you'll 'push' these changes with:
$ git push
The output of the push command will contain information from OpenShift about your deployment -
Source Click me
There are two options for deploying content to the Tomcat Server within OpenShift. Both options
can be used together (i.e. build one archive from source and others pre-built)
1) (Preferred) You can upload your content in a Maven src structure as is this sample project and on
git push have the application built and deployed. For this to work you'll need your pom.xml at the
root of your repository and a maven-war-plugin like in this sample to move the output from the build
to the webapps directory. By default the warName is ROOT within pom.xml. This will cause the
webapp contents to be rendered at http://app_name-namespace.rhcloud.com/. If you change the warName in
pom.xml to app_name, your base url would then become http://app_name-namespace.rhcloud.com/app_name.
Note: If you are building locally you'll also want to add any output wars under webapps
from the build to your .gitignore file.
Note: If you are running scaled EWS2.0 then you need an application deployed to the root context (i.e.
http://app_name-namespace.rhcloud.com/) for the HAProxy load-balancer to recognize that the EWS2.0 instance
is active.
or
2) You can git push pre-built wars into webapps/. To do this
with the default repo you'll want to first run 'git rm -r src/ pom.xml' from the root of your repo.
Basic workflows for deploying pre-built content (each operation will require associated git add/commit/push operations to take effect):
A) Add new zipped content and deploy it:
cp target/example.war webapps/
B) Undeploy currently deployed content:
git rm webapps/example.war
C) Replace currently deployed zipped content with a new version and deploy it:
cp target/example.war webapps/
Note: You can get the information in the uri above from running 'rhc domain show'
If you have already committed large files to your git repo, you rewrite or reset the history of those files in git
to an earlier point in time and then 'git push --force' to apply those changes on the remote OpenShift server. A
git gc on the remote OpenShift repo can be forced with (Note: tidy also does other cleanup including clearing log
files and tmp dirs):
rhc app tidy -a appname
Whether you choose option 1) or 2) the end result will be the application
deployed into the webapps directory. The webapps directory in the
Tomcat distribution is the location end users can place
their deployment content (e.g. war, ear, jar, sar files) to have it
automatically deployed into the server runtime.
Here is really good tutorial prepared by openshift guys with source code so you can go wrong with it.
https://www.openshift.com/blogs/spring-polyglot-persistence-part-1
To sum up - if you have your application on some repository just create your application so it creates folder with git repo in your directory
rhc app create notebook jbossas-7 -l <openshift_login_email> -d
Go to newly created directory and replace default openshift 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 java application build.
What application type is your app? Java/PHP/Python...? If it is a PHP based app, then externally exposed PHP code should go into "php" directory. Whenever you create an application using the rhc commands, a local repository is created, inside which you will find a README document, which lists your deployment steps. Additionally, you can refer to OpenShift user guide here:
https://www.openshift.com/sites/default/files/documents/OpenShift-2.0-User_Guide-en-US_5.pdf
Is it possible to configure JBoss to have a fixed directory name for the exploded war present inside tmp directory? On every restart, the exploded war directories name changes with a random string is appended to them.
In JBoss 6, we have the following structure for our war file my-project.war:
JBOSS_HOME\server\default\tmp\vfs\automount8sc4d112587f64c\my-project.war-98eea116d17f4a53
What I want is: Can we have the above path name fixed for all restarts and deployments?
We could not bookmark the jsp/html/js/css files in our text editors due to this.
In WebLogic server, there is a fixed directory structure for all restarts and deployments. It is very convenient for quick HTML/CSS/JavaScript coding. Can we have something like that in JBoss.
You are trying to reference the temp directory of jboss where the application server unzips war-files, etc.
Try to unzip your war file, name the folder <your-project>.war and move it to the deploy folder. Unless jboss does not need to unpack it, the files (HTML/CSS/JavaScript) should be delivered from this place.