billmania / roboquest_core

The backend functionality for the RoboQuest project
1 stars 0 forks source link

Support sending update status messages to browser during an update #60

Closed billmania closed 1 month ago

billmania commented 1 year ago

rq_ui Issue 117

While in the code, replace "HAT setup" in rq_hat.py with something better.

billmania commented 1 year ago

Software version numbers

There is no facility in the software update process to determine the oldest version of updater.py still in use. Therefore, all updates to updater.py must retain full backward compatibility with all previous versions of updater.py.

When the rq_core, rq_ui, and updater.py images are deployed to the registry server, three files will be updated on the registry server:

updater_version.txt is the file which holds the version of updater.py. It's used by updater.py to determine when a newer version of updater.py is available. firmware_version.txt holds the current HAT board firmware version. image_versions.json holds the current versions of the Docker images rq_core and rq_ui, in the format:

{
    "registry.q4excellence.com:5678/rq_core": {
        "name": "rq_core",
        "version": "v23"
    },
    "registry.q4excellence.com:5678/rq_ui": {
        "name": "rq_ui",
        "version": "v34"
    }
}

After updater.py starts but before it starts the containers, it will extract the versions of the local images using:

docker inspect --format='{{json .Config.Labels}}' rq_ui

It will retrieve image_versions.json from the registry and extract the image versions. The version information will be written to the file /opt/persist/versions.json in the format:

{
    "installed": {
        "rq_core": "v23",
        "rq_ui": "v34",
        "updater": "13",
        "firmware": "6.1"
    },
    "latest": {
        "rq_core": "v23",
        "rq_ui": "v34",
        "updater": "14",
        "firmware": "6.1"
    }
}

The file versions.json will also be updated after the application software is updated.

billmania commented 1 month ago

When both updater.py and one or more Docker images have been updated, enhance updater.py so it will automatically perform both updates without requiring a restart in between.

billmania commented 1 month ago

Making the updater log messages available to the browser requires a TLS-capable web server with a certificate and a key. They were generated with

openssl req -x509 -nodes -newkey rsa:2048 -keyout key.pem -out cert.pem

Logic was added to updater.py to retrieve and install the two PEM files and install them into /opt/updater on the robot.