eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
429 stars 179 forks source link

eXist-db 4.0.0: Cannot reach repo, nor install xars anymore #1773

Closed ahenket closed 5 years ago

ahenket commented 6 years ago

I have eXist-db configured to look at our own repository, as I have in all previous versions:

/db/apps/dashboard/configuration.xml:

<settings>
    <!--<repository>http://demo.exist-db.org/exist/apps/public-repo</repository>-->
    <repository>http://decor.nictiz.nl/apps/public-repo-dev</repository>
</settings>

Problem 1: our own repo does not give me any packages anymore for eXist-db 4.0, while it still works for any version <= 4

Note: the default demo.exist-db.org link works, so it must be something in our own repo

Problem 2: when I manually upload a xar to the package manager I get:

Failed to unpack archive: If the name of an element in an element constructor is in no namespace, creating a default namespace for that element using a computed namespace constructor is an error. > Cannot output a namespace node for the default namespace when the element is in no namespace.

I'm sort of convinced these two issues interrelate, otherwise I would have filed them separately, but I don't know what to do here.

dizzzz commented 6 years ago

which version of the repo do you use locally? it there a difference with the exist-db.org one? Is there reverse proxy involved ? etc etc...

ahenket commented 6 years ago

The repo was setup using eXist-db 2.2 back in the day and has served us well over the years. We never migrated from eXist-db 2.2 LTS production servers because the stability of the new-range indexes kept failing. As-of eXist-db 4.0.0 we see an option to upgrade for the first time (although testing new-range indexes still yields puzzling results here and there). The main difference with the public eXist-db repo is probably that the public eXist-db repo evolved and we did not update.

The xars you can just download from http://decor.nictiz.nl/apps/public-repo-dev/index.html and try to install through upload on any of your test servers. Start with the ART package as all other packages depend on that one.

The failure to install that package as demonstrated under problem 2, is testable without our repo at play. -- please note that the ART installer creates users/groups/indexes and sets up a collection structure, so make sure you use a testing environment that you can throw away afterwards.

ahenket commented 6 years ago

Maybe this helps: the browser gives an http 404 on this path when open the package manager. I've updated our repo-server to use the current Package Repo 0.6.0, but no dice: worse, now our 2.2-LTS cannot see the repo anymore either.

http://decor.nictiz.nl/apps/dashboard/plugins/packageManager/packages/?format=manager&type=remote

HTTP ERROR 404
Problem accessing /apps/dashboard/plugins/packageManager/packages/. Reason:
    Document /db/apps/dashboard/plugins/packageManager/packages not found
ahenket commented 6 years ago

Found it: /db/apps/dashboard/plugins/packageManager/packages.xql line 124 uses

let $data := http:send-request($request)

This does not work properly on eXist-db 2.2-LTS and eXist-db 4.0.0. If I update the code to the former

let $data := httpclient:get($url, false(), ())

I'm good, obviously that requires updating line 125 and 144 too. So the function after updating is below. Mind you that the comment on EXPath not working was already there (?)

declare %private function packages:public-repo-contents($installed as element(app)*) {
    try {
        let $url := $config:REPO || "/public/apps.xml?version=" || packages:get-version() ||
            "&amp;source=" || util:system-property("product-source")
        (: EXPath client module does not work properly. No idea why. :)
        let $request :=
            <http:request method="get" href="{$url}" timeout="10">
                <http:header name="Cache-Control" value="no-cache"/>
            </http:request>
**124**        let $data := httpclient:get($url, false(), ())
**125**        let $status := xs:int($data[1]/@statusCode)
        return
            if ($status != 200) then
                response:set-status-code($status)
            else
                map(function($app as element(app)) {
                    (: Ignore apps which are already installed :)
                    if ($app/abbrev = $installed/abbrev) then
                        if (packages:is-newer($app/version/string(), $installed[abbrev = $app/abbrev]/version)) then
                            element { node-name($app) } {
                                attribute available { $app/version/string() },
                                attribute installed { $installed[abbrev = $app/abbrev]/version/string() },
                                $app/@*,
                                $app/*
                            }
                        else
                            ()
                    else
                        $app
**144**                }, $data/httpclient:body//app)
    } catch * {
        util:log("ERROR", "Error while retrieving app packages: " || $err:description)
    }
};
ahenket commented 6 years ago

Addition: on eXist-db 2.2 I reverted to Dashboard 0.4.5 to make it work from 0.4.10

ghost commented 5 years ago

This issue was moved by duncdrum to eXist-db/existdb-packageservice#6.