From 308a9bbd1e0427c402b19c7bb9607b6cea875482 Mon Sep 17 00:00:00 2001 From: Emmanuel Sciara Date: Tue, 19 Sep 2017 02:50:28 +0200 Subject: [PATCH 1/3] fixes cptactionhank/docker-atlassian-confluence#38 & cptactionhank/docker-atlassian-confluence#55 --- Dockerfile | 74 +++++++++++-------- ...a_buildable_docker_image_shared_context.rb | 2 + 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 82093ed..8089d89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,55 +8,67 @@ ENV CONF_VERSION 6.3.4 ENV JAVA_CACERTS $JAVA_HOME/jre/lib/security/cacerts ENV CERTIFICATE $CONF_HOME/certificate -# Install Atlassian Confluence and hepler tools and setup initial home +ENV CONF_DOWNLOAD_URL http://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-${CONF_VERSION}.tar.gz + +ENV MYSQL_VERSION 5.1.38 +ENV MYSQL_DRIVER_DOWNLOAD_URL http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MYSQL_VERSION}.tar.gz + +# Use the default unprivileged account. This could be considered bad practice +# on systems where multiple processes end up being executed by 'daemon' but +# here we only ever run one process anyway. +ENV RUN_USER daemon +ENV RUN_GROUP daemon + +# Install Atlassian Confluence and helper tools and setup initial home # directory structure. RUN set -x \ && apt-get update --quiet \ && apt-get install --quiet --yes --no-install-recommends libtcnative-1 xmlstarlet \ && apt-get clean \ - && mkdir -p "${CONF_HOME}" \ - && chmod -R 700 "${CONF_HOME}" \ - && chown daemon:daemon "${CONF_HOME}" \ - && mkdir -p "${CONF_INSTALL}/conf" \ - && curl -Ls "https://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-${CONF_VERSION}.tar.gz" | tar -xz --directory "${CONF_INSTALL}" --strip-components=1 --no-same-owner \ - && curl -Ls "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.38.tar.gz" | tar -xz --directory "${CONF_INSTALL}/confluence/WEB-INF/lib" --strip-components=1 --no-same-owner "mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar" \ - && chmod -R 700 "${CONF_INSTALL}/conf" \ - && chmod -R 700 "${CONF_INSTALL}/temp" \ - && chmod -R 700 "${CONF_INSTALL}/logs" \ - && chmod -R 700 "${CONF_INSTALL}/work" \ - && chown -R daemon:daemon "${CONF_INSTALL}/conf" \ - && chown -R daemon:daemon "${CONF_INSTALL}/temp" \ - && chown -R daemon:daemon "${CONF_INSTALL}/logs" \ - && chown -R daemon:daemon "${CONF_INSTALL}/work" \ - && echo -e "\nconfluence.home=$CONF_HOME" >> "${CONF_INSTALL}/confluence/WEB-INF/classes/confluence-init.properties" \ - && xmlstarlet ed --inplace \ - --delete "Server/@debug" \ - --delete "Server/Service/Connector/@debug" \ - --delete "Server/Service/Connector/@useURIValidationHack" \ - --delete "Server/Service/Connector/@minProcessors" \ - --delete "Server/Service/Connector/@maxProcessors" \ - --delete "Server/Service/Engine/@debug" \ - --delete "Server/Service/Engine/Host/@debug" \ - --delete "Server/Service/Engine/Host/Context/@debug" \ - "${CONF_INSTALL}/conf/server.xml" \ - && touch -d "@0" "${CONF_INSTALL}/conf/server.xml" \ - && chown daemon:daemon "${JAVA_CACERTS}" + && mkdir -p "${CONF_HOME}" \ + && chmod -R 700 "${CONF_HOME}" \ + && chown ${RUN_USER}:${RUN_GROUP} "${CONF_HOME}" \ + && mkdir -p "${CONF_INSTALL}/conf" \ + && curl -Ls "${CONF_DOWNLOAD_URL}" | tar -xz --directory "${CONF_INSTALL}" --strip-components=1 --no-same-owner \ + && curl -Ls "${MYSQL_DRIVER_DOWNLOAD_URL}" | tar -xz --directory "${CONF_INSTALL}/confluence/WEB-INF/lib" --strip-components=1 --no-same-owner "mysql-connector-java-${MYSQL_VERSION}/mysql-connector-java-${MYSQL_VERSION}-bin.jar" \ + && chmod -R 700 "${CONF_INSTALL}/conf" \ + && chmod -R 700 "${CONF_INSTALL}/temp" \ + && chmod -R 700 "${CONF_INSTALL}/logs" \ + && chmod -R 700 "${CONF_INSTALL}/work" \ + && chown -R ${RUN_USER}:${RUN_GROUP} "${CONF_INSTALL}/conf" \ + && chown -R ${RUN_USER}:${RUN_GROUP} "${CONF_INSTALL}/temp" \ + && chown -R ${RUN_USER}:${RUN_GROUP} "${CONF_INSTALL}/logs" \ + && chown -R ${RUN_USER}:${RUN_GROUP} "${CONF_INSTALL}/work" \ + && echo -e "\nconfluence.home=${CONF_HOME}" >> "${CONF_INSTALL}/confluence/WEB-INF/classes/confluence-init.properties" \ + && xmlstarlet ed --inplace \ + --delete "Server/@debug" \ + --delete "Server/Service/Connector/@debug" \ + --delete "Server/Service/Connector/@useURIValidationHack" \ + --delete "Server/Service/Connector/@minProcessors" \ + --delete "Server/Service/Connector/@maxProcessors" \ + --delete "Server/Service/Engine/@debug" \ + --delete "Server/Service/Engine/Host/@debug" \ + --delete "Server/Service/Engine/Host/Context/@debug" \ + "${CONF_INSTALL}/conf/server.xml" \ + && touch -d "@0" "${CONF_INSTALL}/conf/server.xml" \ + && chown ${RUN_USER}:${RUN_GROUP} "${JAVA_CACERTS}" # Use the default unprivileged account. This could be considered bad practice # on systems where multiple processes end up being executed by 'daemon' but # here we only ever run one process anyway. -USER daemon:daemon +USER ${RUN_USER}:${RUN_GROUP} # Expose default HTTP connector port. EXPOSE 8090 +EXPOSE 8091 # Set volume mount points for installation and home directory. Changes to the # home directory needs to be persisted as well as parts of the installation # directory due to eg. logs. -VOLUME ["/var/atlassian/confluence", "/opt/atlassian/confluence/logs"] +VOLUME ["${CONF_INSTALL}", "${CONF_HOME}/logs"] # Set the default working directory as the Confluence home directory. -WORKDIR /var/atlassian/confluence +WORKDIR ${CONF_HOME} COPY docker-entrypoint.sh / ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/spec/support/shared_examples/a_buildable_docker_image_shared_context.rb b/spec/support/shared_examples/a_buildable_docker_image_shared_context.rb index 5bc7d44..866c658 100644 --- a/spec/support/shared_examples/a_buildable_docker_image_shared_context.rb +++ b/spec/support/shared_examples/a_buildable_docker_image_shared_context.rb @@ -14,6 +14,8 @@ it { is_expected.to be_running } it { is_expected.to have_mapped_ports tcp: 8090 } it { is_expected.not_to have_mapped_ports udp: 8090 } + it { is_expected.to have_mapped_ports tcp: 8091 } + it { is_expected.not_to have_mapped_ports udp: 8091 } it { is_expected.to wait_until_output_matches REGEX_STARTUP } end From 90acaa9293454cc989f1f90ba868db140e0038c0 Mon Sep 17 00:00:00 2001 From: Emmanuel Sciara Date: Tue, 19 Sep 2017 17:10:05 +0200 Subject: [PATCH 2/3] added test on synchrony port 8091 --- spec/acceptance/000_docker_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/acceptance/000_docker_spec.rb b/spec/acceptance/000_docker_spec.rb index a48295e..2a66686 100644 --- a/spec/acceptance/000_docker_spec.rb +++ b/spec/acceptance/000_docker_spec.rb @@ -11,6 +11,8 @@ it { is_expected.to_not be_nil } it { is_expected.to have_exposed_port tcp: 8090 } it { is_expected.to_not have_exposed_port udp: 8090 } + it { is_expected.to have_exposed_port tcp: 8091 } + it { is_expected.to_not have_exposed_port udp: 8091 } it { is_expected.to have_volume '/var/atlassian/confluence' } it { is_expected.to have_volume '/opt/atlassian/confluence/logs' } it { is_expected.to have_working_directory '/var/atlassian/confluence' } From 0f9e022724599264fa78f82b8013d6b19461b8f8 Mon Sep 17 00:00:00 2001 From: Emmanuel Sciara Date: Tue, 19 Sep 2017 18:28:40 +0200 Subject: [PATCH 3/3] updated readme with port 8091 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23582a8..a876475 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you want to help out, you can check out the contribution section further down To quickly get started running a Confluence instance, use the following command: ```bash -docker run --detach --publish 8090:8090 cptactionhank/atlassian-confluence:latest +docker run --detach --publish 8090:8090 --publish 8091:8091 cptactionhank/atlassian-confluence:latest ``` Then simply navigate your preferred browser to `http://[dockerhost]:8090` and finish the configuration.