samaritan / services

https://samaritan.github.io
MIT License
0 stars 1 forks source link

Explicitly Version Services #32

Open nuthanmunaiah opened 4 years ago

nuthanmunaiah commented 4 years ago

Description

As of this moment, no service is explicitly versioned other than the version assigned to the corresponding container image that the service is packaged in. As as result, expressing dependency between difference versions of services is not possible. For instance, a recent change to the project service introduced a new field to the response from the project.get service method. As a result of this change, services that depend on the project service (repository service for instance) had to be updated to propagate the change in response from project.get. While breaking changes like these are unavoidable, the dependent service (repository, in this case) must continue to be operational using an earlier version of the project service. However, the simultaneous running of two versions of a service is not possible in the current implementation because both versions of the service will be named the same (in the name attribute of the associated Nameko service class).

Proposal

A proposed solution, one that was suggested by the creator of Nameko, is to include a version in the service name.

The proposed solution may be better understood using the example from earlier. Consider two services, repository and project, with repository service being dependent on the project service. The proposed solution is described using the following hypothetical scenarios:

1 Version follows the Semantic Versioning convention but MINOR and PATCH components are ignored because the MAJOR component is sufficient to communicate incompatible changes.

Resources

nuthanmunaiah commented 4 years ago

The proposed solution has a limitation: if the breaking change to a service involves a change to the schema of the database owned by the service, having two version of the service will require two versions of the database schema to exist as well. While having two versions of the database schema is an acceptable mitigation of the limitation, it is likely that the data in the database will diverge. There are two possible solutions to the consequence of having two versions of the database schema.