This simple application will enable you to run Nexus maven repository manager on Apache Tomcat in your OpenShift's diy gear. It downloads Tomcat and Nexus war and installs them in your OpenShift gear.
-
You need to create diy application in your OpenShift account.
It can be done by
rhc
client tool:rhc app create -a nexus -t diy-0.1
Another way is to create it manually from your OpenShift web console:
Click on 'Add Application...', scroll all the way down and select 'Do-It-Yourself 0.1', insert name of your application (most likelynexus
) into 'Public URL' field and click on 'Create Application'. -
Clone git repository of your newly created application, and then merge it with this repository:
git remote add openshift-nexus https://github.com/mirogula/openshift-nexus.git git pull -s recursive -X theirs openshift-nexus master git push
Or you can just copy content of
diy/
directory and.openshift/action_hooks/
directory from this repository to your application repository. -
Finally commit and push changes back to OpenShift.
You can change versions of Tomcat or Nexus in .openshift/action_hooks/deploy
file by editing $TOMCAT_VER
or $NEXUS_VER
variables.
If you had already Tomcat and Nexus installed by this application, you can force
installation of new versions by deleting $OPENSHIFT_DATA_DIR/tomcat/
directory
in your OpenShift gear:
ssh <username>@<nexus>-<your-subdomain>.rhcloud.com
rm -rf $OPENSHIFT_DATA_DIR/tomcat/
By default this application configures Tomcat and Nexus to use only https protocol.
To activate http protocol comment out this lines in .openshift/action_hooks/deploy
file:
cp $OPENSHIFT_DATA_DIR/tomcat/conf/context.xml \
$OPENSHIFT_DATA_DIR/tomcat/conf/context.xml.original
delta_file="$OPENSHIFT_REPO_DIR/diy/tomcat/conf/context.xml.add-remoteIpValve"
echo -e "/<\/Context>/-1r $delta_file\n%w" \
| ed -s $OPENSHIFT_DATA_DIR/tomcat/conf/context.xml
cp $OPENSHIFT_DATA_DIR/tomcat/webapps/ROOT/WEB-INF/web.xml \
$OPENSHIFT_DATA_DIR/tomcat/webapps/ROOT/WEB-INF/web.xml.original
delta_file="$OPENSHIFT_REPO_DIR/diy/nexus/WEB-INF/web.xml.add-https-security-constraint"
echo -e "/<\/web-app>/-1r $delta_file\n%w" \
| ed -s $OPENSHIFT_DATA_DIR/tomcat/webapps/ROOT/WEB-INF/web.xml
As previously if you had already Tomcat and Nexus installed by this application,
you must delete $OPENSHIFT_DATA_DIR/tomcat/
directory in your OpenShift gear
to force reinstallation. Otherwise changes you had just made won't be effective.
Because small gears have only 512 MB ram, you can set maximum java heap size for
Nexus to avoid problems with memory allocation and swapping. By default this option
is set to 384 MB. You can change it in .openshift/action_hooks/start
by editing this
line: JAVA_XMX_CONFIG="-Xmx384M"
.