dimanche 9 décembre 2018

Designing update mechanism for code-database application

I have a python based application that contains a big number of modules and interacts with two databases:

  1. metadata (that needs to be updated on certain occasions)
  2. client data This application can be deployed manually in an environment without internet access.

What are the best practices and things to consider when implementing update mechanism for this kind of system? Almost all the information is about the packing and distribution phase - signing and etc, but I'm more concerned about the update process itself.

I thought about handling code updates with pip package versions and the metadata database by script based on its version. This raise new questions like:

  1. How the mechanism should handle code updates that have certain side effects or prerequisite? For example the schema of a user configuration file has been changed - so the previous configurations should be converted to the new one (I guess it should be transparent to the user). Obviously this is done only when updating from version X to Y and not on a clean installation (Where the default values can be assigned).

    How it should be handled especially if we have a versions gap? - for example the client version is 1, the latest is 4 and the need for conversion is from 2 to 3. It should be a cumulative update that will hold all the updates (1->2->3->4) and handle all this with scripts? Or each update should stand by its own and the client should run the series of the updates?

  2. How to manage the dependency between the database and the code base versions? for example if a field in the database schema was changed so the code base version should be also updated (code version X supports database version Y)?
  3. How the fault recovery should be handled in those cases? for example when installing a seriouse of pip package updates and one of them fail in the middle? how to recover to previous state? is there a good way to backup the current version besides copying the files?

Aucun commentaire:

Enregistrer un commentaire