Installation ID and release history
The Chassis migration creates one installation UUID per logical database. Web processes, workers, beat, and nodes that share that database read the same UUID. The UUID uses version 4 on every supported Python version. Process and node IDs are assigned by the integrating project.
InstanceIdService.get_id() returns the stored UUID. The service accepts
using for projects that use a database alias other than default. Repeated
migrations and process restarts preserve the UUID. Restoring a database backup
also restores the installation UUID and release history. An independent
environment starts with a fresh database. To copy project data into such an
environment, create the fresh database with migrate and omit
chassis_instance_ids and chassis_versions from the data import.
Confirm a deployment
Set CHASSIS_PRODUCT_VERSION to the project version and CHASSIS_BUILD to the
build identifier supplied by the deployment. The product can share its version
source with its OpenAPI document and admin footer.
import os
from myproject.version import get_version
CHASSIS_PRODUCT_VERSION = get_version()
CHASSIS_BUILD = os.environ.get('RELEASE_BUILD', '')
After applying migrations and confirming the deployment, run the publication
command once for the logical database. Use --database to select a different
alias. Both settings must contain nonempty strings.
python manage.py migrate
python manage.py publish_version
The first publication creates the current release. It records the installed
django-chassis package version when Python package metadata is available.
Publishing the current product and build pair again preserves its initial
publication and status timestamps. A new build has its own row. To roll back,
publish the previous product and build pair from the rollback deployment. The
existing row becomes current again and keeps its original Chassis version.
Process startup and ordinary migrations leave the confirmed release in effect.
VersionService.get_current() reads the confirmed release for a database.
It returns None before the first publication.
VersionService.get_chassis_version() reads the installed package
metadata of the calling process and returns None if those metadata are absent.
Admin access
The Chassis site provides read-only lists and detail pages. Grant
django_chassis.view_instanceid to view the installation ID and
django_chassis.view_version to view release history. You can link
the model lists from an existing sidebar with SidebarModelItemOption, using
django_chassis.InstanceId or django_chassis.Version as the model.
migrate creates both tables in 0018_instance_id_version.
The admin footer uses the confirmed product
version and installation ID from the default database when the respective
footer entry is omitted and the user has the corresponding view permission.
An explicit entry in CHASSIS_FOOTER takes precedence, including an empty
string that hides the value. The installation ID appears in the version
tooltip when a version is visible.