Yes, and my angular-frontend connects nicely, though a little slow, with the container.

 

Cheers,

Rob

 

Sent from Mail for Windows

 

From: Michael Seiferle
Sent: Friday, November 26, 2021 6:04 PM
To: Rob Stapper
Cc: basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] docker, creating and deploying the dba docker-image

 

Hi Rob, 

 

this answer contains two parts, but tldr: if you mount nothing to /srv/basex/webapp the DBA should already be present.

 

Now the slightly longer part:

 

But I’m confused what directories to mount on: ‘/srv/basex/repo’ and ‘/srv/basex/webapp’? 

I can’t find the docker-run example for this.

 

Can you shine some more light on the issue.

 

 

Inside the docker image, the home-folder is /srv/basex, hence:

 

The /srv/basex/repo Folder contains all XQuery modules that can be imported from your query files, using the BaseX module resolution.

 

From the documentation: 

            Points to the Repository, in which all XQuery modules are located.

https://docs.basex.org/wiki/Repository

 

The webapp folder on the other hand contains your RestXQ-annotated-XQuery  files, and is configured via the WEBPATH property:

 

WEBPATH
Signature         WEBPATH [path]
Default             {home}/webapp
Summary         Points to the directory in which all the Web Application contents are stored, including XQuery, Script, RESTXQ and configuration files

 

 

As the docker container is (more or less) the ZIP-File extracted to a specific location, it behaves very much like starting basexhttp from the commandline.

 

When you download the BaseX Zipfile, you run:

 bin/basexhttp 

Which in turn runs: java -cp ${all-basex-libraries-and-jarfiles}  org.basex.BaseXHTTP

 

The BaseXHTTP-process now looks for the given folders in the current home directory: 

 

- `data` => for databases

- `repo` => for XQuery modules

- `webapp` => for web applications

 


When it comes to docker, the home directory is /srv/basex, with the following layout:

 

/srv/basex/data => for databases

/srv/basex/repo => for XQuery modules

/srv/basex/webapp => for RestXQ-annotated stuff such as the dba

 

 

As the ZIP-File contains the DBA, all needed files should be already present, if you did not mount something else into /srv/basex/webapp.

 

If you want to add your own RestXQ endpoints for example, the safe way is to mount them into a subfolder of /srv/basex/webapp, for example: 

 

docker run -d \

    --name basexhttp \

    --publish 1984:1984 \

    --publish 8984:8984 \

    --volume "$HOME/basex/data":/srv/basex/data \

    --volume "$(pwd)/webapp/myapp":/srv/basex/webapp/myapp \

  basex/basexhttp:latest

 

That way the webapp folder in the docker container keeps the DBA and also has your files present.

 

 

If you plan to distribute your image I’d suggest building your own image with a Dockerfile. 

I created a minimal example here: https://git.basex.io/basex-org/basex-app-with-docker 

All I’ve done is: download BaseX.zip, extract BaseX.zip, add a Dockerfile to build the image.

 

 

 

Hope this helps  :-)

 

 

 

Michael

 

 



Am 26.11.2021 um 14:50 schrieb Rob Stapper <r.stapper@lijbrandt.nl>:

 

I’ve mounted ‘c:/Program Files (x86)/basex/data’ on ‘/srv/basex/data’ 

 

 

 

 


Virus-free. www.avast.com