EG/Hatch options for improved browser data-clearing resiliency

Bug #1825896 reported by Bill Erickson
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Evergreen
Confirmed
Wishlist
Unassigned

Bug Description

Evergreen 3.3

With the advent of workstation settings, most of the web client data that needs to persist (preferences, etc.) are safely stored on the server. Clearing browser data (localStorage in particular) has no impact on the stored preferences, but it does wipe away 2 crucial settings which tell the browser a) what workstations it has registered and 2) whether to use Hatch for printing. This data has to be manually re-added if the browser's data is cleared.

To close the gap and make it so Hatch-enabled machines can gracefully recover from a full browser reset, I propose the following:

1. Make the "eg.hatch.enable.printing" setting a workstation setting instead of a localStorage value.

2. Add another workstation setting "eg.hatch.workstations.enable". When set to true, workstation registrations will be stored in a file on the machine via Hatch, akin to XUL's ws_info file, instead of localStorage. This can be done w/ the existing Hatch get/set commands.

3. At login page load time, the browser first checks localStorage for workstation data. If it finds none, it asks Hatch if it has any workstations. If yes, pull the data and continue as usual.

4. At workstation registration time, if "eg.hatch.workstations.enable" is true, write the data to hatch instead of localStorage.

5. If a browser already has workstations in localStorage and enables the "eg.hatch.workstations.enable" option, the existing workstations are moved from localStorage to Hatch (and vice versa).

Lynn Floyd (lfloyd)
Changed in evergreen:
status: New → Confirmed
Jeff Godin (jgodin)
Changed in evergreen:
milestone: none → 3.4-beta1
Revision history for this message
Jeff Godin (jgodin) wrote :

Summarizing some discussion from the hackfest:

 - We do not believe that there is reason to have a setting to enable/disable using Hatch to store workstation registrations. If Hatch is available, store workstation registrations there, if not, store in local settings.

 - As a migration path, once this code is in place it should attempt to retrieve the list of workstation registrations from Local Storage and migrate them to Hatch, then remove them from Local Storage.

 - This migration process may run multiple times in the case of multiple local instances of Local Storage (browser profiles or multiple OS users using the same Hatch storage dir), and should merge workstation registrations, not replace them. The first "default" workstation should remain default despite any subsequent local settings migrations potentially having a different default workstation.

 - As part of this, change the default data directory (data.directory in the hatch.properties file) on Windows to a shared machine-wide directory (an .evergreen directory in %ProgramData% / $Env:ProgramData / C:\ProgramData being the most likely value for data.directory). This would be implemented by the Hatch Windows installer putting in place a default hatch.properties file or performing a string replace on that file. It might be an install-time prompt or command line argument to override this new behavior.

- Similar (but different) to the migration strategy for workstation registrations, when faced with an empty/new data.directory that isn't the default user.home + ".evergreen" directory, Hatch would look for that (formerly default) directory and migrate settings from there to the new directory. Unlike the migration strategy for workstation registrations above, this would only migrate the first encountered directory to the new/empty directory.

Revision history for this message
Jeff Godin (jgodin) wrote :

Some further discussion on the migration of Hatch data.directory to a shared/machine wide location on Windows:

 - new default directory name should be something like "Hatch" instead of ".evergreen"

 - we could consider using the ProgramData environment variable in the properties file (which would require special-casing the syntax), or just use that environment variable at install time. We should not replace an already explicitly-set value for data.directory. Default installs leave the property unset.

 - The migration should be per-origin. When Hatch attempts to read data for an origin and the directory associated with that origin does not exist, THEN it should look for the directory in the formerly default per-user location (for the current user). If data is found there, it should be migrated.

- In a case where data.directory was previously set to an explicit location, this new migration step will migrate leftover data from a user home directory location to the data.directory location, if data exists in the user home directory location.

- We may need to detect and skip migration in cases where the data.directory is explicitly set to the former default.

Revision history for this message
Bill Erickson (berick) wrote :

Linked bug #1825891 as dupe to this one since they are so tightly linked.

Hatch branch:

https://git.evergreen-ils.org/?p=working/Hatch.git;a=shortlog;h=refs/heads/user/berick/lp1825896-hatch-workstations-hostname

EG branch:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1825896-hatch-workstations-hostname

These branches support storing workstation in Hatch when it's available, including the data migrations discussed above. They also include using the hostname by default when registering a new workstation when Hatch is available.

TODO:

Augment the Hatch windows installer to apply a default data directory and logging directory of (typically) C:\ProgramFiles\Hatch

Revision history for this message
Bill Erickson (berick) wrote :

Note the Hatch working branch linked in the previous comment is built atop the JDK-11 branch for bug #1817932.

Revision history for this message
Kyle Huckins (khuckins) wrote :

I've pushed a branch here built off Bill's hatch-workstations-hostname branch that ensures the windows installer will change the logging file/directory to exist within %ProgramData%/Hatch/

https://git.evergreen-ils.org/?p=working/Hatch.git;a=shortlog;h=refs/heads/user/khuckins/lp1825891-hatch-installer-programdata-path

Changed in evergreen:
assignee: nobody → Kyle Huckins (khuckins)
assignee: Kyle Huckins (khuckins) → nobody
Revision history for this message
Bill Erickson (berick) wrote :

Thanks, Kyle.

I have tested Kyle's commit, added a sign-off, and merged it back into my working branch:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1825896-hatch-workstations-hostname

==

Will post a Hatch installer build shortly using the new Windows changes.

Revision history for this message
Bill Erickson (berick) wrote :

Windows build posted:

https://evergreen-ils.org/downloads/Hatch-Installer-0.3.1.exe

Hatch branch:

https://git.evergreen-ils.org/?p=working/Hatch.git;a=shortlog;h=refs/heads/user/berick/lp1825896-hatch-workstations-hostname

Note the Hatch components will work with stock Evergreen, but testing 'hostname' support and hatch-workstation-storage support requires also installing the Evergreen branch.

EG Branch

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1825896-hatch-workstations-hostname

tags: added: pullrequest
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.