-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Dec 11, 2011
0 parents
commit 74876de
Showing
19 changed files
with
1,075 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# This is a simple build script and will be executed on your CI system if | ||
# available. Otherwise it will execute while your application is stopped | ||
# before the deploy step. This script gets executed directly, so it | ||
# could be python, php, ruby, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# This deploy hook gets executed after dependencies are resolved and the | ||
# build hook has been run but before the application has been started back | ||
# up again. This script gets executed directly, so it could be python, php, | ||
# ruby, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# This is a simple post deploy hook executed after your application | ||
# is deployed and started. This script gets executed directly, so | ||
# it could be python, php, ruby, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# This is a simple script and will be executed on your CI system if | ||
# available. Otherwise it will execute while your application is stopped | ||
# before the build step. This script gets executed directly, so it | ||
# could be python, php, ruby, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Place your jboss-as7 modules in this directory. This directory is added to the | ||
module path of the jboss-as7 server associated with your application. It has the | ||
same structure as the jboss-as7/modules directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ Copyright 2011, Red Hat, Inc., and individual contributors | ||
~ as indicated by the @author tags. See the copyright.txt file in the | ||
~ distribution for a full listing of individual contributors. | ||
~ | ||
~ This is free software; you can redistribute it and/or modify it | ||
~ under the terms of the GNU Lesser General Public License as | ||
~ published by the Free Software Foundation; either version 2.1 of | ||
~ the License, or (at your option) any later version. | ||
~ | ||
~ This software is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
~ Lesser General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Lesser General Public | ||
~ License along with this software; if not, write to the Free | ||
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
--> | ||
|
||
<server xmlns="urn:jboss:domain:1.0"> | ||
|
||
<extensions> | ||
<extension module="org.jboss.as.clustering.infinispan"/> | ||
<extension module="org.jboss.as.connector"/> | ||
<extension module="org.jboss.as.deployment-scanner"/> | ||
<extension module="org.jboss.as.ee"/> | ||
<extension module="org.jboss.as.ejb3"/> | ||
<extension module="org.jboss.as.jaxrs"/> | ||
<extension module="org.jboss.as.jmx"/> | ||
<extension module="org.jboss.as.jpa"/> | ||
<extension module="org.jboss.as.logging"/> | ||
<extension module="org.jboss.as.naming"/> | ||
<extension module="org.jboss.as.sar"/> | ||
<extension module="org.jboss.as.security"/> | ||
<extension module="org.jboss.as.threads"/> | ||
<extension module="org.jboss.as.transactions"/> | ||
<extension module="org.jboss.as.web" /> | ||
<extension module="org.jboss.as.weld" /> | ||
</extensions> | ||
|
||
<profile> | ||
<subsystem xmlns="urn:jboss:domain:logging:1.0"> | ||
<console-handler name="CONSOLE"> | ||
<level name="INFO"/> | ||
<formatter> | ||
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> | ||
</formatter> | ||
</console-handler> | ||
|
||
<periodic-rotating-file-handler name="FILE"> | ||
<level name="INFO"/> | ||
<formatter> | ||
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> | ||
</formatter> | ||
<file relative-to="jboss.server.log.dir" path="server.log"/> | ||
<suffix value=".yyyy-MM-dd"/> | ||
</periodic-rotating-file-handler> | ||
|
||
<logger category="com.arjuna"> | ||
<level name="WARN"/> | ||
</logger> | ||
<logger category="org.apache.tomcat.util.modeler"> | ||
<level name="WARN"/> | ||
</logger> | ||
<logger category="sun.rmi"> | ||
<level name="WARN"/> | ||
</logger> | ||
|
||
<root-logger> | ||
<level name="INFO"/> | ||
<handlers> | ||
<handler name="CONSOLE"/> | ||
<handler name="FILE"/> | ||
</handlers> | ||
</root-logger> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:datasources:1.0"> | ||
<datasources> | ||
<datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS"> | ||
<connection-url>jdbc:h2:${jboss.server.data.dir}/test;DB_CLOSE_DELAY=-1</connection-url> | ||
<driver>h2</driver> | ||
<pool></pool> | ||
<security> | ||
<user-name>sa</user-name> | ||
<password>sa</password> | ||
</security> | ||
<validation></validation> | ||
<timeout></timeout> | ||
<statement></statement> | ||
</datasource> | ||
<datasource jndi-name="java:jboss/datasources/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS"> | ||
<connection-url>jdbc:mysql://${OPENSHIFT_DB_HOST}:${OPENSHIFT_DB_PORT}/${OPENSHIFT_APP_NAME}</connection-url> | ||
<driver>mysql</driver> | ||
<security> | ||
<user-name>${OPENSHIFT_DB_USERNAME}</user-name> | ||
<password>${OPENSHIFT_DB_PASSWORD}</password> | ||
</security> | ||
</datasource> | ||
<drivers> | ||
<driver name="h2" module="com.h2database.h2"> | ||
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> | ||
</driver> | ||
<driver name="mysql" module="com.mysql.jdbc"> | ||
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class> | ||
</driver> | ||
</drivers> | ||
</datasources> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0"> | ||
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" /> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:ee:1.0" /> | ||
<subsystem xmlns="urn:jboss:domain:ejb3:1.0" /> | ||
<subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate"> | ||
<cache-container name="hibernate" default-cache="local-query"> | ||
<local-cache name="entity"> | ||
<eviction strategy="LRU" max-entries="10000"/> | ||
<expiration max-idle="100000"/> | ||
</local-cache> | ||
<local-cache name="local-query"> | ||
<eviction strategy="LRU" max-entries="10000"/> | ||
<expiration max-idle="100000"/> | ||
</local-cache> | ||
<local-cache name="timestamps"> | ||
<eviction strategy="NONE"/> | ||
</local-cache> | ||
</cache-container> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/> | ||
<subsystem xmlns="urn:jboss:domain:jca:1.0"> | ||
<archive-validation enabled="false" /> | ||
<bean-validation enabled="false" /> | ||
<default-workmanager> | ||
<short-running-threads blocking="true"> | ||
<core-threads count="5" per-cpu="10"/> | ||
<queue-length count="5" per-cpu="10"/> | ||
<max-threads count="5" per-cpu="10"/> | ||
<keepalive-time time="10" unit="seconds"/> | ||
</short-running-threads> | ||
<long-running-threads blocking="true"> | ||
<core-threads count="5" per-cpu="10"/> | ||
<queue-length count="5" per-cpu="10"/> | ||
<max-threads count="5" per-cpu="10"/> | ||
<keepalive-time time="10" unit="seconds"/> | ||
</long-running-threads> | ||
</default-workmanager> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:jpa:1.0"> | ||
<jpa default-datasource=""/> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:naming:1.0" /> | ||
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0" /> | ||
<subsystem xmlns="urn:jboss:domain:sar:1.0"/> | ||
<subsystem xmlns="urn:jboss:domain:security:1.0"> | ||
<security-domains> | ||
<security-domain name="other" cache-type="default"> | ||
<authentication> | ||
<login-module code="UsersRoles" flag="required"/> | ||
</authentication> | ||
</security-domain> | ||
</security-domains> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:threads:1.0"/> | ||
<subsystem xmlns="urn:jboss:domain:transactions:1.0"> | ||
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/> | ||
<core-environment> | ||
<process-id> | ||
<uuid /> | ||
</process-id> | ||
</core-environment> | ||
<coordinator-environment default-timeout="300"/> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host"> | ||
<connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/> | ||
<virtual-server name="default-host" enable-welcome-root="false"> | ||
<alias name="localhost" /> | ||
</virtual-server> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:weld:1.0" /> | ||
</profile> | ||
|
||
<interfaces> | ||
<interface name="management"> | ||
<loopback-address value="${OPENSHIFT_INTERNAL_IP}"/> | ||
</interface> | ||
<interface name="public"> | ||
<loopback-address value="${OPENSHIFT_INTERNAL_IP}"/> | ||
</interface> | ||
</interfaces> | ||
|
||
<socket-binding-group name="standard-sockets" default-interface="public"> | ||
<socket-binding name="http" port="8080"/> | ||
<socket-binding name="https" port="8443"/> | ||
<socket-binding name="jmx-connector-registry" port="1090"/> | ||
<socket-binding name="jmx-connector-server" port="1091"/> | ||
<socket-binding name="jndi" port="1099"/> | ||
<socket-binding name="osgi-http" port="8090"/> | ||
<socket-binding name="remoting" port="4447"/> | ||
<socket-binding name="txn-recovery-environment" port="4712"/> | ||
<socket-binding name="txn-status-manager" port="4713"/> | ||
</socket-binding-group> | ||
|
||
</server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Markers | ||
=========== | ||
|
||
Adding marker files to this directory will have the following effects: | ||
|
||
skip_maven_build - Maven build step will be skipped | ||
|
||
force_clean_build - Will start the build process by removing all non | ||
essential Maven dependencies. Any current dependencies specified in | ||
your pom.xml file will then be re-downloaded. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
Repo layout | ||
=========== | ||
deployments/ - 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) | ||
../data - For persistent data (also in env var OPENSHIFT_DATA_DIR) | ||
.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 | ||
|
||
|
||
Details about layout and deployment options | ||
================== | ||
There are two options for deploying content to the JBoss Application Server within OpenShift Express: | ||
|
||
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 | ||
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 | ||
from the build to your .gitignore file. | ||
|
||
or | ||
|
||
2) You can git push prebuilt wars (with the corresponding .dodeploy file for exploded wars) into deployments/. 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): | ||
|
||
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. git rm deployments/example.war.dodeploy deployments/example.war | ||
|
||
D) Replace currently deployed zipped content with a new version and deploy it: | ||
|
||
1. cp target/example.war deployments/ | ||
|
||
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-ctl-app -a appname -c restart'. Example: | ||
|
||
rsync -avz localdir/deployments/ app_uuid@appname-namespace.rhcloud.com:~/appname/repo/deployments/ | ||
|
||
Note: You can get the information in the uri above from running 'rhc-user-info -a' | ||
|
||
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-ctl-app -a appname -c tidy | ||
|
||
|
||
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 | ||
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 Express 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_APP_DIR") - Application dir | ||
System.getenv("OPENSHIFT_DATA_DIR") - For persistent storage (between pushes) | ||
System.getenv("OPENSHIFT_TMP_DIR") - Temp storage (unmodified files deleted after 10 days) | ||
|
||
When embedding a database using rhc-ctl-app, you can reference environment | ||
variables for username, host and password: | ||
|
||
System.getenv("OPENSHIFT_DB_HOST") - DB host | ||
System.getenv("OPENSHIFT_DB_PORT") - DB Port | ||
System.getenv("OPENSHIFT_DB_USERNAME") - DB Username | ||
System.getenv("OPENSHIFT_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. |
Empty file.
Oops, something went wrong.