-
Notifications
You must be signed in to change notification settings - Fork 0
Running apache tomcat
If you only want to run Tomcat on OSv, there is no need to build a new image. You can either run it with Capstan:
capstan run cloudius/osv-tomcat
or download the latest Tomcat image from here
OSv has support for combining modules into an executable image. There are a couple of pre-configured modules available for OSv already. They reside in osv-apps repo, which is currently added as a submodule to osv.git under apps/
directory. There is a module for tomcat distribution in apps/tomcat. You can adjust it to your needs or just use the default bundle.
For more information about OSv modules checkout this page.
To build the image just run:
make image=tomcat
The image will be in build/release/usr.img
To run it just execute:
sudo scripts/run.py -nv
The -nv
options enable networking. sudo
is needed to configure network interfaces.
If you already have one you can skip this step.
- Download core binary package, eg: http://ftp.ps.pl/pub/apache/tomcat/tomcat-7/v7.0.47/bin/apache-tomcat-7.0.47.tar.gz
- Extract it, eg to
~/bin/apache-tomcat-7.0.47
- [Optional] Configure it
You need to put the package under /usr/tomcat
in the guest file system. For development you can leverage make
process to do so:
- Append the following line to
usr.manifest.template
replacing/home/tgrabiec/bin/
with the directory in which your tomcat package is located in the host:
/usr/tomcat/**:/home/tgrabiec/bin/apache-tomcat-7.0.47/**
- run
make
If you already have the image, you can start OSv and use scp
to copy the package.
Save the following script as tomcat-cmd-line.sh
. It will be used to build the command line for starting tomcat.
#!/usr/bin/env bash
CATALINA_BASE=/usr/tomcat
CATALINA_HOME=$CATALINA_BASE
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar
# Logging
LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
CLASSPATH=$CLASSPATH:$CATALINA_HOME/bin/tomcat-juli.jar
CATALINA_TMPDIR=$CATALINA_BASE/temp
echo "java.so $JAVA_OPTS -cp $CLASSPATH \
$LOGGING_CONFIG \
$LOGGING_MANAGER \
$CATALINA_OPTS \
-Dcatalina.base=$CATALINA_BASE \
-Dcatalina.home=$CATALINA_HOME \
-Djava.io.tmpdir=$CATALINA_TMPDIR \
org.apache.catalina.startup.Bootstrap start"
You can now start OSv:
sudo scripts/run.py -nv -e "`./tomcat-cmd-line.sh`"