Mercurial > public > ssdt-docker
changeset 7:72f33ca6aa5b
add admin password and custom CATALINA_OPS
author | smith@nwoca.org |
---|---|
date | Mon, 14 Sep 2015 13:06:10 +0100 |
parents | 79c21c74fe03 |
children | 42ab2045d76c |
files | tomcat/Dockerfile tomcat/createTomcatAdmin.sh tomcat/setenv.sh |
diffstat | 3 files changed, 45 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/tomcat/Dockerfile Sun Sep 13 18:26:30 2015 -0400 +++ b/tomcat/Dockerfile Mon Sep 14 13:06:10 2015 +0100 @@ -2,8 +2,9 @@ MAINTAINER Dave Smith <smith@nwoca.org> -COPY setenv.sh /usr/local/tomcat/bin/setenv.sh +COPY setenv.sh /usr/local/tomcat/bin/ +COPY createTomcatAdmin.sh /usr/local/tomcat/bin/ -RUN chmod 755 /usr/local/tomcat/bin/setenv.sh +RUN chmod +x /usr/local/tomcat/bin/setenv.sh \ + /usr/local/tomcat/bin/createTomcatAdmin.sh -VOLUME /usr/local/tomcat/logs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tomcat/createTomcatAdmin.sh Mon Sep 14 13:06:10 2015 +0100 @@ -0,0 +1,27 @@ +if [ -f /.tomcat_admin_created ]; then + echo "Tomcat 'admin' user already created" + exit 0 +fi + +#generate password +PASS=$(TOMCAT_PASS: date | md5sum | head -c10) +_word=$( [ ${TOMCAT_PASS} ] && echo "preset" || echo "random" ) + +echo "=> Creating and admin user with a ${_word} password in Tomcat" +sed -i -r 's/<\/tomcat-users>//' ${CATALINA_HOME}/conf/tomcat-users.xml +echo '<role rolename="manager-gui"/>' >> ${CATALINA_HOME}/conf/tomcat-users.xml +echo '<role rolename="manager-script"/>' >> ${CATALINA_HOME}/conf/tomcat-users.xml +echo '<role rolename="manager-jmx"/>' >> ${CATALINA_HOME}/conf/tomcat-users.xml +echo '<role rolename="admin-gui"/>' >> ${CATALINA_HOME}/conf/tomcat-users.xml +echo '<role rolename="admin-script"/>' >> ${CATALINA_HOME}/conf/tomcat-users.xml +echo "<user username=\"admin\" password=\"${PASS}\" roles=\"manager-gui,manager-script,manager-jmx,admin-gui, admin-script\"/>" >> ${CATALINA_HOME}/conf/tomcat-users.xml +echo '</tomcat-users>' >> ${CATALINA_HOME}/conf/tomcat-users.xml +echo "=> Done!" +touch /.tomcat_admin_created + +echo "========================================================================" +echo "You can now configure to this Tomcat server using:" +echo "" +echo " admin:${PASS}" +echo "" +echo "========================================================================"
--- a/tomcat/setenv.sh Sun Sep 13 18:26:30 2015 -0400 +++ b/tomcat/setenv.sh Mon Sep 14 13:06:10 2015 +0100 @@ -1,23 +1,14 @@ -#! /bin/sh -echo "_______________________________________________" - -export CATALINA_OPTS="$CATALINA_OPTS -Xss256k" - -export CATALINA_OPTS="$CATALINA_OPTS -XX:+UseCompressedOops" - -export CATALINA_OPTS="$CATALINA_OPTS -Djava.security.egd=file:/dev/./urandom" - -echo "Using CATALINA_OPTS:" -for arg in $CATALINA_OPTS -do - echo ">> " $arg -done -echo "" - -echo "Using JAVA_OPTS:" -for arg in $JAVA_OPTS -do - echo ">> " $arg -done -echo "_______________________________________________" -echo "" \ No newline at end of file +#! /bin/sh +# +. "$CATALINA_HOME/bin/createTomcatAdmin.sh" +# +echo "__________________________________________" + +export CATALINA_OPTS="$CATALINA_OPTS -XX:+UseCompressedOops" + +export CATALINA_OPTS="$CATALINA_OPTS -Djava.security.egd=file:/dev/./urandom" + +echo "Using CATALINA_OPTS $CATALINA_OPTS" +echo "Using JAVA_OPTS $JAVA_OPTS" +echo "_________________________________________" +echo ""