Document Management System API
Clone or download

README.md

CWDS Document Management API

The CWDS DMS provides RESTful services for managing documents

Documentation

The development team uses Swagger for documenting the API.
NOTE: At this time there is not a publicly available link to the documentation, a link will be provided as soon as one is available.

DMS API Docker Configuration

Application Configuration Parameters

  • APP_VERSION -- Version of application
  • APP_STD_PORT -- Application port, default - 8080
  • APP_ADMIN_PORT -- Application Admin port, default - 8081
  • LOGLEVEL -- log level, default - WARN

Swagger Configuration Parameters**

Shiro Configuration Parameters

  • SHIRO_CONFIG_PATH -- path to Shiro configuration file

CMIS Configuration

  • CMIS_URL -- URL for CMIS Browser API, default - http://192.168.99.100:8091/nuxeo/json/cmis
  • CMIS_USER -- CMIS user name, default - Administrator
  • CMIS_PASSWORD -- CMIS user password, default - Administrator
  • CMIS_REPOSITORY -- CMIS repository name, default - "default"

Nuxeo Configuration

Configuration options are available in the file config/dms.yml.

In order to run Document Management API project we need to configure Nuxeo server.

1 Install Docker(follow https://docs.docker.com/engine/installation/) 2 Pull bare Nuxeo server image

docker pull nuxeo

3 Start a bare nuxeo instance

docker run --name nuxeo -p 8080:8080 -d nuxeo

4 The Nuxeo platform is accessible at http://${DOCKER_HOST}:8080/

5 Check that Docker port for Nuxeo is same as at yml configuration file and change if needed. (default port is 8081 because default post for the Dropwizard server is 8080)

6 Don't forget to set {SHOW_SWAGGER} variable to true(default - false) in order to be able to use swagger API calls.

7 Now you have simplest working configuration and can start using DMS with Nuxeo Server. The default Nuxeo configuration is applied which feature an embedded database (H2), and an embedded Elasticsearch instance. This setup is not suitable for production. See below to know how to setup a production ready container by specifying environment variables.

NUXEO_DB_TYPE : This defines the database type to use. By default it sets an H2 embedded database that is suitable for test purpose only. When specifying a DB type, other variable mays help : NUXEO_DB_HOST : If NUXEO_DB_TYPE is defined, this variable is mandatory and has to point to the DB server host. NUXEO_DB_NAME : name of the database to use (nuxeo by default) NUXEO_DB_USER : user to connect to the database (nuxeo by default) NUXEO_DB_PASSWORD : the password to connect to the database (nuxeo by default)

NUXEO_TEMPLATES : This variables allows to add additional Nuxeo configuration templates in the nuxeo.templates configuration variable. NUXEO_ES_HOSTS : This variables allows to setup an external Elasticsearch cluster. Use a comma separated list of Elasticsearch hosts with the 9300 port. Additional environment vars may be setup like : NUXEO_ES_CLUSTER_NAME : name of the Elasticsearch cluster to join NUXEO_ES_INDEX_NAME: name of the index (nuxeo by default) NUXEO_ES_REPLICAS : number or replicas (1 by default). If not 0, it means that your ES cluster must have enough node to fullfill the replicas setup. NUXEO_ES_SHARDS : number or shards (5 by default).

For instance : NUXEO_ES_HOSTS=es1:9300,es2:9300 NUXEO_ES_CLUSTER_NAME=dockerCluster NUXEO_ES_INDEX_NAME=nuxeo1 NUXEO_ES_REPLICAS=0 NUXEO_ES_SHARDS=5

NUXEO_CLID Allow to setup a CLID for Nuxeo Connect registration. This parameter is in the form part1\npart2, so depending on the environment you may have to escape the \ character.

if you need to register your Nuxeo instance, execute following command that is suitable for your case:

# You don't have a Nuxeo Online Service account
$ docker exec -ti nuxeo bin/nuxeoctl register-trial
# OR
# You already have a Nuxeo Online Service account
$ docker exec -ti nuxeo bin/nuxeoctl register

You can find additional information the registration process in the Nuxeo documentation

NUXEO_PACKAGES Allows to install Nuxeo packages at startup.

NUXEO_URL This variable sets the URL where your Nuxeo instance will be joinable. It's used for instance to refer to it when sending server's address in mails.

NUXEO_DATA Location of the Nuxeo data directory. (/var/lib/nuxeo/data by default).

NUXEO_LOG Location of the Nuxeo log directory. (/var/log/nuxeo by default)

NUXEO_AUTOMATION_TRACE If set to "true", this will enable the automation trace mode.

NUXEO_DEV_MODE If set to "true", this will enable the development mode that will allow hot reload when developing with Nuxeo Studio.

NUXEO_BINARY_STORE Tells the location of the binary store which configure the binary storage

NUXEO_TRANSIENT_STORE Tells the location of the transient storage

NUXEO_DDL_MODE Allows to setup Database creation option by fixing the ddlMode value.

To install nuxeo-web-ui package

     ./bin/nuxeoctl mp-install nuxeo-web-ui

To install nuxeo-jsf-ui

     ./bin/nuxeoctl mp-install nuxeo-jsf-ui

Development Environment

Prerequisites

  1. Source code
  2. Java SE 8 development kit

Environment variables of interest

  • APP_STD_PORT - default: 8080
  • APP_ADMIN_PORT - default: 8081
  • NUXEO_URL - URL of the Nuxeo server (default: http://localhost:8081/nuxeo)
  • PERRY_URL - default: http://localhost:8090/authn/login
  • SHOW_SWAGGER - set to true to have a link like http://localhost:8080/swagger (default: false)

Run DMS API

Use the gradlew command to execute the run task:

% ./gradlew :dms-api:run

This will run the server on your local machine, port 8080.

Unit Testing

Use the gradlew command to execute the test task:

% ./gradlew test

Integration Testing

Use the gradlew command to execute the test task:

% ./gradlew integrationTest

Commiting Changes

Before commit changes to the repository please run the following to ensure the build is successful.

% ./gradlew clean test integrationTest javadoc

Docker image: cwds/dms-api

docker pull cwds/dms-api

Running the DMS API in a docker container with given configuration

Prerequisite: Nuxeo CMS is up and open to this DMS API

docker run -d --name=dms1 -p 8080:8080 -p 8081:8081 --env-file <path-to-env-file>/dms-api.env cwds/dms-api

dms-api.env file should contain name=value pairs for environment variables that are used in config/dms.yml file.

Example of dms.env file:

NUXEO_URL=http://localhost:8085/nuxeo
SHOW_SWAGGER=true

After the container is started, check out URL-s like the following:

http://localhost:8081/healthcheck?pretty=true
http://localhost:8080/swagger#/documents

Building or publishing the docker image in a local TPT developer environment

$ export DOCKERHUB_ORG=<myDockerId>

or

> set DOCKERHUB_ORG=<myDockerId>

then

gradlew :docker-dms:dockerCreateImage - to create the image

or

gradlew :docker-dms:dockerDmsPublish - to publish the image

and

gradlew :docker-dms:dockerCleanUp - to remove the image from local docker environment.

Questions

If you have any questions regarding the contents of this repository, please email the Office of Systems Integration at FOSS@osi.ca.gov.