Skip to content

Commit

Permalink
Merge branch 'master' into hardening/orion-mongodb-7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Dec 19, 2023
2 parents 5ef1143 + de8fcb7 commit cc7ac91
Show file tree
Hide file tree
Showing 94 changed files with 6,153 additions and 1,058 deletions.
1 change: 1 addition & 0 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
services:
mongodb:
image: mongo:7.0

ports:
- 27017:27017

Expand Down
3 changes: 3 additions & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
- Add: servicePath field to builtin attributes (#2877)
- Add: notification.mqtt.retain and notification.mqttCustom.retain flag for MQTT retain in notifications (#4388)
- Fix: correctly detect JSON attribute and metadata value changes in subscription triggering logic (#4211, #4434, #643)
- Fix: DateTime and geo:json types were not supported in custom notifications using ngsi patching (#4435)
- Fix: logDeprecate not working correctly (`geo:json` wrongly considered as deprecated)
- Fix: improve error traces (#4387)
- Add: CLI parameter -dbUri / env var ORION_MONGO_URI (#3794)
- Fix: improve logs in MongoDB query logic
- Upgrade Debian version from 11.6 to 12.1 in Dockerfile
- Hardening: upgrade libmongoc dependency from 1.23.1 to 1.24.3
- Reference MongoDB version changed from 4.4 to 6.0
- Reference distribution changed from Debian 11 to Debian 12
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

[![FIWARE Core Context Management](https://nexus.lab.fiware.org/repository/raw/public/badges/chapters/core.svg)](https://www.fiware.org/developers/catalogue/)
[![License badge](https://img.shields.io/github/license/telefonicaid/fiware-orion.svg)](https://opensource.org/licenses/AGPL-3.0)
[![Docker badge](https://img.shields.io/docker/pulls/fiware/orion.svg)](https://hub.docker.com/r/fiware/orion/)
[![Quay badge](https://img.shields.io/badge/quay.io-fiware%2Forion-grey?logo=red%20hat&labelColor=EE0000)](https://quay.io/repository/fiware/orion)
[![Docker badge](https://img.shields.io/badge/docker-telefonicaiot%2Ffiware--orion-blue?logo=docker)](https://registry.hub.docker.com/r/telefonicaiot/fiware-orion)
[![Support badge](https://img.shields.io/badge/tag-fiware--orion-orange.svg?logo=stackoverflow)](http://stackoverflow.com/questions/tagged/fiware-orion)
[![NGSI v2](https://img.shields.io/badge/NGSI-V2-red.svg)](doc/manuals/orion-api.md)
<br>
Expand Down Expand Up @@ -34,8 +35,8 @@ This project is part of [FIWARE](https://www.fiware.org/). For more information
check the FIWARE Catalogue entry for
[Core Context Management](https://github.com/Fiware/catalogue/tree/master/core).

| :books: [Documentation](https://fiware-orion.rtfd.io) | :mortar_board: [Academy](https://fiware-academy.readthedocs.io/en/latest/core/orion) | :whale: [Docker Hub](https://hub.docker.com/r/fiware/orion/) | :dart: [Roadmap](doc/roadmap.md) |
|---|---|---|---|
| :books: [Documentation](https://fiware-orion.rtfd.io) | :mortar_board: [Academy](https://fiware-academy.readthedocs.io/en/latest/core/orion) | <img style="height:1em" src="https://quay.io/static/img/quay_favicon.png"/> [quay.io](https://quay.io/repository/fiware/orion) | :whale: [Docker Hub](https://registry.hub.docker.com/r/telefonicaiot/fiware-orion) | :dart: [Roadmap](doc/roadmap.md) |
|---|---|---|---|--|

## Content

Expand Down Expand Up @@ -263,6 +264,9 @@ version 3](./LICENSE).

© 2023 Telefonica Investigación y Desarrollo, S.A.U

<details>
<summary><strong>Further information on the use of the AGPL open source license</strong></summary>
### Are there any legal issues with AGPL 3.0? Is it safe for me to use?

There is absolutely no problem in using a product licensed under AGPL 3.0. Issues with GPL
Expand All @@ -280,3 +284,4 @@ wish to make a clarifying public statement as follows:
> unmodified version of existing software is not considered a derivative work, and therefore
> it does not need to be released as under the same license, or even released as open source.
</details>
11 changes: 4 additions & 7 deletions ci/deb/build-dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,18 @@ apt-get -y install \
libsasl2-dev \
libgcrypt-dev

## FIXME: check note in build_source.md about the libssl1 installation hack. It will be no longer needed from MongoDB 6.0 on
echo "INSTALL: MongoDB shell" \
&& curl -L http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb --output libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
&& dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
&& rm libssl1.1_1.1.1f-1ubuntu2_amd64.deb \
&& curl -L https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - \
&& echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list \
&& curl -L https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add - \
&& echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/6.0 main" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list \
&& apt-get -y update \
&& apt-get -y install mongodb-org-shell
&& apt-get -y install mongodb-mongosh

echo "INSTALL: python special dependencies" \
&& cd /opt \
&& python3 -m venv /opt/ft_env \
&& . /opt/ft_env/bin/activate \
&& pip install Flask==2.0.2 \
&& pip install Werkzeug==2.0.2 \
&& pip install paho-mqtt==1.6.1 \
&& pip install amqtt==0.11.0b1 \
&& deactivate
Expand Down
2 changes: 1 addition & 1 deletion doc/manuals.jp/admin/build_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ aarch64 アーキテクチャの場合、apt-get を使用して libxslt をイ
. scripts/testEnv.sh
python3 -m venv /opt/ft_env # or 'virtualenv /opt/ft_env --python=/usr/bin/python3' in some systems
. /opt/ft_env/bin/activate
pip install Flask==2.0.2 paho-mqtt==1.6.1 amqtt==0.11.0b1
pip install Flask==2.0.2 Werkzeug==2.0.2 paho-mqtt==1.6.1 amqtt==0.11.0b1

* この環境でテスト・ハーネスを実行してください (時間がかかりますので、気をつけてください)

Expand Down
3 changes: 1 addition & 2 deletions doc/manuals.jp/devel/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ typedef struct RestService
{
RequestType request; // The type of the request
int components; // Number of components in the URL path
std::string compV[10]; // Vector of URL path components. E.g. { "v2", "entities" }
std::string payloadWord; // No longer used, should be removed ... ?
std::string compV[10]; // Vector of URL path components. E.g. { "v2", "entities" }
RestTreat treat; // service function pointer
} RestService;
```
Expand Down
43 changes: 37 additions & 6 deletions doc/manuals.jp/orion-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2125,7 +2125,8 @@ Content-Length: 0
同時に使用できるのは、`payload`, `json` また `ngsi` のうちの1つだけであることに注意してください。

- [一般的な構文制限](#general-syntax-restrictions) は、`POST /v2/subscription``GET /v2/subscriptions`
などの API オペレーションの `httpCustom.payload` フィールドにも適用されます。以下に例を示します
などの API オペレーションの `httpCustom.payload` フィールドにも適用されます。ただし、通知時には、`payload`
内の URL エンコードされた文字はすべてデコードされます。以下に例を示します
- `headers` フィールドによって上書きされる場合を除き、`Content-Type` ヘッダは `text/plain` に設定されます

例:
Expand Down Expand Up @@ -3697,7 +3698,7 @@ _**レスポンス・ペイロード**_
| パラメータ | オプション | タイプ | 説明 |
|-------------------|------------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `attrs` || array | 通知をトリガーする属性名の配列。空のリストは許可されていません |
| `expression` || object | `q`, `mq`, `georel`, `geometry`, `coords` で構成される式 (このフィールドについては、上記の [エンティティをリスト](#list-entities-get-v2entities)操作を参照してください)。`expression` とサブ要素 (つまり `q`) にはコンテンツが必要です。つまり、`{}` または `""` は許可されません |
| `expression` || object | `q`, `mq`, `georel`, `geometry`, `coords` で構成される式 (このフィールドについては、上記の [エンティティをリスト](#list-entities-get-v2entities)操作を参照してください)。`expression` とサブ要素 (つまり `q`) にはコンテンツが必要です。つまり、`{}` または `""` は許可されません`georel`, `geometry`, および `coords` は一緒に使用する必要があります (つまり、"全てか無しか")。 geoquery を式として使用する例は下記(#create-subscription-post-v2subscriptions) を確認してください |
| `alterationTypes` || array | サブスクリプションがトリガーされる変更 (エンティティの作成、エンティティの変更など) を指定します ([変更タイプに基づくサブスクリプション](#subscriptions-based-in-alteration-type)のセクションを参照) |
| `notifyOnMetadataChange` || boolean | `true` の場合、メタデータは通知のコンテキストで属性の値の一部と見なされるため、値が変更されずにメタデータが変更された場合、通知がトリガーされます。`false` の場合、メタデータは通知のコンテキストで属性の値の一部と見なされないため、値が変更されずにメタデータが変更された場合、通知はトリガーされません。デフォルト値は `true` です |

Expand Down Expand Up @@ -3926,7 +3927,7 @@ _**リクエスト・ペイロード**_
ペイロードは、JSON サブスクリプション表現形式 ([サブスクリプション・ペイロード・データモデル](#subscription-payload-datamodel)
セクションで説明されています) に従うサブスクリプションを含む JSON オブジェクトです。

:
属性フィルタを使用した例:

```json
{
Expand All @@ -3951,8 +3952,38 @@ _**リクエスト・ペイロード**_
},
"attrs": ["temperature", "humidity"]
},
"expires": "2025-04-05T14:00:00.00Z",
"throttling": 5
"expires": "2025-04-05T14:00:00.00Z"
}
```

条件としてジオクエリを使用する例:

```json
{
"description": "One subscription to rule them all",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Room"
}
],
"condition": {
"attrs": [ "temperature" ],
"expression": {
"georel": "near;maxDistance:15000",
"geometry": "point",
"coords": "37.407804,-6.004552"
}
}
},
"notification": {
"http": {
"url": "http://localhost:1234"
},
"attrs": ["temperature", "humidity"]
},
"expires": "2025-04-05T14:00:00.00Z"
}
```

Expand Down Expand Up @@ -4480,7 +4511,7 @@ _**リクエスト・ペイロード**_
- `appendStrict`: `POST /v2/entities` (エンティティがまだ存在しない場合) または
`POST /v2/entities/<id>/attrs?options=append` (エンティティが既に存在する場合) にマップします
- `update`: `PATCH /v2/entities/<id>/attrs` にマップされます
- `delete`: エンティティに含まれているすべての属性に対して、`DELETE /v2/entities/<id>/attrs/<attrName>`
- `delete`: エンティティに含まれているすべての属性に対して (この場合、属性の実際の値は関係ありません)`DELETE /v2/entities/<id>/attrs/<attrName>`
にマッピングし、エンティティに属性が含まれていない場合は、`DELETE /v2/entities/<id>` にマッピングします
- `replace`: `PUT /v2/entities/<id>/attrs` にマッピングします

Expand Down
4 changes: 2 additions & 2 deletions doc/manuals.jp/user/walkthrough_apiv2.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ broker を再起動するには、*root* として実行するか、`sudo` コ
# ./accumulator-server.py --port 1028 --url /accumulate --host ::1 --pretty-print -v
```

このスクリプトには Flask version 2.0.2 と paho-mqtt version 1.6.1 が必要であることに注意してください。
これらは、`pip install Flask==2.0.2``pip install paho-mqtt==1.6.1` を使用してインストールできます。
このスクリプトには Flask version 2.0.2 (Werkzeug 2.0.2 とともに) と paho-mqtt version 1.6.1 が必要であることに注意してください。
これらは、それぞれ、`pip install Flask==2.0.2 Werkzeug==2.0.2``pip install paho-mqtt==1.6.1` を使用してインストールできます。
さらに、Python 3.10.x を使用することをお勧めします。ベース・オペレーティングシステムの Python
インストールと競合する場合は、[virtualenv](https://virtualenv.pypa.io/en/latest/) を使用することを
お勧めします。
Expand Down
10 changes: 2 additions & 8 deletions doc/manuals/admin/build_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,7 @@ The Orion Context Broker comes with a suite of unit, valgrind and end-to-end tes

In the case of the aarch64 architecture, install libxslt using apt-get, and run `./configure` with `--build=arm-linux` option.

* Install MongoDB (tests rely on mongod running in localhost). Check [the official MongoDB documentation](hhttps://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian/) for details. Recommended version is 4.4 (it may work with previous versions, but we don't recommend it).
* Note that mongo legacy shell (the `mongo` command) has been deprecated in MongoDB 5 and removed in MongoDB 6 in favour of the new shell (`mongosh` command). Some functional tests (ftest) will fail due to this if you use MongoDB 6 or beyond, as they are suited to use `mongo` and not `mongosh`.
* Debian 12 has stepped to libssl3 but some MongoDB versions may require libssl1. In the case you get a `Depends: libssl1.1 (>= 1.1.1) but it is not installable` error, you can test the following (reference [here](https://askubuntu.com/a/1421959))

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
rm libssl1.1_1.1.1f-1ubuntu2_amd64.deb # optional, for cleanness
* Install MongoDB (tests rely on mongod running in localhost). Check [the official MongoDB documentation](hhttps://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian/) for details. Recommended version is 6.0 (it may work with previous versions, but we don't recommend it).

* Run unit test

Expand All @@ -131,7 +125,7 @@ In the case of the aarch64 architecture, install libxslt using apt-get, and run
. scripts/testEnv.sh
python3 -m venv /opt/ft_env # or 'virtualenv /opt/ft_env --python=/usr/bin/python3' in some systems
. /opt/ft_env/bin/activate
pip install Flask==2.0.2 paho-mqtt==1.6.1 amqtt==0.11.0b1
pip install Flask==2.0.2 Werkzeug==2.0.2 paho-mqtt==1.6.1 amqtt==0.11.0b1

* Run test harness in this environment (it takes some time, please be patient).

Expand Down
2 changes: 1 addition & 1 deletion doc/manuals/admin/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ In the case you are installing Orion building from sources you need:
* Operating system: Debian. The reference operating system is Debian 12.1
but it should work also in any later Debian 12 version.
* Database: MongoDB is required to run either in the same host where Orion Context Broker is to be installed or in a different host accessible through the network. The recommended MongoDB version
is 4.4 (Orion may work with older versions but we don't recommend it at all!).
is 6.0 (Orion may work with older versions but we don't recommend it at all!).

For system resources (CPUs, RAM, etc.) see [these recommendations](diagnosis.md#resource-availability).

Expand Down
2 changes: 1 addition & 1 deletion doc/manuals/admin/perf_tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

## MongoDB configuration

From a performance point of view, it is recommended to use MongoDB 4.4 with WireTiger, especially
From a performance point of view, it is recommended to use MongoDB 6.0 with WireTiger, especially
in update-intensive scenarios.

In addition, take into account the following information from the official MongoDB documentation, as it may have
Expand Down
3 changes: 1 addition & 2 deletions doc/manuals/devel/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ typedef struct RestService
{
RequestType request; // The type of the request
int components; // Number of components in the URL path
std::string compV[10]; // Vector of URL path components. E.g. { "v2", "entities" }
std::string payloadWord; // No longer used, should be removed ... ?
std::string compV[10]; // Vector of URL path components. E.g. { "v2", "entities" }
RestTreat treat; // service function pointer
} RestService;
```
Expand Down
Loading

0 comments on commit cc7ac91

Please sign in to comment.