freedomofpress / securedrop-workstation

Qubes-based SecureDrop Journalist Workstation environment for submission handling
GNU Affero General Public License v3.0
135 stars 39 forks source link

Implement versioning for migrations #673

Open eloquence opened 3 years ago

eloquence commented 3 years ago

The preflight updater currently has a very limited mechanism for triggering a full sdw-admin --apply run (i.e. enforcing all Salt states and not just the ones specified for dom0 via https://github.com/freedomofpress/securedrop-workstation/blob/main/dom0/sd-workstation.top#L5-L21).

That mechanism works as follows:

In the case of #661, the drawbacks of that approach became apparent:

In short, feature detection alone is insufficient to handle all migration types, and postinst-type hacks are hackish.

As we do with Alembic-managed database migrations, we need a way to version migrations and the state of the system, so we can apply the migrations that are required. The scope of this issue is:

1) Propose a lightweight implementation approach for versioning migrations (i.e. upgrades that require an sdw-admin --apply run); 2) If there is consensus, implement said approach.

eaon commented 1 year ago

The extraction of the updater from the workstation repository turns out to require a couple of small migrations to ensure we don't leave old files laying around. We used this as an opportunity to start thinking about how the goals described above can be implemented in sensible way.

The approach we've settled on so far is described as follows:

This will be implemented as a kind of test-balloon for securedrop-updater (to be reviewed / doula'd by @cfm) and if this approach works well, is intended to be subsequently ported to securedrop-workstation.

zenmonkeykstop commented 2 months ago

This is still an open issue - for now the updater has been merged back to securedrop-workstation without the initial versioned migration code, but we can pull it back in if necessary.