nzilbb / labbcat-server

Server components for LaBB-CAT
GNU Affero General Public License v3.0
2 stars 0 forks source link

nzilbb.labbcat.server

LaBB-CAT is a linguistic annotation store server, implemented by the NZILBB.

The 'classic' legacy code is in the process of being deprecated and replaced by the code in this repository.

There currently three components here:

Servlets

Build targets

Documentation

More documentation is available here

User interface

The user interface is broken into three angular apps

Dependencies

  1. Node and npm
  2. Angular CLI npm install -g @angular/cli
  3. xmllint, head, and tail for collating i18n resources

Debugging / Development

  1. Ensure you have a local development instance of LaBB-CAT installed (e.g. at http://localhost:8080/labbcat)
  2. Ensure your local LaBB-CAT instance has user authentication disabled and the CORS filter enabled in ${config.local-labbcat-path}/WEB-INF/web.xml
  3. cd user-interface/src/main/angular
  4. ng serve

The default app is labbcat-admin. To serve the view/edit apps, use ng serve labbcat-view or ng serve labbcat-edit (respectively)

Internationalization/Localization

The user interface components are contain i18n attributes for resources that require translation to other languages. If changes are made, resource files can be generated for translation by executing the following shell script:

./i18n.sh

This generates localization resources for all three app projects, and merges them into a single file:
user-interface/src/main/angular/src/locale/messages.xlf

To localize to a new language/variety:

  1. Copy user-interface/src/main/angular/src/locale/messages.xlf with a new name formatted messages.{language-code}-{country-code}.xlf - e.g. messages.es-AR.xlf for Argentine Spanish.
  2. Edit the new file with an XLIFF editor.
  3. Add the new locale to the "locales" setting in user-interface/angular.json

Deployment into LaBB-CAT

To deploy a production version of the user interface into a local installation of LaBB-CAT, execute the following shell script:

./deploy-user-interface.sh

The shell script assumed the location of the local LaBB-CAT instance is:\ /var/lib/tomcat9/webapps/labbcat

You can specify a different location as a command-line parameter, e.g.:

./deploy-user-interface.sh /opt/tomcat/webapps/labbcat

Troubleshooting

If you get an error something like:

[INFO] An unhandled exception occurred: The service was stopped: spawn /home/robert/nzilbb/labbcat-server/user-interface/target/angular/node_modules/@esbuild/linux-x64/bin/esbuild EACCES ... [ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.1:npm (user-interface-view) on project nzilbb.labbcat.user-interface: Failed to run task: 'npm run build-labbcat-view' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127) -> [Help 1]

...it means that the esbuild command is not marked as executable on your system. To fix that:

chmod a+x user-interface/target/angular/node_modules/@esbuild/linux-x64/bin/esbuild

Wysiwiki

Requires Node and npm.

To build:

mvn package -pl :nzilbb.labbcat.wysiwiki

To deploy into LaBB-CAT:

cp wysiwiki/target/wysiwiki/* /var/lib/tomcat9/webapps/labbcat/wysiwiki/

Docker image

To build the docker image:

  1. copy the latest version of labbcat.war to be copied into the bin directory.
  2. docker build -t nzilbb/labbcat .

To release a new version of the docker image:

  1. Execute:
    docker push nzilbb/labbcat
  2. Tag the build with the version number:
    docker tag nzilbb/labbcat nzilbb/labbcat:unzip -qc bin/labbcat.war version.txt
  3. Execute:
    docker push nzilbb/labbcat:unzip -qc bin/labbcat.war version.txt

The image does not include a MySQL server, which can be supplied from the MySQL docker image:

docker run --name=labbcat-db \
 -e MYSQL_DATABASE=labbcat -e MYSQL_USER=labbcat \
 -e MYSQL_PASSWORD=secret \
 -d mysql/mysql-server:5.6 \
 --skip-log-bin --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
docker run -v /path/to/external/directory:/labbcat/files --name=labbcat --link labbcat-db -d -p 8888:8080 nzilbb/labbcat