Skip to content

Commit

Permalink
feat: use connector client in AssetService (eclipse-edc#52)
Browse files Browse the repository at this point in the history
* Rename data management to management

* Switch create asset endpoint to connector client

* chore: update asset service and models

* chore: use a neutral domain name for mocked values

* cleanup

* Update documentation

---------

Co-authored-by: OlfaBensoussia <[email protected]>
  • Loading branch information
ndr-brt and OlfaBensoussia authored Aug 29, 2023
1 parent 366f3b9 commit 550f6d0
Show file tree
Hide file tree
Showing 37 changed files with 1,162 additions and 507 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ Thumbs.db

.terraform*
.angular/
.gradle
build/
51 changes: 45 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Please note: This repository does not contain production-grade code and is only intended for demonstration purposes.**

EDC Data Dashboard is a dev frontend application for [EDC Data Management API](https://github.com/eclipse-dataspaceconnector/DataSpaceConnector).
EDC Data Dashboard is a dev frontend application for [EDC Management API](https://github.com/eclipse-edc/Connector).

## Documentation

Expand All @@ -15,17 +15,17 @@ Developer documentation can be found under [docs/developer](docs/developer/), wh
```shell
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -i /local/openapi/management-api.yaml -g typescript-angular -o /local/src/modules/edc-dmgmt-client/
```
This re-generates the service and model classes.
This re-generates the service and model classes.

> Please note that some of the client classes were edited manually after generation. When regenerating the classes for the API update be careful especially not to overwrite service `constructor` methods using the generator!
## Running the frontend locally
Should you want to run the frontend on your development machine, you'll have to configure some backend values. Those are stored in `app.config.json`, and
Should you want to run the frontend on your development machine, you'll have to configure some backend values. Those are stored in `app.config.json`, and
by default contain the following:

```json
{
"dataManagementApiUrl": "{{dataManagementApiUrl}}",
"managementApiUrl": "{{managementApiUrl}}",
"catalogUrl": "{{catalogUrl}}",
"storageAccount": "{{account}}",
"storageExplorerLinkTemplate": "storageexplorer://v=1&accountid=/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroup}}/providers/Microsoft.Storage/storageAccounts/{{account}}&subscriptionid={{subscriptionId}}&resourcetype=Azure.BlobContainer&resourcename={{container}}",
Expand All @@ -34,14 +34,53 @@ by default contain the following:
Substitute the values as necessary:
- `apiKey`: enter here what your EDC instance expects in th `x-api-key` header
- `catalogUrl`: prepend your connector URL, e.g. `http://localhost`, assuming your catalog endpoint is exposed at port 8181, which is the default
- `dataManagementApiUrl`: prepend your connector URL, e.g. `http://localhost`, assuming your IDS endpoint is exposed at port 9191
- `managementApiUrl`: prepend your connector URL, e.g. `http://localhost`, assuming your IDS endpoint is exposed at port 9191
- `storageAccount`: insert the name of an Azure Blob Storage account to which the connector has access, otherwise data transfers won't work.

**Be extra careful NOT to commit those changes, as they might leak potentially sensitive information!!!**

As some extra safety consider running `git udpate-index --assume-unchanged src/assets/config/app.config.json` before changing this file.

## Running a frondend and a connector locally
To test the correct functionality locally you can spin up a local docker compose
that will load the `data-dashboard` service and the `connector` one.
First you need to change the `app.config.json` this way:
```json
{
...
"managementApiUrl": "http://consumer-connector/management",
"catalogUrl": "http://consumer-connector/management",
...
}
```

Then you can start the docker compose:
```shell
docker compose up
```

The DataDashboard will be available at `http://localhost:8080`

### Running DataDashboard from the host machine
To have a quicker development cycle, you can also run the DataDashboard from the
host machine using `npm start`, sending request against the connector loaded by
docker compose.
First you need to change the `app.config.json` this way:
```json
{
...
"managementApiUrl": "http://localhost:4200/management",
"catalogUrl": "http://localhost:4200/management",
...
}
```

Then start the local DataDashboard:
```shell
npm start
```

The DataDashboard will be available at `http://localhost:4200`

## Deploy to Azure

Expand Down Expand Up @@ -72,7 +111,7 @@ export API_KEY=<API_KEY>
az container create --image ${ACR_NAME}.azurecr.io/edc-showcase/edc-data-dashboard:latest \
--resource-group $RESOURCE_GROUP \
--name edc-data-dashboard \
--secrets "app.config.json"="{\"dataManagementApiUrl\": \"$CONNECTOR_DATA_URL\", \"catalogUrl\": \"$CONNECTOR_CATALOG_URL\", \"storageAccount\": \"$STORAGE_ACCOUNT\", \"apiKey\": \"$API_KEY\"}" \
--secrets "app.config.json"="{\"managementApiUrl\": \"$CONNECTOR_DATA_URL\", \"catalogUrl\": \"$CONNECTOR_CATALOG_URL\", \"storageAccount\": \"$STORAGE_ACCOUNT\", \"apiKey\": \"$API_KEY\"}" \
--secrets-mount-path /usr/share/nginx/html/assets/config \
--dns-name-label edc-data-dashboard
```
Expand Down
11 changes: 11 additions & 0 deletions deployment/conf/consumer-connector.config/addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"uid": "1",
"name": "consumer.edc.connector.io",
"addresses": {
"default": "http://localhost:19191/api",
"management": "http://localhost:19193/management",
"protocol": "http://consumer-connector:9194/protocol",
"public": "http://localhost:19291/public",
"control": "http://localhost:19292/control"
}
}
42 changes: 42 additions & 0 deletions deployment/conf/consumer-connector.config/configuration.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
edc.participant.id=consumer
edc.dsp.callback.address=http://consumer-connector:9194/protocol

web.http.port=9191
web.http.path=/api

web.http.control.port=9192
web.http.control.path=/control

web.http.management.port=9193
web.http.management.path=/management

web.http.protocol.port=9194
web.http.protocol.path=/protocol

edc.api.control.auth.apikey.value=123456

edc.receiver.http.endpoint=http://host.docker.internal:19999

edc.public.key.alias=public-key

edc.transfer.dataplane.token.signer.privatekey.alias=1
edc.transfer.dataplane.sync.endpoint=http://consumer-connector:9291/public

edc.transfer.proxy.token.signer.privatekey.alias=sync-transfer
edc.transfer.proxy.token.verifier.publickey.alias=sync-transfer-public-key

web.http.public.port=9291
web.http.public.path=/public

edc.dataplane.token.validation.endpoint=http://consumer-connector:9192/control/token

edc.negotiation.consumer.send.retry.limit=1
edc.negotiation.consumer.send.retry.base-delay.ms=10
edc.negotiation.provider.send.retry.limit=1
edc.negotiation.provider.send.retry.base-delay.ms=10
edc.negotiation.state-machine.iteration-wait-millis=100
edc.transfer.send.retry.limit=1
edc.transfer.send.retry.base-delay.ms=10
edc.transfer.state-machine.iteration-wait-millis=10

edc.web.rest.cors.enabled=true
Binary file not shown.
2 changes: 2 additions & 0 deletions deployment/conf/consumer-connector.config/vault.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public-key=-----BEGIN CERTIFICATE-----\r\nMIIDazCCAlOgAwIBAgIUZ3/sZXYzW4PjmOXKrZn6WBmUJ+4wDQYJKoZIhvcNAQEL\r\nBQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM\r\nGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMjAyMjMxNTA2MDNaFw0zMjAy\r\nMjExNTA2MDNaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw\r\nHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB\r\nAQUAA4IBDwAwggEKAoIBAQDBl6XaJnXTL+6DWip3aBhU+MzmY4d1V9hbTm1tiZ3g\r\nE0VbUrvGO3LoYaxpPv6zFmsg3uJv6JxVAde7EddidN0ITHB9cQNdAfdUJ5njmsGS\r\nPbdQuOQTHw0aG7/QvTI/nsvfEE6e0lbV/0e7DHacZT/+OztBH1RwkG2ymM94Hf8H\r\nI6x7q6yfRTAZOqeOMrPCYTcluAgE9NskoPvjX5qASakBtXISKIsOU84N0/2HDN3W\r\nEGMXvoHUQu6vrij6BwiwxKaw1AKwWENKoga775bPXN3M+JTSaIKE7dZbKzvx0Zi0\r\nh5X+bxc3BJi3Z/CsUBCzE+Y0SFetOiYmyl/2YmnneYoVAgMBAAGjUzBRMB0GA1Ud\r\nDgQWBBTvK1wVERwjni4B2vdH7KtEJeVWFzAfBgNVHSMEGDAWgBTvK1wVERwjni4B\r\n2vdH7KtEJeVWFzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQBn\r\nQHiPA7OBYukHd9gS7c0HXE+fsWcS3GZeLqcHfQQnV3pte1vTmu9//IVW71wNCJ1/\r\nrySRyODPQoPehxEcyHwupNZSzXK//nPlTdSgjMfFxscvt1YndyQLQYCfyOJMixAe\r\nAqrb14GTFHUUrdor0PyElhkULjkOXUrSIsdBrfWrwLTkelE8NK3tb5ZG8KPzD9Jy\r\n+NwEPPr9d+iHkUkM7EFWw/cl56wka9ryBb97RI7DqbO6/j6OXHMk4GByxKv7DSIR\r\nIvF9/Dw20qytajtaHV0pluFcOBuFc0NfiDvCaQlbTsfjzbc6UmZWbOi9YOJl3VQ/\r\ng3h+15GuzbsSzOCOEYOT\r\n-----END CERTIFICATE-----
sync-transfer-public-key=-----BEGIN PUBLIC KEY-----\r\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArk7GSiuiNkUj/lrpWWn3\r\nqL57zh6n/bqQALsd+tgso2lM7ypgZhKIQclPpe0qw8ZCRBh8NfUfdzFwk3uJpsHT\r\nehEGXEzpWU3w07NmVMQ/rfC1mh6NbzsoXWlUC2fExYsJ8uaBNJCVy8pjpmJSbM/7\r\nF5/rrKjxsZrqQ3z9l/G2aLh9S8OV8mCwcRfVLNn2dfWStaFF48xAD4FR6MVCOwgm\r\nmUsBWyFcgKyoA3rfHM2k67zkGVPrsSK5AHlni/yxewOCuR5XGbqBSlHYTAUru4rH\r\n3+qJw7sc56I8xJn/CeHvqVH2MCSPzxrPx3iAfShR0BDZrbFflDnRyb9LiF3MZzy2\r\nbQIDAQAB\r\n-----END PUBLIC KEY-----
11 changes: 11 additions & 0 deletions deployment/conf/provider-connector.config/addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"uid": "2",
"name": "provider.edc.connector.io",
"addresses": {
"default": "http://localhost:29191/api",
"management": "http://localhost:29193/management",
"protocol": "http://provider-connector:9194/protocol",
"public": "http://localhost:29291/public",
"control": "http://localhost:29292/control"
}
}
40 changes: 40 additions & 0 deletions deployment/conf/provider-connector.config/configuration.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
edc.participant.id=provider
edc.dsp.callback.address=http://provider-connector:9194/protocol

web.http.port=9191
web.http.path=/api

web.http.control.port=9192
web.http.control.path=/control

web.http.management.port=9193
web.http.management.path=/management

web.http.protocol.port=9194
web.http.protocol.path=/protocol

edc.api.control.auth.apikey.value=123456

edc.receiver.http.endpoint=http://host.docker.internal:19999

edc.public.key.alias=public-key

edc.transfer.dataplane.token.signer.privatekey.alias=1
edc.transfer.dataplane.sync.endpoint=http://provider-connector:9192/public

edc.transfer.proxy.token.signer.privatekey.alias=sync-transfer
edc.transfer.proxy.token.verifier.publickey.alias=sync-transfer-public-key

web.http.public.port=9291
web.http.public.path=/public

edc.dataplane.token.validation.endpoint=http://provider-connector:9192/control/token

edc.negotiation.consumer.send.retry.limit=1
edc.negotiation.consumer.send.retry.base-delay.ms=10
edc.negotiation.provider.send.retry.limit=1
edc.negotiation.provider.send.retry.base-delay.ms=10
edc.negotiation.state-machine.iteration-wait-millis=100
edc.transfer.send.retry.limit=1
edc.transfer.send.retry.base-delay.ms=10
edc.transfer.state-machine.iteration-wait-millis=10
Binary file not shown.
2 changes: 2 additions & 0 deletions deployment/conf/provider-connector.config/vault.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public-key=-----BEGIN CERTIFICATE-----\r\nMIIDazCCAlOgAwIBAgIUZ3/sZXYzW4PjmOXKrZn6WBmUJ+4wDQYJKoZIhvcNAQEL\r\nBQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM\r\nGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMjAyMjMxNTA2MDNaFw0zMjAy\r\nMjExNTA2MDNaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw\r\nHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB\r\nAQUAA4IBDwAwggEKAoIBAQDBl6XaJnXTL+6D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mVMQ/rfC1mh6NbzsoXWlUC2fExYsJ8uaBNJCVy8pjpmJSbM/7\r\nF5/rrKjxsZrqQ3z9l/G2aLh9S8OV8mCwcRfVLNn2dfWStaFF48xAD4FR6MVCOwgm\r\nmUsBWyFcgKyoA3rfHM2k67zkGVPrsSK5AHlni/yxewOCuR5XGbqBSlHYTAUru4rH\r\n3+qJw7sc56I8xJn/CeHvqVH2MCSPzxrPx3iAfShR0BDZrbFflDnRyb9LiF3MZzy2\r\nbQIDAQAB\r\n-----END PUBLIC KEY-----
23 changes: 23 additions & 0 deletions deployment/connector/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM gradle:jdk17 AS build

COPY --chown=gradle:gradle . /home/gradle/project/
WORKDIR /home/gradle/project/
RUN gradle build --no-daemon

FROM openjdk:17-slim

WORKDIR /app
COPY --from=build /home/gradle/project/build/libs/connector.jar /app

ENV EDC_FS_CONFIG=$EDC_FS_CONFIG
ENV EDC_VAULT=$EDC_VAULT
ENV EDC_KEYSTORE=$EDC_KEYSTORE
ENV EDC_KEYSTORE_PASSWORD=$EDC_KEYSTORE_PASSWORD

EXPOSE 9191
EXPOSE 9192
EXPOSE 9193
EXPOSE 9194
EXPOSE 9291

ENTRYPOINT java -jar connector.jar
43 changes: 43 additions & 0 deletions deployment/connector/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
`java-library`
id("application")
alias(libs.plugins.shadow)
}

repositories {
mavenCentral()
}

dependencies {
implementation(libs.edc.runtime.metamodel)
implementation(libs.edc.control.plane.core)
implementation(libs.edc.dsp)
implementation(libs.edc.configuration.filesystem)
implementation(libs.edc.vault.filesystem)
implementation(libs.edc.iam.mock)
implementation(libs.edc.management.api)
implementation(libs.edc.api.observability)
implementation(libs.edc.transfer.data.plane)
implementation(libs.edc.transfer.pull.http.receiver)

implementation(libs.edc.data.plane.selector.api)
implementation(libs.edc.data.plane.selector.core)
implementation(libs.edc.data.plane.selector.client)

implementation(libs.edc.data.plane.api)
implementation(libs.edc.data.plane.core)
implementation(libs.edc.data.plane.http)

implementation(libs.edc.federated.catalog.core)
implementation(libs.edc.federated.catalog.api)
}

application {
mainClass.set("org.eclipse.edc.boot.system.runtime.BaseRuntime")
}

tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
dependsOn("distTar", "distZip")
mergeServiceFiles()
archiveFileName.set("connector.jar")
}
30 changes: 30 additions & 0 deletions deployment/connector/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[metadata]
format.version = "1.1"

[versions]
edc = "0.2.0"
shadow = "8.1.1"

[libraries]
edc-runtime-metamodel = { module = "org.eclipse.edc:runtime-metamodel", version.ref = "edc" }
edc-control-plane-core = { module = "org.eclipse.edc:control-plane-core", version.ref = "edc" }
edc-dsp = { module = "org.eclipse.edc:dsp", version.ref = "edc" }
edc-configuration-filesystem = { module = "org.eclipse.edc:configuration-filesystem", version.ref = "edc" }
edc-vault-filesystem = { module = "org.eclipse.edc:vault-filesystem", version.ref = "edc" }
edc-iam-mock = { module = "org.eclipse.edc:iam-mock", version.ref = "edc" }
edc-management-api = { module = "org.eclipse.edc:management-api", version.ref = "edc" }
edc-api-observability = { module = "org.eclipse.edc:api-observability", version.ref = "edc" }
edc-transfer-data-plane = { module = "org.eclipse.edc:transfer-data-plane", version.ref = "edc" }
edc-transfer-pull-http-receiver = { module = "org.eclipse.edc:transfer-pull-http-receiver", version.ref = "edc" }
edc-data-plane-selector-api = { module = "org.eclipse.edc:data-plane-selector-api", version.ref = "edc" }
edc-data-plane-selector-core = { module = "org.eclipse.edc:data-plane-selector-core", version.ref = "edc" }
edc-data-plane-selector-client = { module = "org.eclipse.edc:data-plane-selector-client", version.ref = "edc" }
edc-data-plane-api = { module = "org.eclipse.edc:data-plane-api", version.ref = "edc" }
edc-data-plane-core = { module = "org.eclipse.edc:data-plane-core", version.ref = "edc" }
edc-data-plane-http = { module = "org.eclipse.edc:data-plane-http", version.ref = "edc" }
edc-federated-catalog-core = { module = "org.eclipse.edc:federated-catalog-core", version.ref = "edc" }
edc-federated-catalog-api = { module = "org.eclipse.edc:federated-catalog-api", version.ref = "edc" }


[plugins]
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
Binary file not shown.
7 changes: 7 additions & 0 deletions deployment/connector/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 550f6d0

Please sign in to comment.