Platform Migrations
Add support for the following:
workstation$ leap migrate
How can this be supported?
- leap_platform/bin/migrate/ -- directory that holds migration scripts
- leap_platform/bin/migrate/201612222000_upgrade_blah.rb -- a single migration
- server$ /etc/leap/latest-migration -- a single line file with the serial number of the last migration that was run
The command leap migrate
would check /etc/leap/latest-migration against the list of migrations in /srv/leap/bin/migrate. If some have not been run, it runs each pending in order by serial number. As each one exits successfully, the /etc/leap/latest-migration file is update. If one exits unsuccessfully, then an error is reported to the user and the process stops.
The command leap node init
would initialize /etc/leap/latest-migration to the last serial number, if the file does not already exist. This way, new nodes are assumed to be fully migrated.
The command leap deploy
would check, at the end of a successful puppet run, if there are any migrations in /srv/leap/bin/migrate with a higher serial number than /etc/leap/latest-migration. If there are, it would alert the sysadmin that a migration is pending and instruct the sysadmin to run leap migrate
.
Migrations should be written so that they can be repeatedly run without causing any errors. Some migrations need to be run once for the provider, but do not need to be repeated for each node. In these cases, the migration scripts run later would just exit successfully, thus marking the migration as complete on the particular node.
I don't think we want to support rollback migrations.
(from redmine: created on 2016-12-22)