Skip to content

Commit

Permalink
add gettting started with mdr
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rohit committed Oct 21, 2020
1 parent 4ff7650 commit e77a30b
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/source/getting-started/getting-started.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
Getting Started
===============
###############
.. toctree::
:maxdepth: 1
:hidden:

prerequisites
start-metadata-repository

Alright, you have read basic information of the IoTCrawler components and have brief idea about the overall architecture. Now, you want to run an
instance of IoTCrawler. Before, we get into the specifics of IoTCrawler components, it is advised to install all the :doc:`prerequisites` installed on your machine.

Once you have installed the prerequisites, you are ready to :doc:`start-metadata-repository`, which is one of the core components of the IoTCrawler.
15 changes: 15 additions & 0 deletions docs/source/getting-started/prerequisites.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Prerequisites
#############
Install the following tools before you star working with any tutorial of IoTCrawler.

Git
***
Download and install the latest version of `git <https://git-scm.com/downloads>`_.

cURL
****
Download and install the latest version of `cURL <https://curl.haxx.se/download.html>`_ tool.

Docker and Docker Compose
*************************
Download and install the latest version of `Docker <https://docs.docker.com/engine/install/>`_ and `Docker Compose <https://docs.docker.com/compose/install/>`_.
59 changes: 59 additions & 0 deletions docs/source/getting-started/start-metadata-repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Start MetaData Repository

Download the [Docker Compose](https://github.com/IoTCrawler/iotcrawler-samples/blob/master/getting-started/mdr/docker-compose-mdr.yml) file, go to the directory and run following command.

```
docker-compose up -f docker-compose-mdr.yml -d
```

This will start the docker containers for kafka, postgres, zookeeper and scorpio broker. Output of the command will be similar to following.

```
Creating network "mdr_default" with the default driver
Creating mdr_zookeeper_1 ... done
Creating mdr_postgres_1 ... done
Creating mdr_kafka_1 ... done
Creating mdr_scorpio_1 ... done
```

You can check the running containers with following command.

```
docker ps -a
```

If everything is running fine then you are ready to add your first entity. Use the following command.

```
curl -X POST 'http://localhost:9090/ngsi-ld/v1/entities/' --header 'Content-Type: application/ld+json' -d '{
"id": "house1:smartrooms:room1",
"type": "Room",
"temperature": {
"value": 21,
"unitCode": "CEL",
"type": "Property",
"providedBy": {
"type": "Relationship",
"object": "smartbuilding:house1:sensor001"
}
},
"isPartOf": {
"type": "Relationship",
"object": "smartcity:houses:house1"
},
"@context": [{"Room": "urn:mytypes:room", "temperature": "myuniqueuri:temperature", "isPartOf": "myuniqueuri:isPartOf"},"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"]
}'
```

You can get the entity back with following request.

```
curl http://localhost:9090/ngsi-ld/v1/entities/house1:smartrooms:room1
```

You can remove the containers and clean your environment when you are finished.

```
docker-compose -f docker-compose-mdr.yml down
```

0 comments on commit e77a30b

Please sign in to comment.