diff --git a/cartridges/openshift-origin-cartridge-abstract/abstract-jboss/info/bin/deploy_httpd_proxy.sh b/cartridges/openshift-origin-cartridge-abstract/abstract-jboss/info/bin/deploy_httpd_proxy.sh index 4c9507b9109..88173f7ebdd 100755 --- a/cartridges/openshift-origin-cartridge-abstract/abstract-jboss/info/bin/deploy_httpd_proxy.sh +++ b/cartridges/openshift-origin-cartridge-abstract/abstract-jboss/info/bin/deploy_httpd_proxy.sh @@ -18,9 +18,14 @@ namespace=`basename $2` uuid=$3 IP=$4 +source "/etc/openshift/node.conf" +source ${CARTRIDGE_BASE_PATH}/abstract/info/lib/util + +cartridge_type=$(get_cartridge_name_from_path) + oo-frontend-connect \ --with-container-uuid "$uuid" \ --with-container-name "$application" \ --with-namespace "$namespace" \ --path "" --target "$IP:8080" --websocket \ - --path "/swydws" --target "$IP:18001/swydws" + --path "/health" --target "${CARTRIDGE_BASE_PATH}/${cartridge_type}/info/configuration/health.html" --file diff --git a/cartridges/openshift-origin-cartridge-jbossas-7/template/src/main/webapp/WEB-INF/web.xml b/cartridges/openshift-origin-cartridge-jbossas-7/template/src/main/webapp/WEB-INF/web.xml old mode 100644 new mode 100755 index 8f14d0b73a3..fa91269747c --- a/cartridges/openshift-origin-cartridge-jbossas-7/template/src/main/webapp/WEB-INF/web.xml +++ b/cartridges/openshift-origin-cartridge-jbossas-7/template/src/main/webapp/WEB-INF/web.xml @@ -6,14 +6,6 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="false"> - - health - /health.jsp - - - health - /health - diff --git a/cartridges/openshift-origin-cartridge-jbossas-7/template/src/main/webapp/health.jsp b/cartridges/openshift-origin-cartridge-jbossas-7/template/src/main/webapp/health.jsp deleted file mode 100644 index d00491fd7e5..00000000000 --- a/cartridges/openshift-origin-cartridge-jbossas-7/template/src/main/webapp/health.jsp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/cartridges/openshift-origin-cartridge-jbosseap-6.0/template/src/main/webapp/WEB-INF/web.xml b/cartridges/openshift-origin-cartridge-jbosseap-6.0/template/src/main/webapp/WEB-INF/web.xml old mode 100644 new mode 100755 index 8f14d0b73a3..fa91269747c --- a/cartridges/openshift-origin-cartridge-jbosseap-6.0/template/src/main/webapp/WEB-INF/web.xml +++ b/cartridges/openshift-origin-cartridge-jbosseap-6.0/template/src/main/webapp/WEB-INF/web.xml @@ -6,14 +6,6 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="false"> - - health - /health.jsp - - - health - /health - diff --git a/cartridges/openshift-origin-cartridge-jbosseap-6.0/template/src/main/webapp/health.jsp b/cartridges/openshift-origin-cartridge-jbosseap-6.0/template/src/main/webapp/health.jsp deleted file mode 100644 index d00491fd7e5..00000000000 --- a/cartridges/openshift-origin-cartridge-jbosseap-6.0/template/src/main/webapp/health.jsp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/cartridges/openshift-origin-cartridge-jbossews-1.0/info/bin/deploy_httpd_proxy.sh b/cartridges/openshift-origin-cartridge-jbossews-1.0/info/bin/deploy_httpd_proxy.sh index c5a233112b0..66667838c79 100755 --- a/cartridges/openshift-origin-cartridge-jbossews-1.0/info/bin/deploy_httpd_proxy.sh +++ b/cartridges/openshift-origin-cartridge-jbossews-1.0/info/bin/deploy_httpd_proxy.sh @@ -18,9 +18,11 @@ namespace=`basename $2` uuid=$3 IP=$4 +source "/etc/openshift/node.conf" + oo-frontend-connect \ --with-container-uuid "$uuid" \ --with-container-name "$application" \ --with-namespace "$namespace" \ --path "" --target "$IP:8080" --websocket \ - --path "/swydws" --target "$IP:18001/swydws" + --path "/health" --target "${CARTRIDGE_BASE_PATH}/jbossews-1.0/info/configuration/health.html" --file diff --git a/cartridges/openshift-origin-cartridge-jbossews-1.0/template/src/main/webapp/WEB-INF/web.xml b/cartridges/openshift-origin-cartridge-jbossews-1.0/template/src/main/webapp/WEB-INF/web.xml old mode 100644 new mode 100755 index 8f14d0b73a3..fa91269747c --- a/cartridges/openshift-origin-cartridge-jbossews-1.0/template/src/main/webapp/WEB-INF/web.xml +++ b/cartridges/openshift-origin-cartridge-jbossews-1.0/template/src/main/webapp/WEB-INF/web.xml @@ -6,14 +6,6 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="false"> - - health - /health.jsp - - - health - /health - diff --git a/cartridges/openshift-origin-cartridge-jbossews-1.0/template/src/main/webapp/health.jsp b/cartridges/openshift-origin-cartridge-jbossews-1.0/template/src/main/webapp/health.jsp deleted file mode 100644 index d00491fd7e5..00000000000 --- a/cartridges/openshift-origin-cartridge-jbossews-1.0/template/src/main/webapp/health.jsp +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/cartridges/openshift-origin-cartridge-jbossews-2.0/info/bin/deploy_httpd_proxy.sh b/cartridges/openshift-origin-cartridge-jbossews-2.0/info/bin/deploy_httpd_proxy.sh index 45fd6640c67..608834d47c1 100755 --- a/cartridges/openshift-origin-cartridge-jbossews-2.0/info/bin/deploy_httpd_proxy.sh +++ b/cartridges/openshift-origin-cartridge-jbossews-2.0/info/bin/deploy_httpd_proxy.sh @@ -18,9 +18,11 @@ namespace=`basename $2` uuid=$3 IP=$4 +source "/etc/openshift/node.conf" + oo-frontend-connect \ --with-container-uuid "$uuid" \ --with-container-name "$application" \ --with-namespace "$namespace" \ --path "" --target "$IP:8080" --websocket \ - --path "/swydws" --target "$IP:18001/swydws" + --path "/health" --target "${CARTRIDGE_BASE_PATH}/jbossews-2.0/info/configuration/health.html" --file diff --git a/cartridges/openshift-origin-cartridge-jbossews-2.0/template/README b/cartridges/openshift-origin-cartridge-jbossews-2.0/template/README old mode 100644 new mode 100755 index 2f615fd59d1..c3e6c6ef39e --- a/cartridges/openshift-origin-cartridge-jbossews-2.0/template/README +++ b/cartridges/openshift-origin-cartridge-jbossews-2.0/template/README @@ -1,6 +1,6 @@ Repo layout =========== -deployments/ - location for built wars (Details below) +webapps/ - location for built wars (Details below) src/ - Maven src structure pom.xml - Maven build file .openshift/ - location for openshift specific files @@ -9,6 +9,11 @@ pom.xml - Maven build file .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 ================== @@ -21,56 +26,41 @@ Note: Every time you push, everything in your remote repo dir gets recreated Details about layout and deployment options ================== -There are two options for deploying content to the JBoss Application Server within OpenShift: +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 deployments directory. By default the warName is ROOT within pom.xml. This will cause the +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/ears under deployments +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 prebuilt wars (with the corresponding .dodeploy file for exploded wars) into deployments/. To do this +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 prebuilt content (each operation will require associated git add/commit/push operations to take effect): +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 deployments/ - -B) Add new unzipped content and deploy it: - -1. cp -r target/example.war/ deployments/ -2. touch deployments/example.war.dodeploy - -C) Undeploy currently deployed content: +1. cp target/example.war webapps/ -1. git rm deployments/example.war.dodeploy deployments/example.war +B) Undeploy currently deployed content: -D) Replace currently deployed zipped content with a new version and deploy it: +1. git rm webapps/example.war -1. cp target/example.war deployments/ +C) Replace currently deployed zipped content with a new version and deploy it: -E) Replace currently deployed unzipped content with a new version and deploy it: - -1. git rm -rf deployments/example.war/ -2. cp -r target/example.war/ deployments/ -3. touch deployments/example.war.dodeploy - -WARNING: If you go with option 2) there are a couple issues to keep in mind with both prebuilt and exploded -wars. With exploded wars the main issue is with committing binaries (class and jar files) can make merge -conflicts tedious. With prebuilt wars the main issue is each time you modify the war and git push, it -takes up the size of the war file away from your OpenShift file system quota. One alternative to this -(other then using Maven from option 1) is to use rsync to push your war into the deployments folder. You -would have to do this after each git push followed by 'rhc app restart -a appname'. Example: - -rsync -avz localdir/deployments/ app_uuid@appname-namespace.rhcloud.com:~/appname/repo/deployments/ +1. cp target/example.war webapps/ Note: You can get the information in the uri above from running 'rhc domain show' @@ -83,62 +73,21 @@ rhc app tidy -a appname Whether you choose option 1) or 2) the end result will be the application -deployed into the deployments directory. The deployments directory in the -JBoss Application Server distribution is the location end users can place +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. -The filesystem deployment scanner in AS 7 and later works differently from -previous JBoss AS releases. The scanner will no longer attempt to directly -monitor the deployment content and decide if or when the end user wishes -the content to be deployed. Instead, the scanner relies on a system of marker -files, with the user's addition or removal of a marker file serving as a sort -of command telling the scanner to deploy, undeploy or redeploy content. - -The marker files always have the same name as the deployment content to which -they relate, but with an additional file suffix appended. For example, the -marker file to indicate the example.war should be deployed is named -example.war.dodeploy. Different marker file suffixes have different meanings. - -The relevant marker file types are: - -.dodeploy -- Placed by the user to indicate that the given content should - be deployed into the runtime (or redeployed if already - deployed in the runtime.) - -.deploying -- Placed by the deployment scanner service to indicate that it - has noticed a .dodeploy file and is in the process of - deploying the content. This marker file will be deleted when - the deployment process completes. - -.deployed -- Placed by the deployment scanner service to indicate that the - given content has been deployed into the runtime. If an end - user deletes this file, the content will be undeployed. - -.faileddeploy -- Placed by the deployment scanner service to indicate that the - given content failed to deploy into the runtime. The content - of the file will include some information about the cause of - the failure. - -.undeploying -- Placed by the deployment scanner service to indicate that it - has noticed a .deployed file has been deleted and the - content is being undeployed. This marker file will be deleted - when the undeployment process completes. - -.undeployed -- Placed by the deployment scanner service to indicate that the - given content has been undeployed from the runtime. If an end - user deletes this file, it has no impact. - - 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_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 diff --git a/cartridges/openshift-origin-cartridge-jbossews-2.0/template/src/main/webapp/WEB-INF/web.xml b/cartridges/openshift-origin-cartridge-jbossews-2.0/template/src/main/webapp/WEB-INF/web.xml old mode 100644 new mode 100755 index 8f14d0b73a3..fa91269747c --- a/cartridges/openshift-origin-cartridge-jbossews-2.0/template/src/main/webapp/WEB-INF/web.xml +++ b/cartridges/openshift-origin-cartridge-jbossews-2.0/template/src/main/webapp/WEB-INF/web.xml @@ -6,14 +6,6 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="false"> - - health - /health.jsp - - - health - /health - diff --git a/cartridges/openshift-origin-cartridge-jbossews-2.0/template/src/main/webapp/health.jsp b/cartridges/openshift-origin-cartridge-jbossews-2.0/template/src/main/webapp/health.jsp deleted file mode 100644 index d00491fd7e5..00000000000 --- a/cartridges/openshift-origin-cartridge-jbossews-2.0/template/src/main/webapp/health.jsp +++ /dev/null @@ -1 +0,0 @@ -1