eXist-db / existdb-ansible-role

Ansible role for eXist-db
GNU Lesser General Public License v2.1
11 stars 10 forks source link

[BUG] xmlrpc based tasks not working on Ubuntu 20.04 with eXist-db 5.2.0 #35

Closed sermo-de-arboribus closed 3 years ago

sermo-de-arboribus commented 3 years ago

I am aware that the current status of this repo is in beta and that there has been no activity here for a while, so it might be abandoned. Nevertheless I'd like to report a failure of this Ansible role to install a given eXist-db setup, just in case it might be still of interest.

I've been trying to install eXist-db 5.2.0 on an Ubuntu 20.04 server, using the dev-1.0 branch of this repo. All post-installation tasks that try to send .xql scripts to the running database through the contrib/execute-xmlrpc.py or contrib/upload-xmlrpc.py are failing with an error like this:

ERROR <ProtocolError for admin:@localhost:8080/exist/xmlrpc: 503 Service Unavailable>

Here is my list of ansible variables that I use in my playbook:

# settings for existdb role
exist_home: /srv/rac/existdb
exist_instdescription: "eXist database instance for RAC application"
exist_java_home: "{{ java_home }}"
exist_http_host: "127.0.0.1" # this prevents the DB to be reachable from outside
exist_ssl_host: "127.0.0.1" # this prevents the DB to be reachable from outside
exist_install_method: none # remote_archive
exist_major_version: 5
exist_mem_init_heap: "{{ rac_app_mem_reservation }}"
exist_mem_max_heap: "{{ rac_app_mem_limit }}"
# archive and baseurl only apply if exist_install_method is set to "remote"
exist_baseurl: "https://github.com/eXist-db/exist/releases/download/eXist-5.2.0/"
exist_archive: "exist-distribution-5.2.0-unix.tar.bz2"
# repo vars only apply if exist_install_method is set to "source"
exist_repo: https://github.com/eXist-db/exist.git
exist_repo_version: eXist-5.2.0
exist_repo_update: yes
exist_repo_force: yes
exist_startup_timeout: 600
exist_adminpass:
  rac-staging.pagina-dh.de:
    exist: "{{ lookup('onepassword', 'RAC Demoserver', section='existdb admin') }}"
  production:
    exist: "{{ lookup('onepassword', 'RAC Demoserver', section='existdb admin') }}"
exist_userpass_map:
  rac-staging.pagina-dh.de:
    exist:
      "rac-admin": "{{ lookup('onepassword', 'RAC Demoserver', field='username rac-admin', section='existdb User') }}"
      "rac-reader": "{{ lookup('onepassword', 'RAC Demoserver', field='username rac-reader', section='existdb User') }}"

The database is up and running. When I am on the server's console I can get default responses for requests like curl localhost:8080 or curl 127.0.0.1:8080. When I try to reach the rpc endpoint manually, I get the same 503 HTTP error as through the ansible task scripts:

root@rac-staging:/srv/rac/existdb/exist/contrib# curl localhost:8080/exist/xmlrpc
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 503 Service Unavailable</title>
</head>
<body><h2>HTTP ERROR 503 Service Unavailable</h2>
<table>
<tr><th>URI:</th><td>/exist/xmlrpc</td></tr>
<tr><th>STATUS:</th><td>503</td></tr>
<tr><th>MESSAGE:</th><td>Service Unavailable</td></tr>
<tr><th>SERVLET:</th><td>-</td></tr>
</table>
<hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.26.v20200117</a><hr/>

</body>
</html>

Is there anything obvious that I could change in my setup to enable the xmlrpc service and let those post-installation scripts succeed?

Context (please always complete the following information):

chakl commented 3 years ago

Could you please check $EXIST/logs/xmlrpc.log or $EXIST/logs/exist.log if there is more info related to the error?

sermo-de-arboribus commented 3 years ago

$EXIST/logs/xmlrpc.log is empty. $EXIST/logs/exist.log reports exceptions concerning de.betterform.agent.web.resources.ResourceServlet several times, but does not mention xmlrpc explicitly anywhere.

So maybe this is not an issue with the Ansible role at all, but rather the eXist-5.2.0 package? I've attached a copy of my `exist.lg? here:

exist.log

chakl commented 3 years ago

Thanks. I don't see anything in your log (ignore the betterform exceptions). Please check whether XMLRPC is enabled in etc/webapp/WEB-INF/web.xml.

I will try to reproduce the error with 5.2 and Ubutu 20.04.

sermo-de-arboribus commented 3 years ago

The web.xml has:

<!--
        RpcServlet provides XML-RPC access.
    -->
    <servlet>
        <servlet-name>org.exist.xmlrpc.RpcServlet</servlet-name>
        <servlet-class>org.exist.xmlrpc.RpcServlet</servlet-class>
        <init-param>
            <param-name>enabledForExtensions</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <!--
            When no user is specified in an XML-RPC request,
            the guest user account will be used.

            When useDefaultUser is set to false, the guest user
            is prohibited from accessing the XML-RPC API.
            -->
            <param-name>useDefaultUser</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <!--
            The Apache XML-RPC servlet does not set a charset
            in the HTTP response, so the default HTTP charset
            of ISO-8859-1 is implied.

            We override that to make the default UTF-8 here.
            You may choose any charset supported by
            java.nio.charset.Charset
            -->
            <param-name>charset</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </servlet>
chakl commented 3 years ago

Hmm. Need to reproduce the problem locally.

One last quick suggestion: Try to set Ansible var exist_webxml_from_template: no, move the previous eXist installation aside, and re-run the Ansible installation.

sermo-de-arboribus commented 3 years ago

I can confirm that the execution of the xmlrpc scripts works for me with exist_webxml_from_template: no!

chakl commented 3 years ago

Great! Thanks for reporting, I just committed a bugfix to disable this by default. We will address this more thoroughly in the upcoming release.