teamatldocker / confluence

Dockerized Atlassian Confluence
https://hub.docker.com/r/teamatldocker/confluence/
MIT License
301 stars 147 forks source link

xmlstarlet breaks server.xml #22

Closed ckotte closed 7 years ago

ckotte commented 7 years ago

if I use proxy variables, the server.xml will be broken and Confluence fails with

10-Jul-2017 18:15:20.715 WARNING [main] org.apache.catalina.startup.Catalina.load Catalina.start using conf/server.xml: Error at (14, 19) : addChild: Child name '/confluence' is not unique

If I edit server.xml manually, everything is fine..!?

ckotte commented 7 years ago

server.xml will look like this (only proxyName added):

<?xml version="1.0"?> <Server port="8000" shutdown="SHUTDOWN" debug="0"

<Service name="Tomcat-Standalone"

<Connector port="8090" connectionTimeout="20000" redirectPort="8443" maxThreads="48" minSpareThreads="10" enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8" protocol="org.apache.coyote.http11.Http11NioProtocol" proxyName="host.mydomain.com" />

    <Engine
    name="Standalone"
    defaultHost="localhost"
    debug="0"
  >
ckotte commented 7 years ago

ok. it replaces also the context path for synchrony which is basically the major issue.

The file doesn't look so strange if you don't use -S or -P

blacklabelops commented 7 years ago

Can you please give a concrete example of your envs or even better the whole docker command?

ckotte commented 7 years ago

CONFLUENCE_CONTEXT_PATH=/confluence CONFLUENCE_PROXY_SCHEME=http CONFLUENCE_PROXY_PORT=80 CONFLUENCE_PROXY_NAME=host.mydomain.com

I set the envs manually and executed xmlstarlet with the same behaviour as docker run or docker-compose. part of docker-compose:

confluence: restart: always image: blacklabelops/confluence:6.2.3 build: context: ./confluence args:

ckotte commented 7 years ago

Hello @blacklabelops, could you please fix the xmlstarlet behavior? There are two context paths in server.xml and both will be set to i.e. /confluence, but the second context path for synchrony shouldn't be changed. Otherwise, Confluence doesn't start.

<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4">
   <Context path="/confluence" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
   <!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->
      <Manager pathname="" />
      <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60" />
   </Context>

   <Context path="${confluence.context.path}/synchrony-proxy" docBase="../synchrony-proxy" debug="0" reloadable="false" useHttpOnly="true">
      <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60" />
   </Context>
</Host>

Unfortunately, I don't have the necessary xmlstarlet skills to change and create a merge request..

blacklabelops commented 7 years ago

Of course.

blacklabelops commented 7 years ago

Fixed. Feel free to test.

ckotte commented 7 years ago

It works. Thank you very much!