#! /bin/sh
# which java
export JAVA_HOME="/some/path/java/jdk-8u60"
# which tomee
export CATALINA_HOME="/some/path/tomee/tomee-7.0.0-M3"
# where is the application - to let tomcat/tomee finds the configuration
export CATALINA_BASE="/some/path/application1/"
# to let tomee be able to kill the instance if shutdown doesn't work (see shutdown script)
export CATALINA_PID="/some/path/application1/work/tomee.pid"
How to Setup TomEE in production
You can use TomEE as described on Directory Structure page but in production it is better to split TomEE and application binaries and configuration.
Idea is to have this kind of layout (the root is the one you prefer):
- /some/path
- tomee
- tomee-1.7.1
- bin
- conf
- lib
- tomee-1.7.2
- bin
- conf
- lib
- tomee-7.0.0-M3
- bin
- conf
- lib
- applications
- application1
- bin
- conf
- lib
- logs
- work
- temp
- webapps
- application2
- bin
- conf
- lib
- logs
- work
- temp
- webapps
Click on a tree node or open a folder to see the detail there.
Instance scripts
The idea for instances (applications) scripts is to simply delegate to tomcat ones but customizing the JVM and TomEE versions.
Customizing the version (and locations) is done in bin/setenv.sh
of instances.
Here are an example for the common scripts (of course you can write helper version like restart etc).
setenv.sh
startup
#! /bin/bash
proc_script_base="`cd $(dirname $0) && cd .. && pwd`"
source "$proc_script_base/bin/setenv.sh"
nohup "$CATALINA_HOME/bin/startup.sh" "$@" > $proc_script_base/logs/nohup.log &
shutdown
#! /bin/bash
proc_script_base="`cd $(dirname $0) && cd .. && pwd`"
source "$proc_script_base/bin/setenv.sh"
# we support parameters like timeout and force, typically we would call it this way: ./shutdown 1200 -force
"$CATALINA_HOME/bin/shutdown.sh" "$@"