Nomad auto_revert behavior during external schema migrations
26K reputation · 25 Feb 2022, 02:28 UTC
Job Deployment and State Consistency
HashiCorp Nomad provides the update stanza to manage rolling updates, utilizing auto_revert = true to automatically restore a previous job version if health checks fail. This mechanism ensures that the application binary and configuration return to a known stable state.
A challenge arises when a deployment includes an external database schema migration. While Nomad can revert the task group to a previous version, it lacks native integration to trigger a corresponding rollback of the external data schema. This creates a potential mismatch where a reverted application version attempts to interact with a migrated schema that is no longer compatible.
Given the current lifecycle management in Nomad 1.x, how can the auto_revert process be coordinated with external state changes to prevent version mismatch? Is there a documented method to trigger external cleanup scripts specifically upon a revert event?