|
1 | | -Deploying on Openshift |
| 1 | +Deploying |
2 | 2 | ====================== |
3 | 3 |
|
4 | | -Register for openshift account and create a tomcat 7 app with mysql support. Execute the following command in a newly-created directory (e.g. statealerts-deployment) |
| 4 | +Make sure you have installed MySQL and Tomcat (at least 7). Nginx / apache with forwarding to Tomcat is also desirable. |
5 | 5 |
|
6 | | - rhc app create -a statealerts jbossews-2.0 mysql-5.1 |
| 6 | +Copy the war file from _webapp/target_ into the _webapps_ server folder as _ROOT.war_ |
7 | 7 |
|
8 | | -Clone the openshift git repo: |
| 8 | +In _$TOMCAT/conf/server.xml_ find the _Connector_ element and add _URIEncoding="utf-8"_ attribbute so it looks like |
9 | 9 |
|
10 | | - git clone <your repo> |
11 | | - |
12 | | -Delete the _src_ folder and _pom.xml_ file from the template |
13 | | - |
14 | | - cd statealerts |
15 | | - git rm -r src/ pom.xml |
16 | | - |
17 | | -Copy the prebuid war into _webapps_ folder as _ROOT.war_ |
18 | | - |
19 | | - cp <path-to-source>/webapp/target/statealerts-0.0.1-SNAPSHOT.war webapps/ROOT.war |
20 | | - |
21 | | -In _.openshift/config/server.xml_ find _Connector_ element and add _URIEncoding="utf-8"_ attribbute so it looks like |
22 | | - |
23 | | - <Connector address="${OPENSHIFT_JBOSSEWS_IP}" |
24 | | - port="${OPENSHIFT_JBOSSEWS_HTTP_PORT}" |
| 10 | + <Connector port="..." |
25 | 11 | protocol="HTTP/1.1" |
26 | 12 | connectionTimeout="20000" |
27 | | - URIEncoding="utf-8" |
| 13 | + URIEncoding="UTF-8" |
28 | 14 | redirectPort="8443"/> |
29 | 15 |
|
30 | | -In _.openshift/action_hooks_ folder create a file called _pre_start_jbossews_ with following contents |
| 16 | +And also add the following at the bottom of the _Engine_ element: |
31 | 17 |
|
32 | | - export CATALINA_OPTS="-Dstatealerts.config.location=${OPENSHIFT_REPO_DIR}/config -Duser.timezone=UTC" |
33 | | - |
34 | | -In repository root folder create folder called _config_ and copy there all files from _project-root/config_ (at least the following configuration files _statealert.properties_, _extractors.json_, _ehcache.xml_) |
| 18 | + <Host name="yourdomain.com" appBase="webapps" unpackWARs="true" autoDeploy="true"> |
| 19 | + <Alias>www.yourdomain.com</Alias> |
| 20 | + <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs/access" prefix="welshare_access_" suffix=".log" pattern="%h %l %u %t "%r" %s %b, t=%D" resolveHosts="false"/> |
| 21 | + <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60" /> |
| 22 | + </Host> |
35 | 23 |
|
36 | | -Commit your changes |
| 24 | +Also change the defaultHost of your Engine: |
37 | 25 |
|
38 | | - git add webapps config .openshift |
39 | | - git commit -m "Inital commit for state alerts app." |
| 26 | + <Engine name="Catalina" defaultHost="yourdomain.com"> |
| 27 | + |
40 | 28 |
|
41 | | -To deploy the application execute |
| 29 | +Create a config folder (e.g. /var/config) and copy there all files from _project-root/config_ (at least the following configuration files _statealert.properties_, _extractors.json_, _ehcache.xml_) |
42 | 30 |
|
43 | | - git push |
| 31 | +Add the following in catalina.sh |
44 | 32 |
|
45 | | -Note: If the disk space on the server is over, you have to clean the git repo. Follow these steps to do so: https://www.openshift.com/forums/openshift/how-to-erase-all-history-from-a-git-repository-on-openshift-and-start-over-with |
| 33 | + export CATALINA_OPTS="-Dstatealerts.config.location=/var/config -Duser.timezone=UTC" |
| 34 | + |
0 commit comments