RPM#

RPMパッケージを使ってインストールする場合は以下の手順で行います。

必須要件#

この方法で構築する場合は、以下が必要です。

  • ハードウェア

    • AWS EC2インスタンスm5.large相当以上(CPU コア数2以上、メモリー8GB以上)

  • OS

    • Red Hat系 Linux(推奨 Rocky Linux 9)

注釈

本ページでは、インスタンス1つの構成で説明しています。

必要なソフトウェアのインストール#

以下のソフトウェアをインストールしてください。

APIサーバーに必要なソフトウェア#

Nginx

nginx: Linux packages の手順に従って、取得元リポジトリを設定した上で sudo yum install nginx でインストールします。

NodeJS 18系

nodesource/distributions: Enterprise Linux Based Distributions の手順に従って、 nodesource_setup.sh によりリポジトリを設定した上で sudo yum install -y nodejs でインストールします。

intdashサーバーの動作に必要なその他のソフトウェア#

PostgreSQL 14系~16系

Linux downloads (Red Hat family) の手順に従って、取得元リポジトリを設定した上で、 sudo dnf install -y postgresql16-server (16系の場合)を使ってインストールします。

初期化および自動起動の設定も行ってください。例:

sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
sudo systemctl enable postgresql-16
sudo systemctl start postgresql-16
InfluxDB v1.8系

Installing InfluxDB OSS - Red Hat & CentOS の手順に従って、取得元リポジトリを設定した上で、 sudo yum install influxdb-1.8.10 のように v1.8系 のバージョンを指定してインストールします。

NATS nats-server v2.9系

Installing a NATS Server の手順に従って、 nats-io/nats-server から v2.9系 の最新のRPMパッケージをダウンロードしてインストールします。

インストール手順の例(v2.9.25、amd64の場合):

curl -LO https://github.com/nats-io/nats-server/releases/download/v2.9.25/nats-server-v2.9.25-amd64.rpm
sudo dnf install ./nats-server-v2.9.25-amd64.rpm
nats コマンド(natscliとも呼ばれます)

The NATS Command Line Interface - Installation の手順に従って、 nats-io/natscli から最新のRPMパッケージをダウンロードしてインストールします。

インストール手順の例(v0.2.2、amd64の場合):

curl -LO https://github.com/nats-io/natscli/releases/download/v0.2.2/nats-0.2.2-amd64.rpm
sudo dnf install ./nats-0.2.2-amd64.rpm

注釈

本ページの手順では、シークレットの生成のために以下のコマンドを使用します。 これらのコマンドはサーバー上で実行する必要はなく、ローカル環境(手元のコンソール)で実行できるようにしておいてください。

  • pwgen コマンド

  • htpasswd コマンド

  • openssl コマンド

重要:パスワード等のランダム文字列の設定について#

本ページの手順では、いくつかの箇所でパスワード等のランダム文字列を設定します。 手順内に指定がある場合はその方法で文字列を生成してください。

ランダム文字列(10文字) のような指定がある場合は、任意の方法( pwgen を推奨)でランダムな文字列を生成して設定してください。

特に指定がない場合は、他で使っていない新しい文字列を設定してください。

pwgen 使用例:

# 10文字のランダムな文字列を1つ生成
pwgen -s -n 10 1

# 32文字のランダムな文字列を3つ生成
pwgen -s -n 32 3

intdashサーバーのインストール#

以下の手順でintdashサーバーをインストールします。

  1. intdashサーバーのパッケージを取得するためのリポジトリを設定します。 /etc/yum.repos.d/intdash.repo を以下のように作成してください。

    [intdash]
    name=intdash packages
    baseurl=https://repository.aptpod.jp/intdash/202404/linux/rpm
    enabled=1
    gpgcheck=0
  2. intdashサーバーを構成するアプリケーションをインストールします。

    dnf -y install \
     intdash-api-auth \
     intdash-api-broker \
     intdash-api-gateway \
     intdash-api-measurement \
     intdash-api-media \
     intdash-api-tenant \
     intdash-api-webhook \
     intdash-api-license \
     intdash-ffmpeg \
     intdash-nginx \
     intdash-web-admin-console \
     intdash-web-authentication \
     intdash-web-device-management-console \
     intdash-web-client-auth \
     intdash-web-client-auth-redirector \
     intdash-web-edge-finder \
     intdash-web-meas-hub \
     intdash-web-media-explorer \
     intdash-web-my-page \
     intdash-web-project-console \
     intdash-web-tenants \
     vm2m-data-viz \
     vm2m-data-viz-backend \
     vm2m-data-viz-plugins-core
    

データベースの設定#

ここではPostgreSQLとInfluxDBの設定を行います。

PostgreSQLの設定#

  1. PostgreSQLの設定をするために psql コマンドで対話型シェルを起動します。

    sudo -u postgres psql -d template1
    
  2. データベースを作成します。 また、PostgreSQLユーザー intdash と、そのパスワードを設定します。

    CREATE ROLE "intdash" WITH LOGIN ENCRYPTED PASSWORD '<新しいランダム文字列(10文字)>';
    CREATE DATABASE "intdash-api-tenant" OWNER "intdash";
    CREATE DATABASE "intdash-api-auth" OWNER "intdash";
    CREATE DATABASE "intdash-api-broker" OWNER "intdash";
    CREATE DATABASE "intdash-api-measurement" OWNER "intdash";
    CREATE DATABASE "intdash-api-media" OWNER "intdash";
    CREATE DATABASE "intdash-api-webhook" OWNER "intdash";
    CREATE DATABASE "intdash-api-license" OWNER "intdash";
    CREATE DATABASE "vm2m-data-viz-backend" OWNER "intdash";
    
  3. \q を入力して psql コマンドを終了します。

InfluxDBの設定#

次にInfluxDBの設定をします。

  1. 設定ファイル /etc/influxdb/influxdb.conf を以下のように編集します。この設定は必須ではありませんが、性能とセキュリティの向上のため、設定を推奨します。

    [data]
      ...
      index-version = "tsi1"
    
    [http]
      ...
      auth-enabled = true
    

    注釈

    時系列データが保存されるデータボリュームを変更する場合は、 /etc/influxdb/influxdb.conf を以下のように編集します。

    [meta]
      ...
      dir = "<任意のデータボリュームのディレクトリ>/meta"
    
    [data]
      ...
      dir = "<任意のデータボリュームのディレクトリ>/data"
    
      ...
      wal-dir = "<任意のデータボリュームのディレクトリ>/wal"
    
  2. InfluxDBを再起動します。

    sudo systemctl restart influxdb.service
    
  3. InfluxDBユーザー intdash とそのパスワードを設定します。 また、データベースを作成します。

    influx
    > CREATE USER intdash WITH PASSWORD '<新しいランダム文字列(10文字)>' WITH ALL PRIVILEGES;
    > auth
    username: intdash
    password: <直前のCREATE USERで設定したパスワード>
    > CREATE DATABASE "intdash-measurement" WITH SHARD DURATION 1h;
    > exit
    

NATSの設定#

ここではNATSの設定を行います。

  1. nats コマンド (natscli) を使って、NATSユーザー用に設定するパスワードのBCryptハッシュを生成します。

    nats server passwd -p <新しいランダム文字列(22文字)>
    
  2. 設定ファイル /etc/nats-server.conf を以下のように作成し、NATSユーザー intdash とそのパスワードを設定します。

    listen: 0.0.0.0:4222
    jetstream {
      store_dir /var/lib/nats
    }
    authorization: {
        user: intdash,
        password: <手順1で生成したBCryptハッシュ>
    }
    
  3. nats-serverをsystemdで管理するため、Unitファイル /etc/systemd/system/nats-server.service を作成します。

    Unitファイルの内容は 公式リポジトリのnats-server.service を参考にしてください。

    起動対象のnats-server( /usr/bin/nats-server にインストールされているものとします)と設定ファイルは、Unitファイル内で以下のように指定します。

    ExecStart=/usr/bin/nats-server -c /etc/nats-server.conf
    
  4. 上記のUnitファイルは、ユーザー nats が起動する設定になっていますので、ユーザー nats を作成します。

    groupadd --system nats
    useradd --system --gid nats --home-dir /var/lib/nats --no-create-home --shell /sbin/nologin nats
    
    mkdir /var/lib/nats
    chown nats:nats /var/lib/nats
    
  5. nats-server を起動します。

    sudo systemctl daemon-reload
    sudo systemctl enable nats-server
    sudo systemctl start nats-server
    

intdashサーバー(フロントエンド)の設定#

ここでは、intdashサーバー(フロントエンド)の設定を行います。

ここでは例として以下のドメイン名と証明書ファイルを使用します。

項目

この説明で使用する例

intdash用のドメイン名

intdash.example.com

第三者認証局により発行されたSSLサーバー証明書(サーバー証明書と中間証明書が連結されたもの)

/etc/pki/intdash/certs/intdash.pem

SSLサーバー秘密鍵

/etc/pki/intdash/private/intdash.pem

注釈

intdash用ドメイン名は、組織で所有・管理しているドメイン名に対しサブドメインとして払い出す方法が一般的です。 その場合、例えば example.com を所有、管理している場合は、intdash用のドメイン名は intdash.example.com のようにします。

詳細については、組織のドメイン名管理者にご相談ください。

注釈

  • サーバー証明書は、SSL/TLS証明書とも呼ばれ、クライアントとサーバーの間の接続情報を保護し、第三者からの読み取りや変更を防ぐものです。

  • セキュリティ上の理由から、自己署名証明書ではなく第三者認証局により発行された証明書を使用してください。自己署名証明書を使用すると、クライアントからの接続時にサーバー証明書の検証に失敗します。サーバー証明書の検証をスキップした場合、通信相手の認証をしないことになり、中間者攻撃等による盗聴・改ざんを許すことになります。

  • 証明書を発行する認証局の例としては、Cybertrust、DigiCert、Let's Encrypt等があります。 Let's Encrypt では、無料で証明書の発行を受けることができます。

まず、Nginxの設定をします。

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/nginx/conf.d
    
  2. テキストエディターで設定ファイルを開きます。

    vi intdash.conf
    
  3. ポート80(HTTP)とポート443(HTTPS)の server_name にintdash用ホスト名を設定します。

    ...
    
    server {
        listen       80;
        listen       [::]:80;
        server_name  intdash.example.com;   <----
    
        ...
    }
    
    server {
        listen       443 ssl http2;
        listen       [::]:443 ssl http2;
        server_name  intdash.example.com;   <----
    
        ...
    
    ...
    
  4. 同じ設定ファイル内で、ポート443の ssl_certificate にサーバー証明書、 ssl_certificate_key にサーバー証明書の秘密鍵を指定します。その後設定ファイルを閉じます。

    ...
    
    server {
        listen       443 ssl http2;
        listen       [::]:443 ssl http2;
    
        ...
    
        ssl_certificate     /etc/pki/intdash/certs/intdash.pem;        <----
        ssl_certificate_key /etc/pki/intdash/private/intdash.pem;      <----
    
    ...
    

次にintdash の OAuth2 認証におけるウェブ UI クライアントの認証を担う UI サービス(intdash-web-client-auth) の設定を行います。

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/sysconfig
    
  2. テキストエディターで設定ファイルを開きます。

    vi intdash-web-client-auth
    
  3. AUTHORIZATION_HOST と CLIENT_HOST にドメイン名を入力します。その後、設定ファイルを閉じます。

    ...
    AUTHORIZATION_HOST="https://intdash.example.com"   <----
    CLIENT_HOST="https://intdash.example.com"          <----
    ...
    

次に intdash の認証関連の UI サービス(intdash-web-authentication)の設定を行います。

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/sysconfig
    
  2. テキストエディターで設定ファイルを開きます。

    vi intdash-web-authentication
    
  3. CLIENT_HOST にドメイン名を入力します。その後、設定ファイルを閉じます。

    ...
    CLIENT_HOST="https://intdash.example.com"   <----
    ...
    

intdashサーバー(バックエンド)の設定#

ここでは、intdashサーバー(バックエンド)の設定を行います。

以降バックエンドサービスを一つずつ設定していきます。設定するサービスは次のとおりです。

  • Tenant Service(intdash-api-tenant)

  • Authentication Service(intdash-api-auth)

  • Broker Service(intdash-api-broker)

  • Measurement Service(intdash-api-measurement)

  • Media Service(intdash-api-media)

  • Webhook Service(intdash-api-webhook)

  • License Service(intdash-api-license)

  • VM2M Data Visualizer Backend Service(vm2m-data-viz-backend)

  • Tenant UI(intdash-web-tenants)

Tenant Service#

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/intdash
    
  2. テキストエディターで設定ファイルを開きます。

    vi intdashd.conf
    
  3. 設定ファイルの次の箇所を設定します。ここでは主に次の内容を設定します。

    • PostgreSQLへの接続設定

    • テナント管理APIの認証情報設定

    Tip

    本ページでは、1つのインスタンスによる構成を前提としているため、接続先のPostgreSQL、NATS、InfluxDB(設定ファイル内で ★ で示した部分、以降の手順でも同様)はデフォルトのとおりで構いません。 PostgreSQL、NATS、InfluxDBを他のインスタンスで稼働させる場合は接続先を変更する必要があります。

    ...
    [postgres]
      ...
      username = 'intdash'
      password = '' <---- 上述「PostgreSQLの設定」でPostgreSQLユーザー'intdash'に設定したパスワード
      address = '/var/run/postgresql' <---- ★
      ...
    
    [jet-stream]
      url = 'nats://127.0.0.1:4222'' <---- ★
      username = 'intdash'
      password = '' <---- 上述「NATSの設定」でNATSユーザー'intdash'に設定したパスワード(Bcryptハッシュ化する前のもの)
      ...
    
    [tenant]
      enable = true        <---- trueにする
      ...
      basic-password = ''  <---- テナント管理APIのパスワードとして使用する新しいランダム文字列(10文字)
      ...
    

Authentication Service#

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/intdash
    
  2. テキストエディターで設定ファイルを開きます。

    vi authd.conf
    
  3. 設定ファイルの次の箇所を設定します。ここでは主に次の内容を設定します。

    • PostgreSQL,NATSなど各種ミドルウェアへの接続設定

    • WebアプリケーションのURL設定(ホスト名の変更)

    ...
    [postgres]
      ...
      username = 'intdash'
      password = '' <---- 上述「PostgreSQLの設定」でPostgreSQLユーザー'intdash'に設定したパスワード
      address = '/var/run/postgresql'  <---- ★
      ...
    
    ...
    [jet-stream]
      url = 'nats://127.0.0.1:4222'  <---- ★
      username = 'intdash'
      password = '' <---- 上述「NATSの設定」でNATSユーザー'intdash'に設定したパスワード(Bcryptハッシュ化する前のもの)
      ...
    
    ...
    [oauth2]
      issuer-base = 'https://intdash.example.com' <---- ホスト名を修正する
      sign-in-page-url = 'https://intdash.example.com/console/signin/' <---- ホスト名を修正する
      change-password-page-url = 'https://intdash.example.com/oauth2/authorization/api/password-change' <---- ホスト名を修正する
      web-client-redirect-base-urls = [
       'https://intdash.example.com'  <---- ホスト名を修正する
       ...
      ]
    
    ...
    [user-email]
      ...
      verification-page-url = 'https://intdash.example.com/console/email/activate/' <---- ホスト名を修正する
      ...
    
    ...
    [user-password]
      ...
      recovery-page-url = 'https://intdash.example.com' <---- ホスト名を修正する。
      ...
    
    ...
    [license]
      type = 'online'
      [license.online]
        access-key-id = ''       <---- ライセンスアクティベーションのアクセスキーID
        secret-access-key = ''   <---- ライセンスアクティベーションのシークレットアクセスキー
    

    重要

    [jet-stream] セクションで入力する「NATSのパスワード」は、 NATSの設定 で決めたパスワード(BCryptでハッシュ化する前の、パスワードそのもの)です。

    以下、各サービスの [nats] セクションや [jet-stream] セクションでは同様にしてください。

  4. RSA秘密鍵を生成します。ここでは openssl を使用します。

    openssl genrsa 2048 2>/dev/null | sed -z -e 's/\n/\\n/g'
    
  5. 上記で生成した文字列を authd.conf に設定します。

    ...
    [keys]
      [keys.oauth2-rsa]
        [keys.oauth2-rsa.private-key]
          [keys.oauth2-rsa.private-key.static]
            ...
            key = "" <----  前の手順で出力されたRSA秘密鍵を貼り付ける。必ずダブルクオーテーションを使用してください。
    
    ...
    [keys.oauth2-hmac]
      ...
      hash-secret = '' <---- 新しいランダム文字列(32文字)
      rotated-hash-secrets = [""]
      ...
    
    ...
    [keys.api-token]
      ...
      hash-secret = '' <---- 新しいランダム文字列(32文字)
      rotated-hash-secrets = [""]
      ...
    
    ...
    [keys.password-recovery]
      ...
      hash-secret = '' <---- 新しいランダム文字列(32文字)
      rotated-hash-secrets = [""]
      ...
    
    ...
    [keys.email-verification]
      ...
      hash-secret = '' <---- 新しいランダム文字列(32文字)
      rotated-hash-secrets = [""]
      ...
    

    注釈

    • keys.oauth2-rsa.private-key.static の設定は以下のようになります。 この形式で設定する場合、必ず ダブルクオーテーション を使用してください。

      [keys]
        [keys.oauth2-rsa]
          [keys.oauth2-rsa.private-key]
            driver = 'static'
            [keys.oauth2-rsa.private-key.static]
              ...
              key = "-----BEGIN RSA PRIVATE KEY-----\nMIIEexample.example.....\n-----END RSA PRIVATE KEY-----\n"
      
    • [keys.oauth2-rsa.private-key] サブセクションでは、 driver = "file" を指定することで、PEM形式の文字列を直接書き込む代わりにRSA秘密鍵のファイルパスを指定して読み込ませることも可能です。

      秘密鍵ファイルはintdashユーザーで動作するintdash-api-authサービスから読み込まれます。intdashユーザーからの読み込みができるように、ファイルのパーミッション、オーナー、グループを設定してください。

      [keys]
        [keys.oauth2-rsa]
          [keys.oauth2-rsa.private-key]
            driver = "file"   <---- "file"を指定
            [keys.oauth2-rsa.private-key.file]   <---- 末尾はfile
              path = "/etc/intdash/authd.d/keys/oauth2_rsa"   <---- RSA秘密鍵のファイルパス
      

    注釈

    [keys] セクションで上記の項目を設定しない場合、intdash-api-authサービスが再起動されるたびに、認証用のJWT秘密鍵やRSA秘密鍵が自動生成されます。 これにより、サービスを再起動するたびに以下のことが起こります。

    • APIトークンが無効になる

    • ユーザーのログイン状態がリセットされる

    • メールアドレス確認用のメールに含まれるリンクが無効になる

    このような問題を防ぐため、事前に設定することを推奨します。

Broker Service#

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/intdash
    
  2. テキストエディターで設定ファイルを開きます。

    vi brokerd.conf
    
  3. 設定ファイルの次の箇所を設定します。ここでは主に次の内容を設定します。

    • PostgreSQL、NATSなど各種ミドルウェアへの接続設定

    • シークレット情報

    ...
    [nats]
      url = 'nats://127.0.0.1:4222'  <---- ★
      username = 'intdash'
      password = '' <---- 上述「NATSの設定」でNATSユーザー'intdash'に設定したパスワード(Bcryptハッシュ化する前のもの)
      ...
    
    ...
    [postgres]
      ...
      username = 'intdash'
      password = '' <---- 上述「PostgreSQLの設定」でPostgreSQLユーザー'intdash'に設定したパスワード
      address = '/var/run/postgresql'  <---- ★
      ...
    
    ...
    [ticket]
      secret = '' <---- iSCPプロトコルの接続認証用シークレットとして使用する新しいランダム文字列(32文字)
    
    ...
    [jet-stream]
      url = 'nats://127.0.0.1:4222' <---- ★
      username = 'intdash'
      password = '' <---- 上述「NATSの設定」でNATSユーザー'intdash'に設定したパスワード(Bcryptハッシュ化する前のもの)
      ...
    

Measurement Service#

  1. (デフォルト値から変更する場合のみ) 計測アップロード機能で使用するデータ保存用ディレクトリを作成します。

    mkdir -p <任意のディレクトリ。例 /data/intdash/upload>
    chown intdash:intdash <作成したディレクトリ>
    chmod 700 <作成したディレクトリ>
    
  2. 設定ファイルのディレクトリに移動します。

    cd /etc/intdash
    
  3. テキストエディターで設定ファイル measurementd.conf を開きます。

    vi measurementd.conf
    
  4. 設定ファイルの次の箇所を設定します。ここでは主に次の内容を設定します。

    • PostgreSQL、NATSなど各種ミドルウェアへの接続設定

    • シークレット情報

    • 計測アップロード機能で使用する一時ファイルの保存先

    ...
    [postgres]
      ...
      username = 'intdash'
      password = '' <---- 上述「PostgreSQLの設定」でPostgreSQLユーザー'intdash'に設定したパスワード
      address = '/var/run/postgresql' <---- ★
      ...
    
    ...
    [jet-stream]
      url = 'nats://127.0.0.1:4222' <---- ★
      username = 'intdash'
      password = '' <---- 上述「NATSの設定」でNATSユーザー'intdash'に設定したパスワード(Bcryptハッシュ化する前のもの)
      ...
    
    ...
    [influxdbs]
      [influxdbs.0]
        ...
        address = 'http://127.0.0.1:8086' <---- ★
        username = 'intdash'
        password = '' <---- 上述「InfluxDBの設定」でInfluxDBユーザー'intdash'に設定したパスワード
        ...
    
    ...
    [upload]
      ...
      [upload.local-storage]
        ...
        directory = '/var/lib/intdash/upload' <---- (変更する場合のみ)手順1で作成したデータ保存用ディレクトリ
    

注釈

計測アップロード機能では、デフォルトではファイルシステム上に保存されます(この場合、上の例のように、保存先を directory で指定します)。

ただし、設定を変更すればS3に保存することも可能です。 保守の観点からは、S3(またはS3互換のOSS)の使用を推奨します。 設定方法については Measurement Service の [upload] を参照してください。

Media Service#

  1. (デフォルト値から変更する場合のみ) メディアデータ(動画データなど)の保存用ディレクトリを作成します。

    mkdir -p <任意のディレクトリ。例 /data/intdash/media/hls>
    chown intdash:intdash <作成したディレクトリ>
    chmod 700 <作成したディレクトリ>
    
  2. 設定ファイルのディレクトリに移動します。

    cd /etc/intdash
    
  3. テキストエディターで設定ファイル mediad.toml を開きます。

    vi mediad.toml
    
  4. 設定ファイルを次のように編集します。

    • PostgreSQL、NATSなど各種ミドルウェアへの接続設定

    • メディアデータの保存用ディレクトリ情報

    ...
    [postgres]
      ...
      username = 'intdash'
      password = '' <---- 上述「PostgreSQLの設定」でPostgreSQLユーザー'intdash'に設定したパスワード
      address = '/var/run/postgresql' <---- ★
      ...
    
    ...
    [media-filmed]
      ...
      [media-filmed.storage]
        ...
        [media-filmed.storage.local]
          ...
          base-dir = '/var/lib/intdash/media/hls' <---- (変更する場合のみ)手順1で作成したメディアデータ保存用ディレクトリ
          ...
    
      ...
      [media-filmed.jet-stream]
        url = 'nats://127.0.0.1:4222' <---- ★
        username = 'intdash'
        password = '' <---- 上述「NATSの設定」でNATSユーザー'intdash'に設定したパスワード(Bcryptハッシュ化する前のもの)
        ...
    

注釈

メディアデータは、デフォルトではファイルシステム上に保存されます(この場合、上の例のように、保存先を base-dir で指定します)。

ただし、設定を変更すればS3に保存することも可能です。 保守の観点からは、S3(またはS3互換のOSS)の使用を推奨します。 設定方法については Media Service の [media-filmed] を参照してください。

Webhook Service#

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/intdash
    
  2. テキストエディターで設定ファイル webhookd.conf を開きます。

    vi webhookd.conf
    
  3. 設定ファイルを次のように編集します。

    ...
    [postgres]
      ...
      username = 'intdash'
      password = '' <---- 上述「PostgreSQLの設定」でPostgreSQLユーザー'intdash'に設定したパスワード
      address = '/var/run/postgresql' <---- ★
      ...
    
    [jet-stream]
      ...
      url = 'nats://127.0.0.1:4222' <---- ★
      username = 'intdash'
      password = '' <---- 上述「NATSの設定」でNATSユーザー'intdash'に設定したパスワード(Bcryptハッシュ化する前のもの)
      ...
    
    [cipher]
      key = '' <---- Webhookのシークレット暗号化キーとして使用する新しいランダム文字列(32文字)
    

License Service#

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/intdash
    
  2. テキストエディターで設定ファイル licensed.conf を開きます。

    vi licensed.conf
    
  3. 設定ファイルを次のように編集します。

    ...
    [postgres]
      ...
      username = 'intdash'
      password = '' <---- 上述「PostgreSQLの設定」でPostgreSQLユーザー'intdash'に設定したパスワード
      address = '/var/run/postgresql' <---- ★
      ...
    
    [jet-stream]
      ...
      url = 'nats://127.0.0.1:4222' <---- ★
      username = 'intdash'
      password = '' <---- 上述「NATSの設定」でNATSユーザー'intdash'に設定したパスワード(Bcryptハッシュ化する前のもの)
    
  4. License Service APIのパスワードを設定します。ここでは htpasswd を使用します。

    htpasswd -nb <任意のユーザー名> <License Service APIのパスワードとして使用する新しいランダム文字列(10文字)>
    
  5. traefikの設定ファイル ./traefik.d/license.toml を開きます。

    vi ./traefik.d/license.toml
    
  6. 認証設定を行います。

    ...
    [http]
      [http.middlewares]
        [http.middlewares.license-auth.basicAuth]
          users = [
            "", <---- htpasswdで出力された文字列
          ]
          ...
    

VM2M Data Visualizer Backend Service#

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/vm2m-data-viz-backend
    
  2. テキストエディターで設定ファイル datavizd.conf を開きます。

    vi datavizd.conf
    
  3. 設定ファイルを次のように編集します。

    ...
    [postgres]
      ...
      username = 'intdash'
      password = '' <---- 上述「PostgreSQLの設定」でPostgreSQLユーザー'intdash'に設定したパスワード
      address = '/var/run/postgresql' <---- ★
      ...
    

Tenant UI(テナント管理UI)#

  1. 設定ファイルのディレクトリに移動します。

    cd /etc/intdash-web-tenants
    
  2. テキストエディターで設定ファイルを開きます。

    vi tenantd.conf
    
  3. 設定ファイルを次のように編集します。

    ...
    
    [private-intdash-api]
      [private-intdash-api.basic-auth]
        ...
        password = '' <----  テナント管理APIの認証情報設定(intdashd.confのtenantセクション)で設定したbasic-password
    
    [basic-auth]
      password = ''   <----  Tenant UIでパスワードとして使用する新しいランダム文字列(10文字)
    
    [csrf]
      encryption-key = '' <----  Tenant UIのCSRF対策用暗号化キーとして使用する新しいランダム文字列(32文字)
    

データベースのマイグレーション#

次のコマンドでデータベースのマイグレーションを実行します。

sudo -u intdash intdashd db migrate -c /etc/intdash/intdashd.conf
sudo -u intdash authd db migrate -c /etc/intdash/authd.conf
sudo -u intdash brokerd db migrate -c /etc/intdash/brokerd.conf
sudo -u intdash measurementd db migrate -c /etc/intdash/measurementd.conf
sudo -u intdash mediad db migrate -c /etc/intdash/mediad.toml
sudo -u intdash webhookd db migrate -c /etc/intdash/webhookd.conf
sudo -u intdash licensed db migrate -c /etc/intdash/licensed.conf
sudo -u intdash datavizd db migrate -c /etc/vm2m-data-viz-backend/datavizd.conf

上の authd db migrate ... コマンドにより、以下のように初期ユーザー名 (user_name) とパスワード (user_password) が出力されます。 初回ログインで使用するので必ず控えておいてください。

{"level":"info","ts":"2024-07-02T01:32:55.678157511Z","caller":"db/migrate_data.go:129",
"msg":"Initialized bootstrap user: tenant_id[00000000-0000-0000-0000-000000000000] user_name[<USER_NAME>] user_password[<PASSWORD>]"}

注釈

もし user_name と user_password が出力されない場合は、すでに一度マイグレーションが完了していた可能性があります。 その場合は、以下の手順でマイグレーションをやり直すことができます。

警告

この手順では、ユーザーやエッジの情報がすべて削除されます。

  1. Authentication Serviceのデータベースのレコードをすべて削除します。

    sudo -u intdash authd db migrate -c /etc/intdash/authd.conf 0
    

    確認のためホスト名を入力するプロンプトが表示されたら、表示に従ってホスト名を入力します。

    Press host name. ** CAUTION CONFIRM INVENTORY HOSTNAME **
    Current Host name is `<手入力すべきhost名の文字列>`
    
  2. 再度マイグレーションを実行します。

    sudo -u intdash authd db migrate -c /etc/intdash/authd.conf
    

これにより、初期ユーザー名とパスワードが出力されます。

各intdashサービスの起動#

intdashの各マイクロサービスを起動します。

  1. SSHでAPIサーバーに接続し、各サービスを有効化するために以下のコマンドを実行します。

    sudo systemctl enable nginx.service
    sudo systemctl enable intdash-api-auth.service
    sudo systemctl enable intdash-api-broker.service
    sudo systemctl enable intdash-api-gateway.service
    sudo systemctl enable intdash-api-measurement.service
    sudo systemctl enable intdash-api-media.service
    sudo systemctl enable intdash-api-tenant.service
    sudo systemctl enable intdash-api-webhook.service
    sudo systemctl enable intdash-api-license.service
    sudo systemctl enable intdash-web-admin-console.service
    sudo systemctl enable intdash-web-authentication.service
    sudo systemctl enable intdash-web-device-management-console.service
    sudo systemctl enable intdash-web-client-auth-redirector.service
    sudo systemctl enable intdash-web-client-auth.service
    sudo systemctl enable intdash-web-edge-finder.service
    sudo systemctl enable intdash-web-meas-hub.service
    sudo systemctl enable intdash-web-media-explorer.service
    sudo systemctl enable intdash-web-my-page.service
    sudo systemctl enable intdash-web-project-console.service
    sudo systemctl enable intdash-web-tenants.service
    sudo systemctl enable vm2m-data-viz-backend.service
    
  2. 各サービスを起動するために以下のコマンドを実行します。

    sudo systemctl start nginx.service
    sudo systemctl start intdash-api-auth.service
    sudo systemctl start intdash-api-broker.service
    sudo systemctl start intdash-api-gateway.service
    sudo systemctl start intdash-api-measurement.service
    sudo systemctl start intdash-api-media.service
    sudo systemctl start intdash-api-tenant.service
    sudo systemctl start intdash-api-webhook.service
    sudo systemctl start intdash-api-license.service
    sudo systemctl start intdash-web-admin-console.service
    sudo systemctl start intdash-web-authentication.service
    sudo systemctl start intdash-web-device-management-console.service
    sudo systemctl start intdash-web-client-auth-redirector.service
    sudo systemctl start intdash-web-client-auth.service
    sudo systemctl start intdash-web-edge-finder.service
    sudo systemctl start intdash-web-meas-hub.service
    sudo systemctl start intdash-web-media-explorer.service
    sudo systemctl start intdash-web-my-page.service
    sudo systemctl start intdash-web-project-console.service
    sudo systemctl start intdash-web-tenants.service
    sudo systemctl start vm2m-data-viz-backend.service
    
  3. 起動後、各サービスが正常に起動していることを確認します。

    sudo systemctl status nginx.service
    sudo systemctl status intdash-api-auth.service
    sudo systemctl status intdash-api-broker.service
    sudo systemctl status intdash-api-gateway.service
    sudo systemctl status intdash-api-measurement.service
    sudo systemctl status intdash-api-media.service
    sudo systemctl status intdash-api-tenant.service
    sudo systemctl status intdash-api-webhook.service
    sudo systemctl status intdash-api-license.service
    sudo systemctl status intdash-web-admin-console.service
    sudo systemctl status intdash-web-authentication.service
    sudo systemctl status intdash-web-device-management-console.service
    sudo systemctl status intdash-web-client-auth-redirector.service
    sudo systemctl status intdash-web-client-auth.service
    sudo systemctl status intdash-web-edge-finder.service
    sudo systemctl status intdash-web-meas-hub.service
    sudo systemctl status intdash-web-media-explorer.service
    sudo systemctl status intdash-web-my-page.service
    sudo systemctl status intdash-web-project-console.service
    sudo systemctl status intdash-web-tenants.service
    sudo systemctl status vm2m-data-viz-backend.service
    

    正常に動作していれば Active: active (running) と表示されます。

メールサーバーと通知メール送信元を設定する#

パスワードを忘れた場合の認証の際などに、intdashサーバーが使用者にメールを送信することがあります。その際に使用する送信元のメールアドレスとSMTPサーバーを設定します。

  1. SSHでintdashサーバーに接続し、設定ファイルのディレクトリに移動します。

    cd /etc/intdash
    
  2. テキストエディターで設定ファイルを開きます。

    vi authd.conf
    
  3. [smtp]セクションにSMTPサーバーの情報と送信メールの情報を入力します。SMTPサーバーの情報はお使いの環境に合わせて Authentication Service を参照し、 設定してください。その後、設定ファイルを閉じます。

    [smtp]
     ...
     enable = true
     ...
     from = '<送信元として使用されるメールアドレス>'
     reply-to = '<Reply-toヘッダーに使用されるメールアドレス(設定は必須ではありません)>'
    
  4. 設定を反映させるため、以下のコマンドでintdash-api-authサービスを再起動します。

    sudo systemctl restart intdash-api-auth.service
    
  5. 再起動後、intdash-api-authが正常に起動していることを確認します。

    sudo systemctl status intdash-api-auth.service
    

    正常に動作していれば Active: active (running) と表示されます。

管理者ユーザーのアカウントを設定する#

初期状態では、「intdash」という名前の管理者ユーザーアカウントが存在します。 本セクションではこのアカウントのメールアドレスを設定します。

  1. ウェブブラウザーで https://intdash.example.com/console/me/ にアクセスします。

  2. サインイン画面が表示されたら、管理者ユーザー名 intdash と、さきほど設定した初期ユーザーパスワードでサインインします。

    ユーザー intdash のMy Pageが表示されます。

    ../../_images/image361.png

    図 350 My Page#

  3. [ユーザー情報] > 「メールアドレス」 で管理者ユーザーのメールアドレスを入力し、[追加]をクリックします。

    ../../_images/image371.png

    図 351 メールアドレスを設定#

  4. 以下のメッセージが表示されます。メールアドレスが正しいことを確認し、[閉じる]をクリックします。メールアドレス宛に確認メールが送信されます。

    ../../_images/image441.png

    図 352 メールアドレスを確認#

  5. お使いのメールクライアントで確認メールを開き、メールに記載されているアクティベーション用URLにアクセスします。

    ../../_images/image541.png
  6. 再度、My Pageの[ユーザー情報]を開き、メールアドレスが以下のように[確認済み]となっていれば設定は完了です。

    ../../_images/image80.png

    図 353 メールアドレス確認済み#

Google MapsのAPIキーを設定する(Google Mapsを使用する場合のみ)#

Data VisualizerでGoogle Mapsビジュアルパーツを使用するためには、Google MapsのAPIキーをintdashサーバーに設定しておく必要があります。

注釈

  • Data Visualizerでは、Open Street Mapを使用することもできます。Open Street Mapを使用する場合、ここでAPIキーを設定する必要はありません。

  • Google Mapsの詳細に関しては Google Maps公式サイト を参照してください。

../../_images/image711.png

図 354 Google Mapsビジュアルパーツ#

Google MapsのAPIキーの設定は、intdashサーバーの設定用APIに管理者ユーザーとしてアクセスして行います。

  1. SSHでintdashサーバーに接続します。

  2. 設定ファイルのディレクトリに移動します

    cd /etc/vm2m-data-viz-backend/vm2m-2nd-variables
    
  3. JSONファイルを編集します。

    vi 100.vm2m-2nd-variables.json
    
  4. 次の内容で更新します。

    {
      "googleMapsApiClientID":"",
      "googleMapsApiKey":"<Google MapsのAPIキー>"
    }
    

    注釈

    APIキーではなくClient IDをお持ちの場合は、下記のように googleMapsApiClientID の値として入力してください。

    {
      "googleMapsApiClientID":"<Google MapsのClientID>",
      "googleMapsApiKey":""
    }
    
  5. vm2m-data-viz-backend サービスを再起動します。再起動されたタイミングで設定が反映されます。

    sudo systemctl restart vm2m-data-viz-backend.service