Introduction
The LXD team is very excited to announce the release of Microcluster v3.0.2!
This is the second LTS release of Microcluster. It will be supported until February 2031 and will receive a number of bugfix and security point releases over that time.
Microcluster is a Go library that simplifies development of dqlite clusters.
Highlights
Signal management
By default Microcluster subscribes to the SIGPWR, SIGTERM, SIGINT, and SIGQUIT signals to initiate a graceful daemon shutdown.
A list of custom signals (or none) can be provided to influence this behavior which helps to import Microcluster more seamlessly into existing applications that perform their own signal management. See the docs for further information.
Redefined logging
Microcluster is now using slog for log messages emitted by the daemon. To get more control over the logs and their routing, a custom handler can be provided during daemon startup. This allows not only redirecting log messages but also allows setting log levels based on the individual needs.
Package restructure
To clearly separate types used by any importer of Microcluster, all of the public facing code is now moved under the microcluster/types package. The additional database tooling can be found inside the microcluster/db package.
This change ensures that none of the client functions from Microcluster’s app construct return data types located in the internal/ package.
It also allows unit testing entities like API handlers in a more granular way as all of the data structures passed to API handlers are now available in public packages.
Users of Microcluster are no longer required to import LXD as a dependency when defining API handlers or database related schema updates as those types are now included in Microcluster directly.
Last but not least the user experience was modified to not require switching between functions in the app construct and actual HTTP client functions.
All operations supported by Microcluster are now covered by functions in the app construct.
Deprecations
Removal of SQL endpoints from public API
The SQL endpoints for dumping and executing queries are now moved to each cluster member’s Unix socket. Executing custom queries should not be performed across cluster members via the public API.
Deprecated client package
As mentioned as part of the package restructure above, various client functions were removed and are now replaced by functions available in Microcluster’s app construct to present a more consistent way of interacting with Microcluster and to not expose internally used client functions.
Importing Microcluster v3.0.2
Upgrades of existing clusters from v2 to v3 are supported. In addition no new schema updates are included in v3.0.2. Keep in mind that some refactoring is required to accommodate the new package structure.
To obtain the latest LTS v3.0.2 of Microcluster run:
go get -u github.com/canonical/microcluster/v3
Or if you haven’t yet added Microcluster to your list of dependencies run
go get github.com/canonical/microcluster/v3@latest