From e75fb4e6de5a616122929fa323d5a393cc2e1518 Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Sun, 10 Sep 2023 11:09:34 +0900 Subject: [PATCH 01/10] ADD IMAGE_NAME arg to Dockerfile --- docker/Dockerfile | 3 ++- docker/README.jp.md | 3 ++- docker/README.md | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 8e2809b368..17c2c70b01 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,8 +19,9 @@ # iot_support at tid dot es # +ARG IMAGE_NAME=debian ARG IMAGE_TAG=12.1-slim -FROM debian:${IMAGE_TAG} +FROM ${IMAGE_NAME}:${IMAGE_TAG} ARG GITHUB_ACCOUNT=telefonicaid ARG GITHUB_REPOSITORY=fiware-orion diff --git a/docker/README.jp.md b/docker/README.jp.md index efce59448a..048cbc8eb6 100644 --- a/docker/README.jp.md +++ b/docker/README.jp.md @@ -128,7 +128,8 @@ Orion Context Broker を試してみたいし、データベースについて | ARG | 説明 | 例 | | --------------- | -------------------------------------------------------------- | ------------------------------- | -| IMAGE_TAG | ベース・イメージのタグを指定します | --build-arg IMAGE_TAG=centos7 | +| IMAGE_NAME | ベース・イメージの名前を指定します | --build-arg IMAGE_NAME=ubuntu | +| IMAGE_TAG | ベース・イメージのタグを指定します | --build-arg IMAGE_TAG=22.04 | | GIT_NAME | GitHub リポジトリのユーザ名を指定します | --build-arg GIT_NAME=fiware-ges | | GIT_REV_ORION | ビルドする Orion バージョンを指定します | --build-arg GIT_REV_ORION=2.3.0 | | CLEAN_DEV_TOOLS | 開発ツールをクリアするかどうかを指定します。0 の場合は残ります | --build-arg CLEAN_DEV_TOOLS=0 | diff --git a/docker/README.md b/docker/README.md index 58228b0b51..60a3cb2df2 100644 --- a/docker/README.md +++ b/docker/README.md @@ -130,7 +130,8 @@ The parameter `--build-arg` in the `docker build` can be set build-time variable | ARG | Description | Example | | --------------- | ------------------------------------------------------------------- | ------------------------------- | -| IMAGE_TAG | Specify a tag of the base image. | --build-arg IMAGE_TAG=centos7 | +| IMAGE_NAME | Specify a name of the base image. | --build-arg IMAGE_TAG=ubuntu | +| IMAGE_TAG | Specify a tag of the base image. | --build-arg IMAGE_TAG=22.04 | | GIT_NAME | Specify a username of GitHub repository. | --build-arg GIT_NAME=fiware-ges | | GIT_REV_ORION | Specify the Orion version you want to build. | --build-arg GIT_REV_ORION=2.3.0 | | CLEAN_DEV_TOOLS | Specify whether the development tools clear. It is remained when 0. | --build-arg CLEAN_DEV_TOOLS=0 | From e3ff8969e5c69a7e1ba38d5e1823386728845f4f Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Sun, 10 Sep 2023 12:29:10 +0900 Subject: [PATCH 02/10] REMOVE Ubuntu 20.04 LTS section --- doc/manuals.jp/admin/build_source.md | 177 +-------------------------- doc/manuals/admin/build_source.md | 164 +------------------------ 2 files changed, 2 insertions(+), 339 deletions(-) diff --git a/doc/manuals.jp/admin/build_source.md b/doc/manuals.jp/admin/build_source.md index d494a40200..f2793b97c4 100644 --- a/doc/manuals.jp/admin/build_source.md +++ b/doc/manuals.jp/admin/build_source.md @@ -1,6 +1,6 @@ # ソースからのビルド -Orion Context Broker のリファレンス配布は Debian 12 です。これは、broker を他のディストリビューションに組み込むことができないことを意味しません (実際には可能です)。このセクションでは、他のディストリビューションをビルドする方法についても説明しています。Debian を使用していない人に役立つかもしれません。ただし、"公式にサポートされている" 唯一の手順は Debian 12 用の手順です。他のものは "現状のまま" 提供され、随時時代遅れになる可能性があります。 +Orion Context Broker のリファレンス配布は Debian 12 です。これは、broker を他のディストリビューションに組み込むことができないことを意味しません (実際には可能です)。ただし、"公式にサポートされている" 唯一の手順は Debian 12 用の手順です。 ## Debian 12 (正式サポート) @@ -151,178 +151,3 @@ aarch64 アーキテクチャの場合、apt-get を使用して libxslt をイ * カバレッジを実行します make coverage INSTALL_DIR=~ - -## Ubuntu 20.04 LTS - -この手順は、Ubuntu 20.04 LTS 上で x86_64 および aarch64 アーキテクチャ用の Orion Context Broker をすることです。 -また、Orion が依存する MongoDB 4.4 をビルドするための手順が含まれています。Orion Context Brokerは、ビルドの依存関係と -して次のライブラリを使用します : - -* boost: 1.71.0 -* libmicrohttpd: 0.9.76 (ソースから) -* libcurl: 7.68.0 -* openssl: 1.1.1f -* libuuid: 2.34-0.1 -* libmosquitto: 2.0.15 (ソースから) -* Mongo C driver: 1.23.1 (ソースから) -* rapidjson: 1.1.0 (ソースから) -* gtest (only for `make unit_test` building target): 1.5 (ソースから) -* gmock (only for `make unit_test` building target): 1.5 (ソースから) - -基本的な手順は次のとおりです (root 権限でコマンドを実行しないと仮定し、root 権限が必要なコマンドに sudo を使用します) : - -* 必要なビルドツール (コンパイラなど) をインストールします - - sudo apt install build-essential cmake - -* 必要なライブラリをインストールします (次の手順で説明する、ソースから取得する必要があるものを除きます) - - sudo apt install libboost-dev libboost-regex-dev libboost-thread-dev libboost-filesystem-dev \ - libcurl4-gnutls-dev gnutls-dev libgcrypt-dev libssl-dev uuid-dev libsasl2-dev - -* ソースから Mongo Driver をインストールします - - wget https://github.com/mongodb/mongo-c-driver/releases/download/1.23.1/mongo-c-driver-1.23.1.tar.gz - tar xfvz mongo-c-driver-1.23.1.tar.gz - cd mongo-c-driver-1.23.1 - mkdir cmake-build - cd cmake-build - cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. - make - sudo make install - -* ソースから rapidjson をインストールします : - - wget https://github.com/miloyip/rapidjson/archive/v1.1.0.tar.gz - tar xfvz v1.1.0.tar.gz - sudo mv rapidjson-1.1.0/include/rapidjson/ /usr/local/include - -* ソースから libmicrohttpd をインストールします (`./configure` 下のコマンドはライブラリの最小限のフットプリントを -得るための推奨ビルド設定を示していますが、上級ユーザの方は好きなように設定できます) - - wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz - tar xvf libmicrohttpd-0.9.76.tar.gz - cd libmicrohttpd-0.9.76 - ./configure --disable-messages --disable-postprocessor --disable-dauth - make - sudo make install # installation puts .h files in /usr/local/include and library in /usr/local/lib - sudo ldconfig # just in case... it doesn't hurt :) - -* ソースから mosquitto をインストールします (WITH_CJSON, WITH_STATIC_LIBRARIES, WITH_SHARED_LIBRARIES の設定を変更することで、mosquitto-2.0.15/ の下の config.mk ファイルを変更してビルドを微調整できます) - - wget https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz - tar xvf mosquitto-2.0.15.tar.gz - cd mosquitto-2.0.15 - sed -i 's/WITH_CJSON:=yes/WITH_CJSON:=no/g' config.mk - sed -i 's/WITH_STATIC_LIBRARIES:=no/WITH_STATIC_LIBRARIES:=yes/g' config.mk - sed -i 's/WITH_SHARED_LIBRARIES:=yes/WITH_SHARED_LIBRARIES:=no/g' config.mk - make - sudo make install # installation puts .h files in /usr/local/include and library in /usr/local/lib - sudo ldconfig # Update /etc/ld.so.cache with the new library files in /usr/local/lib - -* コードを取得します (または、圧縮されたバージョンや別の URL パターンを使用してダウンロードできます。例えば、 -`git clone git@github.com:telefonicaid/fiware-orion.git`) : - - sudo apt install git - git clone https://github.com/telefonicaid/fiware-orion - -* ソースをビルドします : - - cd fiware-orion - make - -* (オプションですが、強くお勧めします) 単体テスト (unit test) と機能テスト (functional tests) を実行します。 -詳細については、[以下のセクション](#testing-and-coverage)をご覧ください。 - -* バイナリをインストールします。INSTALL_DIR を使用して、インストール・プレフィックス・パス (デフォルトは /usr) を設定する -ことができます。したがって、broker は `$INSTALL_DIR/bin` ディレクトリにインストールされます - - sudo make install INSTALL_DIR=/usr - -* broker のバージョン・メッセージを呼び出し、すべてが正常であることを確認してください : - - contextBroker --version - - -### テストとカバレッジ - -Orion Context Broker には、次の手順 (オプション) に従って実行することができる、valgrind およびエンド・ツー・エンドのテストの -機能的なスイートが付属しています : - -* ソースから Google Test/Mock をインストールします。以前は URL は http://googlemock.googlecode.com/files/gmock-1.5.0.tar.bz2 -でしたが、Google では2016年8月下旬にそのパッケージを削除したため、動作しなくなりました - - sudo apt install python-is-python2 xsltproc - wget https://nexus.lab.fiware.org/repository/raw/public/storage/gmock-1.5.0.tar.bz2 - tar xfvj gmock-1.5.0.tar.bz2 - cd gmock-1.5.0 - ./configure - make - sudo make install # installation puts .h files in /usr/local/include and library in /usr/local/lib - sudo ldconfig # just in case... it doesn't hurt :) - -aarch64 アーキテクチャの場合、`.-configure` を `--build=arm-linux` オプションとともに実行します。 - -* MongoDB をインストールします (テストはローカルホストで実行されている mongod に依存します)。詳細については、 - [MongoDB の公式ドキュメント](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/)を確認してください。 - 推奨バージョンは 4.4 です (以前のバージョンで動作する可能性がありますが、お勧めしません)。 - -* 単体テストを実行します : - - make unit_test - -* 機能テストと valgrind テストに必要な追加のツールをインストールします : - - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - sudo python get-pip.py - sudo apt install netcat valgrind bc - sudo pip install --upgrade pip - pip install virtualenv - -* テスト・ハーネスのための環境を準備します。基本的には、`accumulator-server.py` スクリプトをコントロールの下にあるパスに -インストールしなければならず、`~/bin` が推奨です。また、`/usr/bin` のようなシステム・ディレクトリにインストールすることも -できますが、他のプログラムと衝突する可能性がありますので、お勧めしません。さらに、ハーネス・スクリプト (`scripts/testEnv.sh` -ファイル参照) で使用されるいくつかの環境変数を設定し、Ubuntu のデフォルトの Flask の代わりに Flask version 1.0.2 を使用する -ために、virtualenv 環境を作成する必要があります。この環境でテスト・ハーネスを実行します。 - - mkdir ~/bin - export PATH=~/bin:$PATH - make install_scripts INSTALL_DIR=~ - . scripts/testEnv.sh - virtualenv /opt/ft_env - . /opt/ft_env/bin/activate - pip install Flask==2.0.2 paho-mqtt==1.6.1 amqtt==0.10.1 - -* テスト・ハーネスを実行してください (時間がかかりますので、気をつけてください) make コマンドでテストを開始する前に、テストが失敗しないように次のパッチを適用してください。 - - sed -i -e "s/Peer certificate cannot be authenticated[^\"]*/SSL peer certificate or SSH remote key was not OK/" /opt/fiware-orion/test/functionalTest/cases/0706_direct_https_notifications/direct_https_notifications_no_accept_selfsigned.test - make functional_test INSTALL_DIR=~ - -* すべての機能テストに合格したら、valgrind テストを実行できます (これは機能テストよりも時間がかかります) : - - make valgrind - -次の手順を使用して、Orion Context Broker のカバレッジレポートを生成できます (オプション) : - -* lcov ツールをインストールします - - sudo apt install lcov - -* まず、unit_test と functional_test の成功パスを実行して、すべてが正常であることを確認します (上記参照) - -* カバレッジを実行します - - make coverage INSTALL_DIR=~ - -* テストの実行後にシステムサービスとして Orion を実行するためのセットアップを行います。`curl localhost:1026/version` コマンドを実行して、 -セットアップが成功したことを確認します : - - sudo mkdir /etc/sysconfig - sudo cp /opt/fiware-orion/etc/config/contextBroker /etc/sysconfig/ - sudo touch /var/log/contextBroker/contextBroker.log - sudo chown orion /var/log/contextBroker/contextBroker.log - sudo cp /opt/fiware-orion/etc/logrotate.d/logrotate-contextBroker-daily /etc/logrotate.d/ - sudo cp /opt/fiware-orion/etc/sysconfig/logrotate-contextBroker-size /etc/sysconfig/ - sudo cp /opt/fiware-orion/etc/cron.d/cron-logrotate-contextBroker-size /etc/cron.d/ - sudo systemctl daemon-reload - sudo systemctl start contextBroker.service diff --git a/doc/manuals/admin/build_source.md b/doc/manuals/admin/build_source.md index 67a6ed6f48..e6b6423386 100644 --- a/doc/manuals/admin/build_source.md +++ b/doc/manuals/admin/build_source.md @@ -1,6 +1,6 @@ # Building from sources -Orion Context Broker reference distribution is Debian 12. This doesn't mean that the broker cannot be built in other distributions (actually, it can). This section also includes indications on how to build in other distributions, just in the case it may help people that don't use Debian. However, note that the only "officially supported" procedure is the one for Debian 12; the others are provided "as is" and can get obsolete from time to time. +Orion Context Broker reference distribution is Debian 12. This doesn't mean that the broker cannot be built in other distributions (actually, it can). However, note that the only "officially supported" procedure is the one for Debian 12. ## Debian 12 (officially supported) @@ -150,165 +150,3 @@ You can generate coverage reports for the Orion Context Broker using the followi * Run coverage make coverage INSTALL_DIR=~ - -## Ubuntu 20.04 LTS - -This instruction is how to build the Orion Context Broker for the x86_64 or the aarch64 architecture on Ubuntu 20.04 LTS. -And it includes the instruction to build MongoDB 4.4 that the Orion depends on. -The Orion Context Broker uses the following libraries as build dependencies: - -* boost: 1.71.0 -* libmicrohttpd: 0.9.76 (from source) -* libcurl: 7.68.0 -* openssl: 1.1.1f -* libuuid: 2.34-0.1 -* libmosquitto: 2.0.15 (from source) -* Mongo C driver: 1.23.1 (from source) -* rapidjson: 1.1.0 (from source) -* gtest (only for `make unit_test` building target): 1.5 (from sources) -* gmock (only for `make unit_test` building target): 1.5 (from sources) - -The basic procedure is as follows (assuming you don't run commands as root, we use sudo for those -commands that require root privilege): - -* Install the needed building tools (compiler, etc.). - - sudo apt install build-essential cmake - -* Install the required libraries (except what needs to be taken from source, described in following steps). - - sudo apt install libboost-dev libboost-regex-dev libboost-thread-dev libboost-filesystem-dev \ - libcurl4-gnutls-dev gnutls-dev libgcrypt-dev libssl-dev uuid-dev libsasl2-dev - -* Install the Mongo Driver from source. - - wget https://github.com/mongodb/mongo-c-driver/releases/download/1.23.1/mongo-c-driver-1.23.1.tar.gz - tar xfvz mongo-c-driver-1.23.1.tar.gz - cd mongo-c-driver-1.23.1 - mkdir cmake-build - cd cmake-build - cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. - make - make install - -* Install rapidjson from sources: - - wget https://github.com/miloyip/rapidjson/archive/v1.1.0.tar.gz - tar xfvz v1.1.0.tar.gz - sudo mv rapidjson-1.1.0/include/rapidjson/ /usr/local/include - -* Install libmicrohttpd from sources (the `./configure` command below shows the recommended build configuration to get minimum library footprint, but if you are an advanced user, you can configure as you prefer) - - wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz - tar xvf libmicrohttpd-0.9.76.tar.gz - cd libmicrohttpd-0.9.76 - ./configure --disable-messages --disable-postprocessor --disable-dauth - make - sudo make install # installation puts .h files in /usr/local/include and library in /usr/local/lib - sudo ldconfig # just in case... it doesn't hurt :) - -* Install mosquitto from sources (appart from changing WITH_CJSON, WITH_STATIC_LIBRARIES and WITH_SHARED_LIBRARIES settings, config.mk file under mosquitto-2.0.15/ can be modified to fine tune the build) - - wget https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz - tar xvf mosquitto-2.0.15.tar.gz - cd mosquitto-2.0.15 - sed -i 's/WITH_CJSON:=yes/WITH_CJSON:=no/g' config.mk - sed -i 's/WITH_STATIC_LIBRARIES:=no/WITH_STATIC_LIBRARIES:=yes/g' config.mk - sed -i 's/WITH_SHARED_LIBRARIES:=yes/WITH_SHARED_LIBRARIES:=no/g' config.mk - make - sudo make install # installation puts .h files in /usr/local/include and library in /usr/local/lib - sudo ldconfig # Update /etc/ld.so.cache with the new library files in /usr/local/lib - -* Get the code (alternatively you can download it using a zipped version or a different URL pattern, e.g `git clone git@github.com:telefonicaid/fiware-orion.git`): - - sudo apt install git - git clone https://github.com/telefonicaid/fiware-orion - -* Build the source: - - cd fiware-orion - make - -* (Optional but highly recommended) run unit test and functional tests. More on this on [its specific section below](#testing-and-coverage). - -* Install the binary. You can use INSTALL_DIR to set the installation prefix path (default is /usr), thus the broker is installed in `$INSTALL_DIR/bin` directory. - - sudo make install INSTALL_DIR=/usr - -* Check that everything is ok, invoking the broker version message: - - contextBroker --version - -### Testing and coverage - -The Orion Context Broker comes with a suite of functional, valgrind and end-to-end tests that you can also run, following the following procedure (optional): - -* Install Google Test/Mock from sources. Previously the URL was http://googlemock.googlecode.com/files/gmock-1.5.0.tar.bz2 but Google removed that package in late August 2016 and it is no longer working. - - apt install python-is-python2 xsltproc - wget https://nexus.lab.fiware.org/repository/raw/public/storage/gmock-1.5.0.tar.bz2 - tar xfvj gmock-1.5.0.tar.bz2 - cd gmock-1.5.0 - ./configure - make - sudo make install # installation puts .h files in /usr/local/include and library in /usr/local/lib - sudo ldconfig # just in case... it doesn't hurt :) - -In the case of the aarch64 architecture, run `./configure` with `--build=arm-linux` option. - -* Install MongoDB (tests rely on mongod running in localhost). Check [the official MongoDB documentation](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/) for details. Recommended version is 4.4 (it may work with previous versions, but we don't recommend it). - -* Run unit test: - - make unit_test - -* Install additional required tools for functional and valgrind tests: - - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - sudo python get-pip.py - sudo apt install netcat valgrind bc - sudo pip install --upgrade pip - pip install virtualenv - -* Prepare the environment for test harness. Basically, you have to install the `accumulator-server.py` script and in a path under your control, `~/bin` is the recommended one. Alternatively, you can install them in a system directory such as `/usr/bin` but it could collide with other programs, thus it is not recommended. In addition, you have to set several environment variables used by the harness script (see `scripts/testEnv.sh` file) and create a virtualenv environment to use Flask version 1.0.2 instead of default Flask in Ubuntu. Run test harness in this environment. - - mkdir ~/bin - export PATH=~/bin:$PATH - make install_scripts INSTALL_DIR=~ - . scripts/testEnv.sh - virtualenv /opt/ft_env - . /opt/ft_env/bin/activate - pip install Flask==2.0.2 paho-mqtt==1.6.1 amqtt==0.10.1 - -* Run test harness (it takes some time, please be patient). Before starting test by make command, apply the following patch to avoid test failing. - - sed -i -e "s/Peer certificate cannot be authenticated[^\"]*/SSL peer certificate or SSH remote key was not OK/" /opt/fiware-orion/test/functionalTest/cases/0706_direct_https_notifications/direct_https_notifications_no_accept_selfsigned.test - make functional_test INSTALL_DIR=~ - -* Once passed all the functional tests, you can run the valgrind tests (this will take longer than the functional tests, arm yourself with a lot of patience): - - make valgrind - -You can generate coverage reports for the Orion Context Broker using the following procedure (optional): - -* Install the lcov tool - - sudo apt install lcov - -* Do first a successful pass for unit_test and functional_test, to check that everything is ok (see above) - -* Run coverage - - make coverage INSTALL_DIR=~ - -* Setup for running Orion as system service after running tests. Run the `curl localhost:1026/version` command to check that the setup has been successful: - - sudo mkdir /etc/sysconfig - sudo cp /opt/fiware-orion/etc/config/contextBroker /etc/sysconfig/ - sudo touch /var/log/contextBroker/contextBroker.log - sudo chown orion /var/log/contextBroker/contextBroker.log - sudo cp /opt/fiware-orion/etc/logrotate.d/logrotate-contextBroker-daily /etc/logrotate.d/ - sudo cp /opt/fiware-orion/etc/sysconfig/logrotate-contextBroker-size /etc/sysconfig/ - sudo cp /opt/fiware-orion/etc/cron.d/cron-logrotate-contextBroker-size /etc/cron.d/ - sudo systemctl daemon-reload - sudo systemctl start contextBroker.service From 3fb9eb8dc89183a679366f6396494af33339f8ca Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Sun, 10 Sep 2023 15:40:34 +0900 Subject: [PATCH 03/10] ADD documentation about how to use Orion in Docker on Raspberry Pi OS --- docker/raspberry_pi.jp.md | 47 ++++++--------------------------------- docker/raspberry_pi.md | 41 ++++------------------------------ 2 files changed, 11 insertions(+), 77 deletions(-) diff --git a/docker/raspberry_pi.jp.md b/docker/raspberry_pi.jp.md index 51d48b107a..2769483c76 100644 --- a/docker/raspberry_pi.jp.md +++ b/docker/raspberry_pi.jp.md @@ -5,9 +5,7 @@ Raspberry Pi で Docker を使用すると、Orion Context Broker を非常に [Raspberry Pi](https://www.raspberrypi.org/) は、低価格のクレジット・カード・サイズのコンピュータです。 ARM ベースのデバイスであり、ARM アーキテクチャ用にコンパイルされたバイナリが必要です。 Orion の Docker イメージをビルドして実行するには、ARM architecture 用の 64 ビット Linux と Docker を Raspberry Pi に -インストールします。Raspberry Pi にインストールされたオペレーティング・システムで Orion を直接ビルド -して実行する場合は、その方法に関する -[ドキュメント](../doc/manuals.jp/admin/build_source.md#ubuntu-1804-lts)を参照してください。 +インストールします。 ## 前提条件 @@ -15,46 +13,15 @@ ARM ベースのデバイスであり、ARM アーキテクチャ用にコンパ ターゲット・ハードウェアは、64 ビット ARM アーキテクチャ (aarch64) をサポートする Raspberry Pi 3 および 4 です。 -### Linux OS +### Raspberry Pi OS -現在のところ、Raspberry Pi で64 ビット Linux を使用するオプションは多くありません。Ubuntu 20.04 LTS -を使用することをお勧めします。[こちら](https://ubuntu.com/download/raspberry-pi)から OS イメージを取得し、 -インストール手順を見つけることができます。 +Raspberry Pi OS Bookworm 12 を使用することをお勧めします。[こちら](https://www.raspberrypi.com/software/)から +OS イメージを取得し、インストール手順を確認することができます。 ### Docker -次のコマンドに従って、Ubuntu に Docker をインストールできます : - -``` -sudo cp -p /etc/apt/sources.list{,.bak} -sudo apt-get update -sudo apt-get install -y \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg-agent \ - software-properties-common -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -sudo add-apt-repository \ - "deb [arch=arm64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" -sudo apt-get install -y docker-ce -``` - -Docker のインストールの詳細は[こちら](https://docs.docker.com/install/linux/docker-ce/ubuntu/)です。 - -### Dokcer compose - -aarch64 の Docker Compose のバイナリは提供されていません。ソースコードからビルドする必要があります。 -次のようにコマンドを実行して、Docker Compose のバージョン 1.27.4 をインストールできます : - -``` -git clone -b 1.27.4 https://github.com/docker/compose.git -cd compose/ -sudo ./script/build/linux -sudo cp dist/docker-compose-Linux-aarch64 /usr/local/bin/docker-compose -``` +Raspberry Pi OS に Docker と Docker compose plugin をインストールします。Docker +のインストールの詳細は[こちら](https://docs.docker.com/engine/install/raspberry-pi-os/)です。 ## Orion のビルド方法 @@ -87,5 +54,5 @@ services: command: --nojournal ``` -Orion を実行するには、`docker-compose up -d` を実行します。`curl localhost:1026/version` コマンドを実行して、 +Orion を実行するには、`docker compose up -d` を実行します。`curl localhost:1026/version` コマンドを実行して、 Orion が起動したかどうかを確認します。 diff --git a/docker/raspberry_pi.md b/docker/raspberry_pi.md index 45a11abdef..500e5f9894 100644 --- a/docker/raspberry_pi.md +++ b/docker/raspberry_pi.md @@ -5,8 +5,6 @@ You can run Orion Context Broker very easily using docker on Raspberry Pi. The [Raspberry Pi](https://www.raspberrypi.org/) is a low cost, credit-card sized computer. It is an ARM based device and requires binaries compiled for the ARM architecture. To build and run the docker image of Orion, the 64 bit Linux and docker for the ARM architecture are installed on Raspberry Pi. -If you want to build and run Orion directly on an operating system installed on a Raspberry Pi, See the -[documentation](../doc/manuals/admin/build_source.md#ubuntu-1804-lts) on how to do this. ## Prerequisites @@ -16,44 +14,13 @@ The target devices are Raspberry Pi 3 and 4 which support the 64 bit ARM archite ### Linux OS -As of now, there are not many options to use the 64 bit Linux on Raspberry Pi. -To use Ubuntu 20.04 LTS is better. You can get the OS image and find the install instruction -[here](https://ubuntu.com/download/raspberry-pi). +To use Raspberry Pi OS Bookworm 12 is better. You can get the OS image and find the install instruction +[here](https://www.raspberrypi.com/software/). ### Docker -You can install Docker on Ubuntu by following the commands as shown: - -``` -sudo cp -p /etc/apt/sources.list{,.bak} -sudo apt-get update -sudo apt-get install -y \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg-agent \ - software-properties-common -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -sudo add-apt-repository \ - "deb [arch=arm64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" -sudo apt-get install -y docker-ce -``` - -The details to install Docker are [here](https://docs.docker.com/install/linux/docker-ce/ubuntu/). - -### Docker compose - -The Docker Compose binary for aarch64 is not provided. It is necessary to build it from its source code. -You can install the docker compose version 1.27.4 by running the commands as shown: - -``` -git clone -b 1.27.4 https://github.com/docker/compose.git -cd compose/ -sudo ./script/build/linux -sudo cp dist/docker-compose-Linux-aarch64 /usr/local/bin/docker-compose -``` +You install Docker and Docker compose plugin on Raspberry Pi OS. The details to install Docker are +[here](https://docs.docker.com/engine/install/raspberry-pi-os/). ## How to build Orion From 18f42acec001630a91089807a8f634c9f543e63f Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Mon, 11 Sep 2023 20:43:38 +0900 Subject: [PATCH 04/10] ADD IMAGE_NAME arg to Dockerfile.alpine --- docker/Dockerfile.alpine | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 5ab7222703..524335f677 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -22,8 +22,9 @@ # FIXME the change from mongoc driver 1.23.1 to 1.24.1 (PR https://github.com/telefonicaid/fiware-orion/pull/4415) # has not been actually tested. Remove this FIXME mark after succesfull test +ARG IMAGE_NAME=alpine ARG IMAGE_TAG=3.16.0 -FROM alpine:${IMAGE_TAG} +FROM ${IMAGE_NAME}:${IMAGE_TAG} ARG GITHUB_ACCOUNT=telefonicaid ARG GITHUB_REPOSITORY=fiware-orion From 26a49b5a9c1220a6eba253c97a0fe6610db4fc1b Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Mon, 11 Sep 2023 21:00:11 +0900 Subject: [PATCH 05/10] Amend document --- doc/manuals.jp/admin/build_source.md | 2 +- doc/manuals/admin/build_source.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/manuals.jp/admin/build_source.md b/doc/manuals.jp/admin/build_source.md index f2793b97c4..26850636db 100644 --- a/doc/manuals.jp/admin/build_source.md +++ b/doc/manuals.jp/admin/build_source.md @@ -1,6 +1,6 @@ # ソースからのビルド -Orion Context Broker のリファレンス配布は Debian 12 です。これは、broker を他のディストリビューションに組み込むことができないことを意味しません (実際には可能です)。ただし、"公式にサポートされている" 唯一の手順は Debian 12 用の手順です。 +Orion Context Broker のリファレンス配布は Debian 12 です。これは、broker を他のディストリビューションに組み込むことができないことを意味しません (実際には可能です)。このセクションには、Debian を使用していない人に役立つ可能性があるため、他のディストリビューションに組み込む方法に関する指示が含まれる場合があります。ただし、"公式にサポートされている" 唯一の手順は Debian 12 用の手順です。 ## Debian 12 (正式サポート) diff --git a/doc/manuals/admin/build_source.md b/doc/manuals/admin/build_source.md index e6b6423386..0ece9b0e69 100644 --- a/doc/manuals/admin/build_source.md +++ b/doc/manuals/admin/build_source.md @@ -1,6 +1,6 @@ # Building from sources -Orion Context Broker reference distribution is Debian 12. This doesn't mean that the broker cannot be built in other distributions (actually, it can). However, note that the only "officially supported" procedure is the one for Debian 12. +Orion Context Broker reference distribution is Debian 12. This doesn't mean that the broker cannot be built in other distributions (actually, it can). This section may include indications on how to build in other distributions, just in the case it may help people that don't use Debian. However, note that the only "officially supported" procedure is the one for Debian 12. ## Debian 12 (officially supported) From 2aaa4e94e3ebe24d7dac6c526208b8f180ef73b7 Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Mon, 11 Sep 2023 21:22:39 +0900 Subject: [PATCH 06/10] ADD Alpine 3.16.x as distribution with old SSL version --- CMakeLists.txt | 2 +- scripts/build/osDistro.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b260ad8faa..42a046ec8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,7 @@ endif (${CMAKE_BUILD_TYPE} STREQUAL DEBUG) # Enables some some #ifdef in the code for compiling in old system # FIXME: cleanup OLD_SSL_VERSION_FORMAT stuff after consolidating the change to Debian 12+ -IF(${DISTRO} MATCHES "Debian_11.*") +IF((${DISTRO} MATCHES "Debian_11.*") OR (${DISTRO} MATCHES "Alpine_3.16.*")) ADD_DEFINITIONS(-DOLD_SSL_VERSION_FORMAT) ENDIF() diff --git a/scripts/build/osDistro.sh b/scripts/build/osDistro.sh index 7a02c2c33d..ce7fcc9140 100755 --- a/scripts/build/osDistro.sh +++ b/scripts/build/osDistro.sh @@ -26,6 +26,8 @@ suse_distro=$(cat /etc/SuSE-release 2> /dev/null | grep SUSE | cut -d ' ' -f 1-2 centos_distro=$(cat /etc/redhat-release 2> /dev/null | awk '{print $3}') +alpine_distro=$(cat /etc/alpine-release 2> /dev/null) + # In some cases (e.g. CentOS 7.x) we have found that the /etc/redhat-release content uses the following pattern: # # CentOS Linux release 7.2.1511 (Core) @@ -69,6 +71,9 @@ then elif [ "$centos_distro" != "" ] then distro=CentOS_$centos_distro +elif [ "$alpine_distro" != "" ] +then + distro=Alpine_$alpine_distro fi echo -n $distro From 39aac514efd17dea0fde93e8f4f9da100e343557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Mon, 11 Sep 2023 15:04:34 +0200 Subject: [PATCH 07/10] FIX improve documentation about building Orion --- doc/manuals/admin/build_source.md | 2 ++ docker/README.md | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/manuals/admin/build_source.md b/doc/manuals/admin/build_source.md index 0ece9b0e69..38bbca42cc 100644 --- a/doc/manuals/admin/build_source.md +++ b/doc/manuals/admin/build_source.md @@ -2,6 +2,8 @@ Orion Context Broker reference distribution is Debian 12. This doesn't mean that the broker cannot be built in other distributions (actually, it can). This section may include indications on how to build in other distributions, just in the case it may help people that don't use Debian. However, note that the only "officially supported" procedure is the one for Debian 12. +You can also have a look to [3.1 Building in not official distributions](../../../docker/README.md#31-building-in-not-official-distributions) section in the Docker documentation to check how to build Docker containers images in distributions other than the official one. + ## Debian 12 (officially supported) The Orion Context Broker uses the following libraries as build dependencies: diff --git a/docker/README.md b/docker/README.md index 58228b0b51..18e03bfe88 100644 --- a/docker/README.md +++ b/docker/README.md @@ -124,7 +124,7 @@ Check that everything works with The parameter `-t orion` in the `docker build` command gives the image a name. This name could be anything, or even include an organization like `-t org/fiware-orion`. This name is later used to run the container based on the image. -Two Dockerfiles are provided for step 3 above: the official one (`Dockefile` itself) based in Debian and `Dockefile.alpine`, which is not official but in can be useful as starting point if you want to use Alpine as base distribution. +Two Dockerfiles are provided for step 3 above: the official one (`Dockefile` itself) based in Debian and `Dockefile.alpine`, which is not official but in can be useful as starting point if you want to use [Alpine](https://www.alpinelinux.org/) as base distribution. The parameter `--build-arg` in the `docker build` can be set build-time variables. @@ -137,6 +137,14 @@ The parameter `--build-arg` in the `docker build` can be set build-time variable If you want to know more about images and the building process you can find it in [Docker's documentation](https://docs.docker.com/userguide/dockerimages/). +### 3.1 Building in not official distributions + +As explained in the [requirements section of the installation documentation](../doc/manuals/admin/install.md#requirements), Debian 12 is the only officially supported +distribution. However, the following commands have been tested to build Docker containers based in alternative distributions: + +* Ubuntu 22.04 TLS: `docker build -t orion-ubuntu22.04 --build-arg IMAGE_NAME=ubuntu --build-arg IMAGE_TAG=22.04 --build-arg CLEAN_DEV_TOOLS=0` +* Alpine 3.16.0: `docker build -t orion-alpine3.16 -f Dockerfile.alpine` + ## 4. Other info Things to keep in mind while working with docker containers and Orion Context Broker. From a74bc6d23b31243b258cb02d1796d0c00037a078 Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Mon, 11 Sep 2023 22:26:16 +0900 Subject: [PATCH 08/10] Fix typos --- docker/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index 18e03bfe88..b5f0d26da7 100644 --- a/docker/README.md +++ b/docker/README.md @@ -142,8 +142,8 @@ If you want to know more about images and the building process you can find it i As explained in the [requirements section of the installation documentation](../doc/manuals/admin/install.md#requirements), Debian 12 is the only officially supported distribution. However, the following commands have been tested to build Docker containers based in alternative distributions: -* Ubuntu 22.04 TLS: `docker build -t orion-ubuntu22.04 --build-arg IMAGE_NAME=ubuntu --build-arg IMAGE_TAG=22.04 --build-arg CLEAN_DEV_TOOLS=0` -* Alpine 3.16.0: `docker build -t orion-alpine3.16 -f Dockerfile.alpine` +* Ubuntu 22.04 LTS: `docker build -t orion-ubuntu22.04 --build-arg IMAGE_NAME=ubuntu --build-arg IMAGE_TAG=22.04 --build-arg CLEAN_DEV_TOOLS=0 .` +* Alpine 3.16.0: `docker build -t orion-alpine3.16 -f Dockerfile.alpine .` ## 4. Other info From 79d878cf99e519bb86a2063f45e367034e2403d6 Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Mon, 11 Sep 2023 22:26:50 +0900 Subject: [PATCH 09/10] (JP) FIX improve documentation about building Orion (#4426) --- doc/manuals.jp/admin/build_source.md | 2 ++ docker/README.jp.md | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/manuals.jp/admin/build_source.md b/doc/manuals.jp/admin/build_source.md index 26850636db..ee4a300150 100644 --- a/doc/manuals.jp/admin/build_source.md +++ b/doc/manuals.jp/admin/build_source.md @@ -2,6 +2,8 @@ Orion Context Broker のリファレンス配布は Debian 12 です。これは、broker を他のディストリビューションに組み込むことができないことを意味しません (実際には可能です)。このセクションには、Debian を使用していない人に役立つ可能性があるため、他のディストリビューションに組み込む方法に関する指示が含まれる場合があります。ただし、"公式にサポートされている" 唯一の手順は Debian 12 用の手順です。 +公式以外のディストリビューションで Docker コンテナ・イメージをビルドする方法は、Docker ドキュメントの [3.1 非公式ディストリビューションでのビルド](../../../docker/README.jp.md#31-building-in-not-official-distributions)・セクションで確認できます。 + ## Debian 12 (正式サポート) Orion Context Broker は、以下のライブラリをビルドの依存関係として使用します : diff --git a/docker/README.jp.md b/docker/README.jp.md index efce59448a..4f05de5cbb 100644 --- a/docker/README.jp.md +++ b/docker/README.jp.md @@ -122,7 +122,7 @@ Orion Context Broker を試してみたいし、データベースについて `docker build` コマンドのパラメータ `-t orion` は、イメージに名前を付けます。この名前は何でもかまいませんし、`-t org/fiware-orion` のような組織も含めています。この名前は後でイメージに基づいてコンテナを実行するために使用されます。 -上記のステップ3には、2つの Dockerfile が用意されています: Debian ベースの公式のもの (`Dockefile` 自体) と、公式ではありませんが、Alpine をベース・ディストリビューションとして使用する場合の開始点として役立つ `Dockefile.alpine` です。 +上記のステップ3には、2つの Dockerfile が用意されています: Debian ベースの公式のもの (`Dockefile` 自体) と、公式ではありませんが、[Alpine](https://www.alpinelinux.org/) をベース・ディストリビューションとして使用する場合の開始点として役立つ `Dockefile.alpine` です。 `docker build` のパラメータ `--build-arg` はビルド時の変数を設定できます。 @@ -135,6 +135,14 @@ Orion Context Broker を試してみたいし、データベースについて イメージとビルド・プロセスの詳細については、[Docker のドキュメント](https://docs.docker.com/userguide/dockerimages/)を参照してください。 + +### 3.1 非公式ディストリビューションでのビルド + +[インストール・ドキュメントの要件セクション](../doc/manuals.jp/admin/install.md#requirements)で説明されているように、Debian 12 は公式にサポートされている唯一のディストリビューションです。ただし、次のコマンドは、代替ディストリビューションをベースとする Docker コンテナを構築するためにテストされています。 + +* Ubuntu 22.04 LTS: `docker build -t orion-ubuntu22.04 --build-arg IMAGE_NAME=ubuntu --build-arg IMAGE_TAG=22.04 --build-arg CLEAN_DEV_TOOLS=0 .` +* Alpine 3.16.0: `docker build -t orion-alpine3.16 -f Dockerfile.alpine .` + ## 4. その他の情報 Docker コンテナと Orion Context Broker を操作する際に留意すべき事項です。 From c4dc07203d407ea9dca36baab6f045e04b6c5c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Wed, 13 Sep 2023 13:29:19 +0200 Subject: [PATCH 10/10] FIX missplace delay in test file --- ...t_ngsi_mapping_constant_attribute_compound.test | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/functionalTest/cases/4085_custom_notifications_ngsi_payload/custom_notification_mqtt_ngsi_mapping_constant_attribute_compound.test b/test/functionalTest/cases/4085_custom_notifications_ngsi_payload/custom_notification_mqtt_ngsi_mapping_constant_attribute_compound.test index 59271fef39..b21d09da16 100644 --- a/test/functionalTest/cases/4085_custom_notifications_ngsi_payload/custom_notification_mqtt_ngsi_mapping_constant_attribute_compound.test +++ b/test/functionalTest/cases/4085_custom_notifications_ngsi_payload/custom_notification_mqtt_ngsi_mapping_constant_attribute_compound.test @@ -120,13 +120,6 @@ echo echo -echo "04. Dump accumulator and see two notifications with A and B with compound values" -echo "================================================================================" -accumulatorDump -echo -echo - - # This delay before asking for accumulator dump was introduced when we # changed from ubuntu-18.04 to ubuntu-22.04 in GitActions # in PR https://github.com/telefonicaid/fiware-orion/pull/4302. For some @@ -136,6 +129,13 @@ echo sleep 0.75s +echo "04. Dump accumulator and see two notifications with A and B with compound values" +echo "================================================================================" +accumulatorDump +echo +echo + + --REGEXPECT-- 01. Create custom sub1 with constant ngsi attribute A and B with compound values ================================================================================