ertis-research / opentwins

Innovative open-source platform that specializes in developing next-gen compositional digital twins
https://ertis-research.github.io/opentwins/
Apache License 2.0
153 stars 27 forks source link

Cant create type in Grafana #22

Open immicola opened 1 month ago

immicola commented 1 month ago

Hello, i tried to deploy opentwins, configured it, but then when i tried create type there was no button to create a type Screenshot_15-Oct_22-53-57_12632

medchedli commented 3 weeks ago

It seems that the Grafana OpenTwins App may not have been configured correctly. Ensure that you have entered the correct addresses for both the Ditto NGNIX instance and the Ditto Extended API instance. Additionally, check your browser's console for any error messages that could help identify the problem.

xxabdelxx commented 2 weeks ago

Hello. I have same problem but creating a type page has the button but not in the policies' page where nothing is showing. The error in the console is : url: 'http://IP_Extended_API/api/policies', bad request 400

accessing that url on browser gives a void message : { "message": {} }

I'm deploying using Minikube. Grafana, the extended API, the Ditto NGINX and Mosquitto are accessible from Internet as I'm deploying on cloud with openstack instance with a floating IP. Grafana OpenTwin plugin is well connected to the Ip addresses of both Ditto NGINX and Extended API. Running API queries such as IP_Ditto_NGINX/api/2/whoami works, inserting and finding a new policy through curl to IP_Ditto_NGINX/api/2/policies/id_policy works. However, in the installation files, it is expected that I find default:basic_policy if I query Ditto NGINX, but it seems it is not their ""error": "policies:policy.notfound",".

I was thinking it could be a problem with mongodb not connected, but as long as I insert and I can find a test policy then it is connected. What could make policies not loading ?

Thank you.

medchedli commented 2 weeks ago

@xxabdelxx you can try using the Eclipse Ditto API endpoint http://{{domain}}:{{ditto-ngnix-port}}/api/2/policies/ to insert a new default policy. This might help solve the problem with the policies not loading.

Here is an example of the policy :

{
    "imports": {},
    "entries": {
        "DEFAULT": {
            "subjects": {
                "pre-authenticated:kafkaml-connection": {
                    "type": "Connection to KafkaML"
                },
                "pre-authenticated:hono-connection": {
                    "type": "Connection to Eclipse Hono"
                },
                "nginx:ditto": {
                    "type": "Ditto user authenticated via nginx"
                }
            },
            "resources": {
                "policy:/": {
                    "grant": [
                        "READ",
                        "WRITE"
                    ],
                    "revoke": []
                },
                "thing:/": {
                    "grant": [
                        "READ",
                        "WRITE"
                    ],
                    "revoke": []
                },
                "message:/": {
                    "grant": [
                        "READ",
                        "WRITE"
                    ],
                    "revoke": []
                }
            },
            "importable": "implicit"
        }
    }
}