bhugueney / openshift-jsp Goto Github PK
View Code? Open in Web Editor NEWsimple example of jsp on openshift
simple example of jsp on openshift
Repo layout =========== webapps/ - location for built wars (Details below) src/ - Maven src structure pom.xml - Maven build file .openshift/ - location for openshift specific files .openshift/config/ - location for configuration files such as standalone.xml (used to modify jboss config such as datasources) .openshift/action_hooks/pre_build - Script that gets run every git push before the build (on the CI system if available) .openshift/action_hooks/build - Script that gets run every git push as part of the build process (on the CI system if available) .openshift/action_hooks/deploy - Script that gets run every git push after build but before the app is restarted .openshift/action_hooks/post_deploy - Script that gets run every git push after the app is restarted .openshift/action_hooks/pre_start_jbossews-2.0 - Script that gets run prior to starting EWS2.0 .openshift/action_hooks/post_start_jbossews-2.0 - Script that gets run after EWS2.0 is started .openshift/action_hooks/pre_stop_jbossews-2.0 - Script that gets run prior to stopping EWS2.0 .openshift/action_hooks/post_stop_jbossews-2.0 - Script that gets run after EWS2.0 is stopped Notes about layout ================== Note: Every time you push, everything in your remote repo dir gets recreated please store long term items (like an sqlite database) in the OpenShift data directory, which will persist between pushes of your repo. The OpenShift data directory is accessible relative to the remote repo directory (../data) or via an environment variable OPENSHIFT_DATA_DIR. Details about layout and deployment options ================== 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: 1. cp target/example.war webapps/ B) Undeploy currently deployed content: 1. git rm webapps/example.war C) Replace currently deployed zipped content with a new version and deploy it: 1. 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. Environment Variables ===================== OpenShift provides several environment variables to reference for ease of use. The following list are some common variables but far from exhaustive: System.getenv("OPENSHIFT_APP_NAME") - Application name System.getenv("OPENSHIFT_DATA_DIR") - For persistent storage (between pushes) System.getenv("OPENSHIFT_TMP_DIR") - Temp storage (unmodified files deleted after 10 days) System.getenv("OPENSHIFT_INTERNAL_IP") - The IP address used to bind EWS2.0 When embedding a database using 'rhc cartridge add', you can reference environment variables for username, host and password. For example, when embedding MySQL 5.1, the following variables will be available: System.getenv("OPENSHIFT_MYSQL_DB_HOST") - DB host System.getenv("OPENSHIFT_MYSQL_DB_PORT") - DB Port System.getenv("OPENSHIFT_MYSQL_DB_USERNAME") - DB Username System.getenv("OPENSHIFT_MYSQL_DB_PASSWORD") - DB Password To get a full list of environment variables, simply add a line in your .openshift/action_hooks/build script that says "export" and push.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.