Commit b8ee85d9 authored by Fernando Ferreira de Lima Filho's avatar Fernando Ferreira de Lima Filho
Browse files

initial setup

parent 0c0455d2
# Project name
COMPOSE_PROJECT_NAME=fiware
# Orion variables
ORION_PORT=1026
ORION_VERSION=3.5.1
# MongoDB variables
MONGO_DB_PORT=27017
MONGO_DB_VERSION=4.4
\ No newline at end of file
name: "CI"
on:
push:
branches:
- master
- NGSI-v2
- NGSI-LD
pull_request:
branches:
- master
- NGSI-v2
- NGSI-LD
workflow_dispatch:
jobs:
test-modules:
name: Test Script
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@master
with:
persist-credentials: false
fetch-depth: 0
submodules: recursive
- name: Install Latest Docker
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
- name: Build Images
run: |
./services create || true
- name: Run Script
run: |
./services start test && ./services stop test
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="hole-street-x" target="11" />
<module name="tutorials.Getting-Started" target="1.5" />
</bytecodeTargetLevel>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="hole-street-x" options="-parameters" />
</option>
</component>
</project>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/hole-street-x/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/hole-street-x/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
<option name="ignoredFiles">
<set>
<option value="$PROJECT_DIR$/hole-street-x/pom.xml" />
</set>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/tutorials.Getting-Started.iml" filepath="$PROJECT_DIR$/.idea/tutorials.Getting-Started.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/vue-skeleton-mvp" vcs="Git" />
</component>
</project>
\ No newline at end of file
{
"info": {
"_postman_id": "dd7b3ba8-5aa3-405a-b054-47608a483f77",
"name": "FIWARE Getting Started",
"description": "Let’s start with the data from a supermarket chain’s store finder and create a very simple *“Powered by FIWARE”* application by passing in the address and location of each store as context data to the FIWARE context broker.\n\nThe `docker-compose` file for this tutorial can be found on GitHub: \n\n![GitHub](https://fiware.github.io/tutorials.Getting-Started/icon/GitHub-Mark-32px.png) [FIWARE 101: An Introduction to the FIWARE Platform](https://github.com/Fiware/tutorials.Getting-Started)\n\n# Architecture\n\nOur demo application will only make use of one FIWARE component - the [Orion Context Broker](https://catalogue.fiware.org/enablers/publishsubscribe-context-broker-orion-context-broker) . Usage of the Orion Context Broker is sufficient for an application to qualify as *“Powered by FIWARE”*.\n\nCurrently, the Orion Context Broker relies on open source [MongoDB](https://www.mongodb.com/) technology to keep persistence of the context data it holds. Therefore, the architecture will consist of two elements:\n\n* The Orion Context Broker server which will receive requests using NGSI\n* The underlying MongoDB database associated to the Orion Context Broker server\n\nSince all interactions between the two elements are initiated by HTTP requests, the entities can be containerized and run from exposed ports. \n\n![](https://fiware.github.io/tutorials.Getting-Started/img//architecture.png)\n\n# Prerequisites\n\n## Docker\n\nTo keep things simple both components will be run using [Docker](https://www.docker.com). **Docker** is a container technology which allows to different components isolated into their respective environments. \n\n* To install Docker on Windows follow the instructions [here](https://docs.docker.com/docker-for-windows/)\n* To install Docker on Mac follow the instructions [here](https://docs.docker.com/docker-for-mac/)\n* To install Docker on Linux follow the instructions [here](https://docs.docker.com/install/)\n\n\n\n# Starting the Containers\n\n## Initialization\n\nFirst pull the necessary Docker images from Docker Hub and create a network for our containers to connect to:\n\n```console \ndocker pull mongo:3.6\ndocker pull fiware/orion\ndocker network create fiware_default\n```\n\n## Start Up\n\nA Docker container running a MongoDB database can be started and connected to the network with the following command:\n\n```console\ndocker run -d --name=context-db --network=fiware_default \\\n --expose=27017 mongo:3.6 --bind_ip_all --smallfiles\n``` \n\nThe Orion Context Broker can be started and connected to the network with the following command:\n\n```console\ndocker run -d --name orion --network=fiware_default \\\n -p 1026:1026 fiware/orion -dbhost context-db\n``` \n\nYou can check if the Orion Context Broker is running by making an HTTP request to the exposed port:\n\n```console\ncurl -X GET http://localhost:1026/version\n```\n\nAlternatively run all your curl commands from within the container network:\n\n```console\ndocker run --network fiware_default --rm appropriate/curl -s \\\n -X GET http://orion:1026/version\n```\n\n**What if I get an error response?**\n\nIf you get an error response, the Orion Content Broker cannot be found where expected\nfor this tutorial - you will need to substitute the URL and port in each Postman request \nwith the corrected ip address. All the Postman requests in this tutorial assume \nthat orion is available on `localhost:1026`. \n \nTry the following remedies:\n\n* To check that the dockers container are running try the following:\n\n```console\ndocker ps\n```\n\nYou should see two containers running. If orion is not running, you can restart the \ncontainers as necessary. This command will also display open port information.\n\n* If you have installed [`docker-machine`](https://docs.docker.com/machine/) and [Virtual Box](https://www.virtualbox.org/), you will need to retrieve the virtual host ip as shown:\n\n```console\ncurl -X GET http://$(docker-machine ip default):1026/version\n```\n\nIf you need to update the location of orion:\n\n1. Click on the elipsis `...` at the head of the imported postman collection\n2. Select `edit` from the dropdown\n3. Click on the `variables` tab and alter the value from `localhost:1026` as necessary.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Obtaining Version Information",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{orion}}/version/",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"version",
""
]
},
"description": "Once the Orion Context Broker is running, You can check the status by making an HTTP request to the exposed port. \nIf the response is blank, this is usually because the MongoDB database holding the context information is not running or not connected.\n\n>**Troubleshooting:** What if the response is blank ?\n>\n> * To check that a docker container is running try\n>\n>```bash\n>docker ps\n>```\n>\n>You should see two containers running. If orion is not running, you can restart the containers as necessary."
},
"response": []
},
{
"name": "Creating your first Data Entity",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"urn:ngsi-ld:Store:001\",\n \"type\": \"Store\",\n \"address\": {\n \"type\": \"PostalAddress\",\n \"value\": {\n \"streetAddress\": \"Bornholmer Straße 65\",\n \"addressRegion\": \"Berlin\",\n \"addressLocality\": \"Prenzlauer Berg\",\n \"postalCode\": \"10439\"\n },\n \"metadata\": {\n \t\t\"verified\": {\n \t\t\"value\": true,\n \t\t\"type\": \"Boolean\"\n \t\t}\n \t}\n },\n \"location\": {\n \"type\": \"geo:json\",\n \"value\": {\n \"type\": \"Point\",\n \"coordinates\": [13.3986, 52.5547]\n }\n },\n \"name\": {\n \"type\": \"Text\",\n \"value\": \"Bösebrücke Einkauf\"\n }\n}"
},
"url": {
"raw": "http://{{orion}}/v2/entities/",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities",
""
]
},
"description": "## Creating Context Data\n\nAt its heart, FIWARE is a system for managing context information, so lets add some context data into the system by creating a new entity (a store in **Berlin**). Any entity must have a `id` and `type` attributes, additional attributes are optional and will depend on the system being described. Each additional attribute should also have a defined `type` and a `value` attribute."
},
"response": []
},
{
"name": "Creating your Second Data Entity",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"type\": \"Store\",\n \"id\": \"urn:ngsi-ld:Store:002\",\n \"address\": {\n \"type\": \"PostalAddress\",\n \"value\": {\n \"streetAddress\": \"Friedrichstraße 44\",\n \"addressRegion\": \"Berlin\",\n \"addressLocality\": \"Kreuzberg\",\n \"postalCode\": \"10969\"\n },\n \"metadata\": {\n \t\t\"verified\": {\n \t\t\"value\": true,\n \t\t\"type\": \"Boolean\"\n \t\t}\n \t}\n },\n \"location\": {\n \"type\": \"geo:json\",\n \"value\": {\n \"type\": \"Point\",\n \"coordinates\": [13.3903, 52.5075]\n }\n },\n \"name\": {\n \"type\": \"Text\",\n \"value\": \"Checkpoint Markt\"\n }\n}"
},
"url": {
"raw": "http://{{orion}}/v2/entities/",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities",
""
]
}
},
"response": []
},
{
"name": "Retrieving Context Information",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{orion}}/v2/entities",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities"
]
},
"description": "This example returns the full data context"
},
"response": []
},
{
"name": "Obtain Entity Data by id",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{orion}}/v2/entities/urn:ngsi-ld:Store:001?options=keyValues",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities",
"urn:ngsi-ld:Store:001"
],
"query": [
{
"key": "options",
"value": "keyValues",
"description": "* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values `attrs` for an ordered list of attributes only"
},
{
"key": "type",
"value": "Store",
"description": "Entity type, to avoid ambiguity in case there are several entities with the same entity id",
"disabled": true
},
{
"key": "attrs",
"value": "name",
"description": "Ordered list of attribute names to display",
"disabled": true
}
]
},
"description": "This example returns the context data of `store1`. The `id` of the entity should be unique or the `type` parameter should also be used.\n\nBecause of the use of the `options=keyValues`, the response consists of JSON only without the attribute `type` elements."
},
"response": []
},
{
"name": "Obtain Entity Data by type",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{orion}}/v2/entities/?type=Store&options=keyValues",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities",
""
],
"query": [
{
"key": "type",
"value": "Store",
"description": "Entity type, to avoid ambiguity in case there are several entities with the same entity id"
},
{
"key": "options",
"value": "keyValues",
"description": "* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values `attrs` for an ordered list of attributes only"
},
{
"key": "attrs",
"value": "name",
"description": "Ordered list of attribute names to display",
"disabled": true
}
]
},
"description": "This example returns the data of all `Store` entities within the context data. \n\nThe `type` parameter limits the response to store entities only.\nBecause of the use of the `options=keyValues`, the response consists of JSON only without the attribute `type` elements."
},
"response": []
},
{
"name": "Filter context data by attribute value",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{orion}}/v2/entities/?q=name=='Checkpoint Markt'&type=Store&options=keyValues",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities",
""
],
"query": [
{
"key": "q",
"value": "name=='Checkpoint Markt'"
},
{
"key": "type",
"value": "Store",
"description": "Entity type, to avoid ambiguity in case there are several entities with the same entity id"
},
{
"key": "options",
"value": "keyValues",
"description": "* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values `attrs` for an ordered list of attributes only"
},
{
"key": "attrs",
"value": "name",
"description": "Ordered list of attribute names to display",
"disabled": true
}
]
},
"description": "## Filter context data by comparing the values of an attribute\n\nThis example returns the data of all `Store` entities found with the name *Checkpoint Markt*. \n\nFiltering can be done using the `q` parameter - if a string has spaces in it, it can be URL encoded and held within single quote characters `'` = `%27`\n\nBecause of the use of the `options=keyValues`, the response consists of JSON only without the attribute `type` and `metadata` elements."
},
"response": []
},
{
"name": "Filter context data by sub-attribute value",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{orion}}/v2/entities/?q=address.addressLocality=='Kreuzberg'&type=Store&options=keyValues",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities",
""
],
"query": [
{
"key": "q",
"value": "address.addressLocality=='Kreuzberg'"
},
{
"key": "type",
"value": "Store",
"description": "Entity type, to avoid ambiguity in case there are several entities with the same entity id"
},
{
"key": "options",
"value": "keyValues",
"description": "* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values `attrs` for an ordered list of attributes only"
}
]
},
"description": "## Filter context data by comparing the values of an attribute\n\nThis example returns the data of all `Store` entities found in the **Kreuzberg** district of Berlin.\n\nFiltering can be done using the `q` parameter - sub-attributes are annotated using the dot syntax e.g. `address.addressLocality`\n\nBecause of the use of the `options=keyValues`, the response consists of JSON only without the attribute `type` and `metadata` elements."
},
"response": []
},
{
"name": "Filter context data by querying metadata",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{orion}}/v2/entities/?mq=address.verified==true&type=Store&options=keyValues",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities",
""
],
"query": [
{
"key": "mq",
"value": "address.verified==true"
},
{
"key": "type",
"value": "Store",
"description": "Entity type, to avoid ambiguity in case there are several entities with the same entity id"
},
{
"key": "options",
"value": "keyValues",
"description": "* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values `attrs` for an ordered list of attributes only"
}
]
},
"description": "## Filter context data by comparing the values of an metadata attribute\n\nThis example returns the data of all `Store` entities with a verified address.\n\nMetadata queries can be made using the `mq` parameter."
},
"response": []
},
{
"name": "Filter context data by distance",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://{{orion}}/v2/entities/?georel=near;maxDistance:1500&geometry=point&coords=52.5162,13.3777&type=Store&options=keyValues",
"protocol": "http",
"host": [
"{{orion}}"
],
"path": [
"v2",
"entities",
""
],
"query": [
{
"key": "georel",
"value": "near;maxDistance:1500"
},
{
"key": "geometry",
"value": "point"
},
{
"key": "coords",
"value": "52.5162,13.3777"
},
{
"key": "type",
"value": "Store",
"description": "Entity type, to avoid ambiguity in case there are several entities with the same entity id"
},
{
"key": "options",
"value": "keyValues",
"description": "* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values `attrs` for an ordered list of attributes only"
},
{
"key": "attrs",
"value": "name",
"description": "Ordered list of attribute names to display",
"disabled": true
}
]
},
"description": "## Filter context data by comparing the values of a geo:point attribute\n\nThis example returns the data of all `Store` entities found within 1.5km the **Brandenburg Gate** in **Berlin** (*52.5162N 13.3777W*)"
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "581cc060-de73-4283-915a-fcaa1c126830",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "5215414e-418f-4c32-8070-b68d62c90ea4",
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"id": "df0c7c83-8325-4d8f-8b3f-bea47630872d",
"key": "orion",
"value": "localhost:1026",
"type": "string"
}
]
}
\ No newline at end of file
MIT License
Copyright (c) 2018-2020 FIWARE Foundation e.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# WARNING: Do not deploy this tutorial configuration directly to a production environment
#
# The tutorial docker-compose files have not been written for production deployment and will not
# scale. A proper architecture has been sacrificed to keep the narrative focused on the learning
# goals, they are just used to deploy everything onto a single Docker machine. All FIWARE components
# are running at full debug and extra ports have been exposed to allow for direct calls to services.
# They also contain various obvious security flaws - passwords in plain text, no load balancing,
# no use of HTTPS and so on.
#
# This is all to avoid the need of multiple machines, generating certificates, encrypting secrets
# and so on, purely so that a single docker-compose file can be read as an example to build on,
# not use directly.
#