Debian package: Difference between revisions

From Aquarium-Control
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 86: Line 86:
* password
* password


The script will:
The script:
* create the database using the desired database name
* creates the database using the desired database name
* import the SQL dump to the database
* imports the SQL dump to the database
* create the SQL user with the corresponding user name and password
* creates the SQL user with the corresponding user name and password
* grant all privileges on the database to the user
* grants all privileges on the database to the user
* update the main control configuration file with the database name, user name and password
* updates the main control configuration file with the database name, user name and password
* updates the db.php with the database name, user name and password


== Database update ==
== Database update ==
Line 109: Line 110:
This table needs to be updated with the hash of the executable.
This table needs to be updated with the hash of the executable.
When executing the main control with the parameter <code>--version</code>, the program will inform the version and the hash:
When executing the main control with the parameter <code>--version</code>, the program will inform the version and the hash:
<code>
<pre>
pi@raspberrypi:/var/www/html $ aquarium_control --version
pi@raspberrypi:/var/www/html $ aquarium_control --version
[2026-01-01 15:58:04.558 +01:00 INFO aquarium_control::utilities::version_information] path of this executable is: /usr/local/bin/aquarium_control
[2026-01-01 15:58:04.558 +01:00 INFO aquarium_control::utilities::version_information] path of this executable is: /usr/local/bin/aquarium_control
Line 117: Line 118:
   Build: 1
   Build: 1
   Hash:  7066cbf85e2fa71b47d984b7da09d791a3003675a9a8f16ea16ee63d3487b14e
   Hash:  7066cbf85e2fa71b47d984b7da09d791a3003675a9a8f16ea16ee63d3487b14e
</code>
</pre>
 
== Message queue creation ==


== Setup of webpage ==
== Setup of webpage ==
Line 127: Line 126:
* <code>vue.global.prod.js</code> from <code>https://unpkg.com/vue@3/dist/vue.global.prod.js</code>
* <code>vue.global.prod.js</code> from <code>https://unpkg.com/vue@3/dist/vue.global.prod.js</code>


== Setup of main application configuration file ==
== Automatic start ==
The package configures the operating system to automatically start the application after booting up as described [[Automatic_start_by_using_systemd | here]].


== Setup of main application ==
== Instructions to the user ==
After executing above activities, the package installation informs the user that the corresponding database content needs to be created in case the database has been created during the installation of the package.


== Setup of terminal client ==
The installation refers to the <code>aquariumcontrol_database_setup.sh</code>.
 
== Instructions to the user ==

Latest revision as of 09:42, 2 January 2026

The Debian package shall check all dependencies and install the application on the Raspberry Pi.

Dependencies

Before starting the installation, the following dependencies are verified

  • Apache 2 with php
  • MariaDB
  • bcrypt (for running the database setup script)

Content

The Debian package contains the following data:

Debian package content
File name Description Origin Target directory
aquarium_control executable of main control target/release of main control repo /usr/local/bin
aquarium_control.toml configuration of main control config of main control repo /etc/aquarium_control
aquarium.sql database dump containing empty database database repo -
aquariumcontrol_database_cleanup_setup.sh script for setting up database maintenance database repo /usr/local/bin
aquariumcontrol_database_setup.sh script for initializing database database repo /usr/local/bin
aquarium_client executable of terminal application target/release of client repo /usr/local/bin
api.php main file of REST API REST API repo /var/www/html
db.php supporting file of REST API REST API repo /var/www/html
functions.php supporting file of REST API REST API repo /var/www/html
balling-manager.html dynamic webpage webpage repo /var/www/html
feed-manager.html dynamic webpage webpage repo /var/www/html
heating-manager.html dynamic webpage webpage repo /var/www/html
index.html dynamic webpage webpage repo /var/www/html
logs.html dynamic webpage webpage repo /var/www/html
refill-manager.html dynamic webpage webpage repo /var/www/html
schedule-manager.html dynamic webpage webpage repo /var/www/html
ventilation-manager.html dynamic webpage webpage repo /var/www/html
14550230.png image for dynamic webpage webpage repo /var/www/html/images
1843544.png image for dynamic webpage webpage repo /var/www/html/images
3173192.png image for dynamic webpage webpage repo /var/www/html/images
4236594.png image for dynamic webpage webpage repo /var/www/html/images
478544.png image for dynamic webpage webpage repo /var/www/html/images
5109802.png image for dynamic webpage webpage repo /var/www/html/images
748967.png image for dynamic webpage webpage repo /var/www/html/images
8593001.png image for dynamic webpage webpage repo /var/www/html/images
9602773.png image for dynamic webpage webpage repo /var/www/html/images
9803219.png image for dynamic webpage webpage repo /var/www/html/images

Except for the database dump, the files are copied to their target directories.

The database dump file is extracted to a temporary location and deleted after use.

Creation of directories and files

The Debian package creates

  • a directory and a set of files for the file-based communication as defined in the section [data_logger] of the configuration file.
  • an empty log file as defined in the section [logger] of the configuration file.

Database creation

During the installation of the package the user is asked if the database for the aquarium control already exists. If the user informs that the database does not exist, the user shall provide the following information:

  • desired database name
  • default user name
  • password

The script:

  • creates the database using the desired database name
  • imports the SQL dump to the database
  • creates the SQL user with the corresponding user name and password
  • grants all privileges on the database to the user
  • updates the main control configuration file with the database name, user name and password
  • updates the db.php with the database name, user name and password

Database update

The database contains a table version which includes the release number and a corresponding hash of the executable.

MariaDB [aquarium]> desc version;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| major | int(11)      | YES  |     | NULL    |       |
| minor | int(11)      | YES  |     | NULL    |       |
| build | int(11)      | YES  |     | NULL    |       |
| hash  | varchar(255) | YES  |     | NULL    |       |
+-------+--------------+------+-----+---------+-------+
4 rows in set (0.032 sec)

This table needs to be updated with the hash of the executable. When executing the main control with the parameter --version, the program will inform the version and the hash:

pi@raspberrypi:/var/www/html $ aquarium_control --version
[2026-01-01 15:58:04.558 +01:00 INFO aquarium_control::utilities::version_information] path of this executable is: /usr/local/bin/aquarium_control
Version information:
  Major: 0
  Minor: 16
  Build: 1
  Hash:  7066cbf85e2fa71b47d984b7da09d791a3003675a9a8f16ea16ee63d3487b14e

Setup of webpage

Additionally, to copying the corresponding php, html and png files from the package to the target directory, the script downloads a set of libraries to /var/www/html/js/:

Automatic start

The package configures the operating system to automatically start the application after booting up as described here.

Instructions to the user

After executing above activities, the package installation informs the user that the corresponding database content needs to be created in case the database has been created during the installation of the package.

The installation refers to the aquariumcontrol_database_setup.sh.