Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jboss 7.0.2 added #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions jboss/7.0.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM dockerfile/java

MAINTAINER [email protected]

EXPOSE 8080

ENV JBOSS_VERSION 7.0.2
ENV JBOSS_DIR /opt/jboss-as-web-${JBOSS_VERSION}.Final
ENV DEPLOY_DIR /maven

ENV http_proxy 10.250.0.180:8001
RUN wget http://download.jboss.org/jbossas/7.0/jboss-as-${JBOSS_VERSION}.Final/jboss-as-web-${JBOSS_VERSION}.Final.tar.gz -O /tmp/jboss.tar.gz

# Unpack
RUN tar xzf /tmp/jboss.tar.gz -C /opt
RUN ln -s ${JBOSS_DIR} /opt/jboss
RUN rm /tmp/jboss.tar.gz

# Startup script
ADD deploy-and-run.sh ${JBOSS_DIR}/bin/

CMD /opt/jboss/bin/deploy-and-run.sh
25 changes: 25 additions & 0 deletions jboss/7.0.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Apache Tomcat 8.0

A simple docker build for installing a vanilla Tomcat 8.0 below
*/opt/tomcat*. It comes out of the box and is intended for use for
integration testing.

During startup a directory /maven is checked for .war files. If there
are any, they are linked into Tomcat's webapp/ directory for automatic
deployment. This plays nicely with the Docker maven plugin from
https://github.com/rhuss/docker-maven-plugin/ and its 'assembly' mode which
can automatically can create Docker data container with Maven artefacts
exported from a directory "/maven".

Features:

* Tomcat Version: **8.0.9**
* Java Version: **Oracle 1.7.0_51-b13** (base image: *dockerfile/java*)
* Port: **8080**
* User **admin** (Password: **admin**) has been added to access the admin
applications */host-manager* and */manager*)
* Documentation and examples have been removed
* Command: `/opt/tomcat/bin/deploy-and-run.sh` which links .war files from */maven* to
*/opt/tomcat/webapps* and then calls `catalina.sh run`
* Sets `-Djava.security.egd=file:/dev/./urandom` for faster startup times
(though a bit less secure)
150 changes: 150 additions & 0 deletions jboss/7.0.2/boot2docker-fwd
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#!/bin/bash

usage ()
{
cat <<UsageHERE
boot2docker-fwd -- Helper function to quickly manage port forwards between the boot2docker-vm and the host
Usage: boot2docker-fwd [ -n RULE_NAME ] [ -h HOST_PORT ] [ -p {tcp|udp} ] [ -i HOST_IP ] GUEST_PORT
or boot2docker-fwd -d RULE_NAME
or boot2docker-fwd -l
or boot2docker-fwd -A
or boot2docker-fwd -D

Options:
-n Use RULE_NAME as the name for the rule -- Defaults to "tcp<GUEST_PORT>" or "udp<GUEST_PORT>"
-h Forward HOST_PORT to the guest -- Defaults to the same number as GUEST_PORT
-p Forward tcp or udp traffic to GUEST_PORT -- Defaults to "tcp"
-i Bind the port forward to HOST_IP -- Defaults to the local only loopback, "127.0.0.1"
-d Delete the rule named RULE_NAME from the boot2docker-vm port forwards.
-l List the current port forwards defined for boot2docker-vm
-A Create forward rules for all the ports that docker uses by default with the -P option (49000-49900)
-D Delete all custom rules (i.e. everything except the "docker" and "ssh" rules)
GUEST_PORT The listening port inside boot2docker that will receive connections forwarded by the host

Examples:
boot2docker-fwd 8000
Rule tcp8000: tcp port 8000 on host IP 127.0.0.1 forwarded to guest port 8000

boot2docker-fwd -n fubar -h 8888 8000
Rule fubar: tcp port 8888 on host IP 127.0.0.1 forwarded to guest port 8000

boot2docker-fwd -d fubar
Rule fubar deleted

Notes:
Please don't delete the built in "docker" and "ssh" rules. Things will break.
UsageHERE
}

list_rules_matching ()
{
VBoxManage showvminfo boot2docker-vm | grep "NIC [0-9]* Rule([0-9]*): *name = $1"
}

if [ $# -eq 0 ]
then
usage
exit 1
fi

HOST_IP=127.0.0.1
PROTOCOL=tcp

while getopts "n:h:p:i:d:lAD" opt
do
case $opt in
n)
RULE_NAME="$OPTARG"
;;
h)
if [ "$OPTARG" -eq "$OPTARG" ] 2>/dev/null
then
HOST_PORT=$OPTARG
else
usage
exit 1
fi
;;
p)
if [ "$OPTARG" = "tcp" -o "$OPTARG" = "udp" ]
then
PROTOCOL=$OPTARG
else
usage
exit 1
fi
;;
i)
HOST_IP="$OPTARG"
;;
d)
# Check for a numeric name, prefix the tcp default if so
if [ "$OPTARG" -eq "$OPTARG" ] 2>/dev/null
then
RULE_NAME="tcp$OPTARG"
else
RULE_NAME="$OPTARG"
fi
list_rules_matching $RULE_NAME
if [ $? -eq 0 ]
then
VBoxManage controlvm boot2docker-vm natpf1 delete "$RULE_NAME"
if [ $? -eq 0 ]
then
echo "Rule deleted."
else
echo "Rule not deleted!"
fi
else
echo "Rule $RULE_NAME not found."
fi
exit $?
;;
l)
list_rules_matching
exit 0
;;
A)
echo "Creating 1802 port forwarding rules. Please wait..."
for i in {49000..49900}; do
VBoxManage controlvm boot2docker-vm natpf1 "tcp-port$i,tcp,,$i,,$i"
VBoxManage controlvm boot2docker-vm natpf1 "udp-port$i,udp,,$i,,$i"
done
exit 0
;;
D)
NUM_RULES=$(VBoxManage showvminfo boot2docker-vm | grep 'NIC [0-9]* Rule([0-9]*): *name = ' | grep -o 'name = [^,]*' | grep -cv ' docker\| ssh')
echo "Deleting $NUM_RULES port forwarding rules. Please wait..."
for rule in $(VBoxManage showvminfo boot2docker-vm | grep 'NIC [0-9]* Rule([0-9]*): *name = ' | grep -o 'name = [^,]*' | grep -v ' docker\| ssh' | cut -d ' ' -f 3 )
do
VBoxManage controlvm boot2docker-vm natpf1 delete "$rule"
done
exit 0
;;
esac
done

if [ "$1" -eq "$1" ] 2>/dev/null
then
GUEST_PORT=$1
else
usage
exit 1
fi

if [ -z "$RULE_NAME" ]
then
RULE_NAME="${PROTOCOL}${GUEST_PORT}"
fi


VBoxManage controlvm boot2docker-vm natpf1 "$RULE_NAME,$PROTOCOL,$HOST_IP,$HOST_PORT,,$GUEST_PORT"
if [ $? -eq 0 ]
then
list_rules_matching $RULE_NAME
echo "Rule created."
else
echo "Error creating rule!"
fi
exit $?

13 changes: 13 additions & 0 deletions jboss/7.0.2/deploy-and-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
DIR=${DEPLOY_DIR:-/maven}
echo "Checking *.war in $DIR"
if [ -d $DIR ]; then
for i in $DIR/*.war; do
file=$(basename $i)
echo "Linking $i --> ${JBOSS_DIR}/standalone/deployments/$file"
ln -s $i ${JBOSS_DIR}/standalone/deployments/$file
done
fi
# Use faster (though more unsecure) random number generator
export JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"
/opt/jboss/bin/standalone.sh -b 0.0.0.0
36 changes: 36 additions & 0 deletions jboss/7.0.2/tomcat-users.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user name="admin" password="admin" roles="admin-gui,admin-script,manager-gui,manager-status,manager-script,manager-jmx"/>
</tomcat-users>