Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Latest commit

 

History

History

trellis-rosid-app

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Trellis Application

A deployable Trellis application using a file-based persistence layer and an internal Kafka-based event bus.

Requirements

The location of Kafka and Zookeeper will be defined in the ./etc/config.yml file.

Running Trellis

Unpack a zip or tar distribution. In that directory, modify ./etc/config.yml to match the desired values for your system.

To run trellis directly from within a console, issue this command:

$ ./bin/trellis-rosid-app server ./etc/config.yml

Note: When running trellis, please be sure to also have an active asynchronous processor.

Installation

To install Trellis as a systemd service on linux, follow the steps below. systemd is used by linux distributions such as CentOS/RHEL 7+ and Ubuntu 15+.

  1. Move the unpacked Trellis directory to a location such as /opt/trellis. If you choose a different location, please update the ./etc/trellis.service script.

  2. Edit the ./etc/environment file as desired (optional).

  3. Edit the ./etc/config.yml file as desired (optional).

  4. Create a trellis user:

$ sudo useradd -r trellis -s /sbin/nologin
  1. Create data directories. A different location can be used, but then please update the ./etc/config.yml file.
$ sudo mkdir /var/lib/trellis
$ sudo chown trellis.trellis /var/lib/trellis
  1. Install the systemd file:
$ sudo ln -s /opt/trellis/etc/trellis.service /etc/systemd/system/trellis.service
  1. Reload systemd to see the changes
$ sudo systemctl daemon-reload
  1. Start the trellis service
$ sudo systemctl start trellis

To check that trellis is running, check the URL: http://localhost:8080

Application health checks are available at http://localhost:8081/healthcheck

Building Trellis

  1. Run ./gradlew clean install to build the application or download one of the releases.
  2. Unpack the appropriate distribution in ./build/distributions
  3. Start the application according to the steps above

Configuration

The web application wrapper (Dropwizard.io) makes many configuration options available. Any of the configuration options defined by Dropwizard can be part of your application's configuration file.

Trellis defines its own configuration options, including:

binaries:
  path: /path/to/binaries
Name Default Description
path (none) The path for storing binaries
resources:
  path: /path/to/resources
Name Default Description
path (none) The path for storing resources
baseUrl: http://localhost:8080/
Name Default Description
baseUrl (none) A defined baseUrl for resources in this partition. If not defined, the Host request header will be used
namespaces:
    file: /path/to/namespaces.json
Name Default Description
file (none) The path to a JSON file defining namespace prefixes
zookeeper:
    ensembleServers: localhost:2181
Name Default Description
ensembleServers (none) The location of the zookeeper ensemble servers (comma separated)
kafka:
    bootstrapServers: localhost:9092
Name Default Description
bootstrapServers (none) The location of the kafka servers (comma separated)
auth:
    webac:
        enabled: true
    anon:
        enabled: true
    jwt:
        enabled: true
        base64Encoded: false
        key: secret
    basic:
        enabled: true
        usersFile: /path/to/users.auth
Name Default Description
webac / enabled true Whether WebAC authorization is enabled
anon / enabled false Whether anonymous authentication is enabled
jwt / enabled true Whether jwt authentication is enabled
jwt / base64Encoded false Whether the key is base64 encoded
jwt / key (none) The signing key for JWT tokens
basic / enabled true Whether basic authentication is enabled
basic / usersFile (none) The path to a file where user credentials are stored
cors:
    enabled: true
    allowOrigin:
        - "*"
    allowMethods:
        - "GET"
        - "POST"
        - "PATCH"
    allowHeaders:
        - "Content-Type"
        - "Link"
    exposeHeaders:
        - "Link"
        - "Location"
    maxAge: 180
    allowCredentials: true
Name Default Description
enabled false Whether CORS is enabled
allowOrigin "*" A list of allowed origins
allowMethods "PUT", "DELETE", "PATCH", "GET", "HEAD", "OPTIONS", "POST" A list of allowed methods
allowHeaders "Content-Type", "Link", "Accept", "Accept-Datetime", "Prefer", "Want-Digest", "Slug", "Digest" A list of allowed request headers
exposeHeaders "Content-Type", "Link", "Memento-Datetime", "Preference-Applied", "Location", "Accept-Patch", "Accept-Post", "Digest", "Accept-Ranges", "ETag", "Vary" A list of allowed response headers
maxAge 180 The maximum age (in seconds) of pre-flight messages
allowCredentials true Whether the actual request can be made with credentials
async: false
Name Default Description
async false Set this to true if resource caches should be generated by an async processor; otherwise they will be generated synchronously. Note: setting this to true will make write operations faster for clients, but the availability of the updated content will appear to lag (because it is generated asynchronously).
cacheMaxAge: 86400
Name Default Description
cacheMaxAge 86400 The value of the Cache-Control: max-age= response header
jsonLdWhitelist:
    - "http://example.com/context.json"
Name Default Description
jsonLdWhitelist an empty list a user-supplied whitelist of valid JSON-LD profile values
jsonLdDomainWhitelist:
    - "http://example.com/"
Name Default Description
jsonLdDomainWhitelist an empty list a user-supplied whitelist of domains for valid JSON-LD profile values
jsonLdCacheExpireHours: 24
Name Default Description
jsonLdCacheExpireHours 24 The number of hours that a JSON-LD profile value will be stored in a cache.
jsonLdCacheSize: 100
Name Default Description
jsonLdCacheSize 100 The number of entries stored in the JSON-LD profile cache.

HTTP/2

Trellis supports the HTTP/2 protocol. For more information about how to enable HTTP/2 with Trellis, please refer to the dropwizard documentation. In particular, an h2 connector type must be used, typically with a corresponding TLS configuration.

Metrics reporting

Application metrics can be configured by defining a frequency and a reporter. For more information about configuring these reports, please refer to the dropwizard metrics configuration reference.