lblod / jsonld-delta-service

Kalliope API
MIT License
1 stars 0 forks source link

JSON-LD Delta Service

Provides a JSON-LD representation of the consolidated delta-notifier messages. The services is based on the mu-javascript-template.

Configuration

Add JSON-LD Delta Service to the stack

The following assumes a semantic works application stack

Include the service in docker-compose.yml.

  jsonld-delta-service:
    image: lblod/jsonld-delta-service:1.0.0
    volumes:
      - ./data/files:/share
      - ./config/kalliope:/config
    environment:
      SECURITY_CONFIG_PATH: "/config/security.json"
      DUMP_SUBJECT: "http://data.lblod.info/datasets/delta-producer/dumps/OrganizationsCacheGraphDump"
    links:
      - db:database

Configure the dispatcher

Add the jsonld-delta-service routes to the dispatcher configuration. e.g.:

match "/consolidated/*path", %{ layer: :api_services, accept: %{ json: true } } do
  forward conn, path, "http://jsonld-delta-service/consolidated/"
end

Add security config

1. Create the Configuration File:

{
  "enabled": true,
  "allowedIpAddresses": [
    "127.0.0.1",
    "172.18.0.0/16"
  ],
  "authSource": "/config/source.json",
  "authOutput": "/config/output.json"
}

2. Initialize Credentials (First-time Setup):

Example of /config/kalliope/source.json:

[
  {
    "username": "boris",
    "password": "5678"
  },
  {
    "username": "nordine",
    "password": "1234"
  }
]

Boot up the system

Boot your microservices-enabled system using docker-compose.

cd /path/to/mu-project
docker-compose up

You can shut down using docker-compose stop and remove everything using docker-compose rm.

Usage

/consolidated

The JSON-LD response contains:

   ...
],
"@id": "http://mu.semte.ch/graphs/kalliope/consolidated",
"date": "2021-05-27T09:26:03.351256816Z",
  "@context": {
    "date": {
      "@id": "http://purl.org/dc/terms/date",
      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
    }
  }
}