diff --git a/Dockerfile b/Dockerfile index 6a35d4d29e1c82e995d00f360ca5d90cad103620..1295e1f3b49d47963db593ffc4371af1aed04cff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,8 +30,10 @@ RUN \ # Import self-signed cert as trusted CA RUN \ - openssl s_client -servername cert.codemate.se -connect codemate.se:443 </dev/null | sed -ne '/--BEGIN CERTIFICATE--/,/--END CERTIFICATE--/p' > /tmp/codemate.cert && \ - keytool -import -noprompt -trustcacerts -keystore /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts -storepass changeit -noprompt -alias codemate-self-signed -file /tmp/codemate.cert + mkdir -p /usr/share/ca-certificates/extra && \ + openssl s_client -servername cert.codemate.se -connect codemate.se:443 </dev/null | sed -ne '/--BEGIN CERTIFICATE--/,/--END CERTIFICATE--/p' > /usr/share/ca-certificates/extra/codemate.crt && \ + update-ca-certificates && \ + keytool -import -noprompt -trustcacerts -keystore /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts -storepass changeit -noprompt -alias codemate-self-signed -file /usr/share/ca-certificates/extra/codemate.crt # Install and configure Exim RUN \ diff --git a/README.md b/README.md index 5d2c76a52453ddede7bab8ac1258ff7be919eef4..2618d573906d10a0c86e7c32f44d0d2332c21fa0 100644 --- a/README.md +++ b/README.md @@ -54,13 +54,20 @@ docker run -e CROWD_VERSION=2.7.2 -d registry.codemate.se/crowd ### Overriding Crowd files -By providing an environment variable name `CROWD_OVERLAY` that points to a gzipped tar file you can apply an overlay on the Crowd installation. This tarball will be unzipped and extracted in the root of the Crowd installation directory. The overlay enables you to add custom crowd configurations such as SSL or Crowd integration. +By providing an environment variable name `CROWD_OVERLAY` that points to a directory or URL of a gzipped tar file you can apply an overlay on the Crowd installation. A directory will be recursively copied, and a tarball will be unzipped and extracted in the root of the Crowd installation directory. The overlay enables you to add custom Crowd configurations. ``` docker run -e CROWD_OVERLAY=http://10.0.0.1/crowd-config.tgz -d registry.codemate.se/crowd +docker run -e CROWD_OVERLAY=/tmp/crowd-config -d registry.codemate.se/crowd ``` -The overlay is fetched using curl so if you need to provide basic auth credentials simply prefix the url with the credentials, for example: +The overlay is fetched using curl so file URLs are valid: + +``` +CROWD_OVERLAY="file:///tmp/crowd-config.tgz" +``` + +If you need to provide basic auth credentials simply prefix the url with the credentials, for example: ``` CROWD_OVERLAY="-u username:password http://10.0.0.1/crowd-config.tgz" @@ -74,7 +81,7 @@ By providing an environment variable name `MYSQL_INIT` that points to an SQL scr docker run -e MYSQL_INIT=http://10.0.0.1/crowd-init.sql -d registry.codemate.se/crowd ``` -Basic auth credentials can be used as mentioned in the Crowd overlay section. +Basic auth credentials and file URLs can be used as mentioned in the overlay section. ### Combined options @@ -88,7 +95,6 @@ docker run \ -e CROWD_OVERLAY=http://10.0.0.1/crowd-config.tgz \ -v /opt/application-data/crowd:/home/crowd \ -p 8095:8095 \ - -p 8096:8096 \ -d registry.codemate.se/crowd ``` diff --git a/init.sh b/init.sh index 9a529862b2cde25b4e76e2066709fdb5e019b724..e6b0efc8f0605ae30065663dd6787b4921b583de 100644 --- a/init.sh +++ b/init.sh @@ -2,20 +2,19 @@ set -e # Exit on errors -SEPARATOR="-------------------------------------------------------------------------------" CROWD_DIR=/opt/atlassian-crowd-$CROWD_VERSION MYSQL_DIR=$CROWD_HOME/mysql-data if [ ! -d $CROWD_DIR ]; then curl -s -v -L http://www.atlassian.com/software/crowd/downloads/binary/atlassian-crowd-$CROWD_VERSION.tar.gz | tar xzf - -C /opt - curl -s -v -L -o $CROWD_DIR/apache-tomcat/lib/mysql-connector-java-5.1.31.jar http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.31/mysql-connector-java-5.1.31.jar - echo "$SEPARATOR" - echo "crowd.home=$CROWD_HOME" > $CROWD_DIR/crowd-webapp/WEB-INF/classes/crowd-init.properties fi if [ ${CROWD_OVERLAY:+x} ] && [ -d $CROWD_DIR ]; then - curl -s -v -L $CROWD_OVERLAY | tar xzf - -C $CROWD_DIR - echo "$SEPARATOR" + if [ -d $CROWD_OVERLAY ]; then + cp -R $CROWD_OVERLAY/* $CROWD_DIR + else + curl -s -v -L $CROWD_OVERLAY | tar xzf - -C $CROWD_DIR + fi fi chown -R root:root $CROWD_DIR @@ -31,7 +30,6 @@ if [ ! -d $MYSQL_DIR ]; then mysql_install_db mysqld_safe & sleep 5s - echo "$SEPARATOR" else mysqld_safe & sleep 5s @@ -39,11 +37,9 @@ fi if [ ${MYSQL_INIT:+x} ] && [ -d $MYSQL_DIR ]; then curl -s -v -L $MYSQL_INIT | mysql - echo "$SEPARATOR" fi env | sort -echo "$SEPARATOR" exim4 -v -bdf -q15m &