From 334c3555cd3bac359ec4403698c9c06b924dbdc2 Mon Sep 17 00:00:00 2001 From: Boris De Vloed Date: Wed, 26 May 2021 17:18:05 +0200 Subject: [PATCH 1/3] added kalliope api --- config/authorization/delta.ex | 5 +++++ config/delta/rules.js | 16 ++++++++++++++++ config/dispatcher/dispatcher.ex | 22 +++++++++++++++++++++- config/proxy/nginx.htpasswd | 3 ++- docker-compose.yml | 17 +++++++++++++++-- 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 config/authorization/delta.ex create mode 100644 config/delta/rules.js diff --git a/config/authorization/delta.ex b/config/authorization/delta.ex new file mode 100644 index 0000000..0c0e26c --- /dev/null +++ b/config/authorization/delta.ex @@ -0,0 +1,5 @@ +defmodule Delta.Config do + def targets do + [ "http://deltanotifier" ] + end +end \ No newline at end of file diff --git a/config/delta/rules.js b/config/delta/rules.js new file mode 100644 index 0000000..6b2fe67 --- /dev/null +++ b/config/delta/rules.js @@ -0,0 +1,16 @@ +export default [ + { + match: { + subject: { + } + }, + callback: { + url: "http://kalliope-api/delta", method: "POST" + }, + options: { + resourceFormat: "v0.0.1", + gracePeriod: 1000, + ignoreFromSelf: true + } + } + ] \ No newline at end of file diff --git a/config/dispatcher/dispatcher.ex b/config/dispatcher/dispatcher.ex index e3b1b50..f44e5f7 100644 --- a/config/dispatcher/dispatcher.ex +++ b/config/dispatcher/dispatcher.ex @@ -8,7 +8,7 @@ defmodule Dispatcher do any: [ "*/*" ], ] - define_layers [ :api, :frontend, :not_found ] + define_layers [ :api_services, :api, :frontend, :not_found ] ############################################################### # sparql endpoint @@ -17,6 +17,26 @@ defmodule Dispatcher do forward conn, path, "http://db:8890/sparql/" end + ############### + # API SERVICES + ############### + match "/v3/api-docs/*path", %{ layer: :api_services, accept: %{ json: true } } do + forward conn, path, "http://kalliope-api/v3/api-docs/" + end + + match "/delta/*path", %{ layer: :api_services, accept: %{ json: true } } do + forward conn, path, "http://kalliope-api/delta/" + end + + match "/changes/*path", %{ layer: :api_services, accept: %{ json: true } } do + forward conn, path, "http://kalliope-api/changes/" + end + + match "/consolidated/*path", %{ layer: :api_services, accept: %{ json: true } } do + forward conn, path, "http://kalliope-api/consolidated/" + end + + ############################################################### # ember metis ############################################################### diff --git a/config/proxy/nginx.htpasswd b/config/proxy/nginx.htpasswd index 850d460..5315068 100644 --- a/config/proxy/nginx.htpasswd +++ b/config/proxy/nginx.htpasswd @@ -1,2 +1,3 @@ root:$apr1$x9yMUyVV$w2FZk76C0mbKOlDHdLDV30 -contacthub:$apr1$X8vLzV8z$Xsb.0lLoyasxfvwxQGQUp/ \ No newline at end of file +contacthub:$apr1$X8vLzV8z$Xsb.0lLoyasxfvwxQGQUp/ +kalliope:$apr1$1HrKMwbi$Uqc18XpIohhrabnM49ete1 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1ec8738..e18e154 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: image: semtech/mu-identifier:1.9.1 environment: DEFAULT_ACCESS_CONTROL_ALLOW_ORIGIN_HEADER: "*" - DEFAULT_MU_AUTH_ALLOWED_GROUPS_HEADER: "[{\"variables\":[],\"name\":\"public\"}]" + DEFAULT_MU_AUTH_ALLOWED_GROUPS_HEADER: "[{\"variables\":[],\"name\":\"public\"}, {\"variables\":[],\"name\":\"clean\"}]" labels: - "logging=true" restart: always @@ -92,7 +92,20 @@ services: logging: *default-logging labels: - "logging=true" - + kalliope-api: + image: lblod/app-kalliope-api + volumes: + - ./config/kalliope:/config + - ./data/files:/share + environment: + SERVER_PORT: "80" + LOGGING_LEVEL: "INFO" + SPARQL_ENDPOINT: "http://db:8890/sparql" + restart: always + deltanotifier: + image: semtech/mu-delta-notifier:0.1.0 + volumes: + - ./config/delta:/config frontend: image: lblod/frontend-contact-hub labels: From ed683c7379e8552b11dea2142a44697e6d77bc9f Mon Sep 17 00:00:00 2001 From: Boris De Vloed Date: Thu, 27 May 2021 10:49:28 +0200 Subject: [PATCH 2/3] added bulk --- config/dispatcher/dispatcher.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/dispatcher/dispatcher.ex b/config/dispatcher/dispatcher.ex index f44e5f7..b5c8ac4 100644 --- a/config/dispatcher/dispatcher.ex +++ b/config/dispatcher/dispatcher.ex @@ -28,6 +28,10 @@ defmodule Dispatcher do forward conn, path, "http://kalliope-api/delta/" end + match "/bulk/*path", %{ layer: :api_services, accept: %{ json: true } } do + forward conn, path, "http://kalliope-api/bulk" + end + match "/changes/*path", %{ layer: :api_services, accept: %{ json: true } } do forward conn, path, "http://kalliope-api/changes/" end From b439e5dd3de2cfd6ccf553b95ebf6a4a83f77026 Mon Sep 17 00:00:00 2001 From: Boris De Vloed Date: Fri, 28 May 2021 14:41:14 +0200 Subject: [PATCH 3/3] updated docker image name --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e18e154..42e853c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -93,7 +93,7 @@ services: labels: - "logging=true" kalliope-api: - image: lblod/app-kalliope-api + image: lblod/jsonld-delta-service volumes: - ./config/kalliope:/config - ./data/files:/share