Setup & deploy scripts for Cerebra

Setup script

https://pib-rocks.atlassian.net/browse/PR-105

This script setup-pib.sh can be found in this repository: https://github.com/pib-rocks/setup-pib

It’s assumed that the user running this script has “pib“ as a username and the operating system is Ubuntu 22.04.2 LTS. Before running the script, the user name used on this device must be set in the DEFAULT_USER variable. The default user is "pib".

Here is the description of some variables being used in the script:

TMP_DIR - the directory where the archives with Cerebra, phpLiteAdmin, and the database initialization script will be saved. It’s /home/user/setup_tmp/ by default.

ROS_WORKSPACE - the directory where the ROS2 node for the camera will be installed and the scripts for starting ROS and Cerebra (ros_cerebra_boot.sh) and the camera (ros_camera_boot.sh) as well. It’s /home/user/ros2_ws/ by default.

PHPLITEADMIN_INSTALLATION_DIR - the directory where the phpLiteAdmin is being installed. It’s /var/www/phpliteadmin by default.

DATABASE_DIR - the directory where the database is being initialized. It’s /home/user/pib_data by default.

DEFAULT_NGINX_HTML_DIR - the directory where Cerebra will be unzipped. It’s etc/nginx/html by default.

_URL variables contain links to download all necessary files and packages.

…_FILE and …_ZIP variables describe the filenames to save the downloaded resources.

 

To make the script executable run in the terminal the following command:

sudo chmod 755 setup-pib.sh

To run the script type the following:

./setup-pib.sh

As soon as the script is completely executed, the system will automatically reboot.

 

To check if ROS successfully started, execute the command:

systemctl status ros_cerebra_boot.service

If ROS is running you will see similar output:

With the following command, you can check the running ros nodes:

To check if Cerebra successfully started, execute the command:

Or the alternative:

In this case, the output will be simpler:

To stop Cerebra:

To stop ROS (assuming that ROS is running on port 9090):

 

To start Cerebra again:

And to start ROS again:

Be aware that with the last command, ROS will lock your terminal by starting for writing its logs there. And if you take control over the terminal back by clicking “ctrl+C” it will cause ROS to stop. Therefore the best way to start ROS again is to reboot the system.

 

Deploy script

These scripts are intended to install new versions of the Cerebra application.

This script deploy_cerebra.sh can be found here: https://pib-rocks.atlassian.net/browse/PR-92

While the script is running, an archive with a new version of Cerebra is being downloaded from Pib.Rocks (https://pib.rocks/wp-content/uploads/pib_data/cerebra-latest.zip) and then installed on the target device.

The script runs directly on the target device.

The script should be executable as well. To make it executable run in terminal the following command:

To run the script type the following: