DataCater/datacater

Introduce an Info or `/` `Root` endpoint

HknLof opened this issue · 7 comments

Introduce an Endpoint, which returns information about the DataCater installation.

Including:

  • Version running
  • Python runner version
  • Pipeline version
  • Resource / Endpoints paths

As an inspiration checkout the GitHub API.

@HknLof @flippingbits @olis1996

Hey team,

i'm thinking about the information and format we should use for this endpoint and thought a mix of kubectl version and githubs root endpoint might be useful for datacater where we show version information and links to available resources and the associated documentation link.
Something along the lines of:

{
    "version": {
        "Major": "1",
        "Minor": "24",
        "GitVersion": "v1.24.3",
        "GitCommit": "aef86a93758dc3cb2c658dd9657ab4ad4afc21cb",
        "BuildDate": "2022-07-13T14:21:56Z",
        "Platform": "darwin/arm64"
    },
    "resources": {
        "streams": {
            "url": "localhost:3000/streams",
            "documentation-link": "https://docs.datacater.io/docs/api/streams"
        },
        "deployments": {
            "url": "localhost:3000/streams",
            "documentation-link": "https://docs.datacater.io/docs/api/deployments"
        },
        "pipelines": {
            "url": "localhost:3000/streams",
            "documentation-link": "https://docs.datacater.io/docs/api/pipelines"
        },
        "configs": {
            "url": "localhost:3000/streams",
            "documentation-link": "https://docs.datacater.io/docs/api/configs"
        }
    }
}

Any thoughts?

I like the documentation link idea. Does GitBook support versioning? If so,I would suggest attaching versions to the documentation-link.

@HknLof

Does GitBook support versioning? If so,I would suggest attaching versions to the documentation-link.

it seems to support versioning, I found some stuff from websites/blogs that have versioning with gitbook but I can't find anything official, only info about change history for contributors. There might be a plugin to extend versioning, but idk if that's done through the URL or handled inside gitbook. In any case, we don't have versioning support for our documentation at the moment.

@HknLof @flippingbits I just can't seem to get adding/updating environment variables during the build process to work correctly. I've tried adding a gradle task, updating it through jib and only using the -D flag.
As for now, i've implemented the endpoint to return the following payload:

{
  "version": {
    "version": "2023.2",
    "base-image": "datacater/datacater:2023.2",
    "pipeline-image": "datacater/pipeline:2023.2",
    "python-runner-image": "datacater/python-runner:2023.2"
  },
  "resources": {
    "streams": {
      "url": "http://localhost:8080/api/v1/streams",
      "documentation-url": "https://docs.datacater.io/docs/api/streams"
    },
    "deployments": {
      "url": "http://localhost:8080/api/v1/deployments",
      "documentation-url": "https://docs.datacater.io/docs/api/deployments"
    },
    "pipelines": {
      "url": "http://localhost:8080/api/v1/pipelines",
      "documentation-url": "https://docs.datacater.io/docs/api/pipelines"
    },
    "configs": {
      "url": "http://localhost:8080/api/v1/configs",
      "documentation-url": "https://docs.datacater.io/docs/api/configs"
    }
  },
  "contact": {
    "name": "DataCater API Support",
    "email": "info@datacater.io",
    "url": "https://datacater.io/contact"
  }
}

Have you executed the gradle build task with the following option? If so, can you paste the command here?

https://quarkus.io/guides/container-image#quarkus-container-image-jib_quarkus.jib.environment-variables-environment-variables

@HknLof

I tried it with:

  • ./gradlew :platform-api:build --info --no-daemon -x test -Dquarkus.jib.environment variables.datacater.application.builddate=today
  • ./gradlew :platform-api:build --info --no-daemon -x test -Dquarkus.jib.environment variables.builddate=today
  • ./gradlew :platform-api:build --info --no-daemon -x test -Dquarkus.jib.environment-variables=datacater.application.builddate=today
  • ./gradlew :platform-api:build --info --no-daemon -x test -Dquarkus.jib.environment-variables='{"datacater.application.builddate": "today"}'

My guess is, that the container is not being build with jib, but just to make sure, could stop your docker daemon and run again?

And for the syntax checkout the following answer on StackOverflow.

https://stackoverflow.com/questions/26275736/how-to-pass-a-mapstring-string-with-application-properties

If you want to purely test the functionality without running into potentially silent syntax errors, then enter the configuration into your application.yaml. If they are not picked up, then jib is not being used for building the image.

This is how we "ensure" jib is being used in CI.

https://github.com/DataCater/datacater/blob/main/.github/workflows/build-test.yaml#L126