MxChartDB Installation and Update

For data storage, MxChartDB uses a SQLite database with its own web server engine connected via HTTP API. Due to this structure, the database and the API can be installed anywhere on the local system or on another computer in the network.

However, the included scripts are written for Debian-based Linux systems, such as Raspberry Pi OS or Ubuntu.

Installation Steps

A. Server-side Installation of Database and API

  1. Decide where to install the database
  2. Installation
  3. Parameterization of the API
  4. Run the API
  5. User access of the API via HTTP
  6. Update the API
  7. Uninstallation of the API

B. Client-side Installation for ChartDB Modules and Browser Chart Viewing

  1. Parameterization

1. Decide where to install the database

MxChartDB uses SQLite3 as the database engine and Python3 with Flask for API. It can be installed on the ZWay server and on any computer reachable from ZWay via HTTP. It's as well installable on a Raspberry PI. But better on an USB drive or an external disk instead of the SD card.

2. Installation

Choose the root folder for the API installation on the server. Ensure that the user has all necessary rights for read, write and execute.
Copy the downloaded folder HTTP_API to the root folder and invoke the installation procedure:
      cd <root folder>/HTTP_API
      ./install_sqlite.bash
      
The installation procedure installs such a folder structure:
      <root folder>
              ├── HTTP_API    (folder for the database + API)
              │   ├── 11_get_procid.bash
              │   ├── 99_restart_API.bash
              │   ├── constants_template.py
              │   ├── install_sqlite.bash
              │   ├── MxChartDB_API.bash
              │   ├── MxChartDB_API.py
              │   ├── params.bash
              │   ├── requirements.txt
              │   └── uninstall.bash
              ├── log         (folder for API logfiles)
              │   └── ...
              └── python_env  (folder for local python modules)
                  └── ...';
      

3. Parameterization of the API

The parameterization is done with a text editor in the file constants.py in the HTTP_API folder. Here you define: client-ip addresses, port, API-username, password,... At least the ip addresses have to be changed. If the default port 5000 is to be changed, an entry must be made in the MxChartDB_API.bash file as well. Copy or rename the file constants_template.py to do this.

After each change in constants.py or MxChartDB_API.bash the API has to be restarted.

4. Run the API

Start and restart the API with:
      cd <root folder>/HTTP_API
      ./99_restart_API.bash
      
Get the status of the API with:
      cd <root folder>/HTTP_API
      ./11_get_procid.bash
      

5. User access of the API via HTTP

A survey of all HTTP API commands can be displayed with http//:<db_server>:5000/. Also administration of the database is possible

6. Update the API

Copy all files but constants.py of the downloded API-folder HTTP_API to your db installation. Check constants_template.py for any changes that may be necessary. Then restart the API.

7. Uninstallation of the API

Invoke the uninstallation procedure:
      cd <root folder>
      ./HTTP_API/uninstall.bash
      

8. Client-side installation for ChartDB modules and browser chart viewing

The parameterization is done with a text editor in the file constants.js in the ChartDB module folder htdocs. Here you define the access data for the db server: ip address, port, username, password,...

To do this, copy the file constants_template.js to constants.js.