v3 upgrade guide
Changes introduced by Open mSupply v3 and sync v7.
This guide covers what changes when you set up or upgrade to Open mSupply v3, which introduces a new synchronisation method referred to as sync v7. With sync v7, remote sites sync only with the Open mSupply central server, which in turn syncs with the legacy mSupply central server on their behalf.
Central initialisation🔗
Setting up a new Open mSupply central server is much the same as in previous versions. The one addition is that you need to set override_is_central_server to true under server in the yaml settings file. When you start the server you will see two tabs, as shown in the screenshot below. Choose Central with legacy sync, enter the details as you normally would and click Initialise. This pulls all of the records for the site you are initialising.

Once you click Initialise, the records begin syncing across. You can follow the progress in the steps shown below.

When initialisation has finished, you can log in and start using the app. However, before you can set up any new v3 remote sites, all of the stores for each of those sites (as defined in legacy mSupply) must have synced across to the Open mSupply central server. Follow the legacy mSupply documentation to do this. You can speed things up by setting a short sync interval in the sync settings of the Open mSupply central server.

You can then monitor the progress of the stores syncing across to the Open mSupply central server in legacy mSupply (see the legacy mSupply user guide). Once a site's stores have moved, legacy mSupply no longer lets you manage or edit that site. See the Site management section for how to do this instead.
Remote initialisation🔗
Remote sites are set up in almost exactly the same way as in older versions of Open mSupply. The only difference is that instead of entering the legacy mSupply server URL, you now enter the URL of the Open mSupply central server. Once all of the stores for the site have finished syncing to the Open mSupply central server, start your remote server and enter the sync details as shown below:

Once you click Initialise, the records begin syncing across from the Open mSupply central server. You can follow the progress in the steps shown below.

When initialisation has finished, you can start using the app.
Central upgrade🔗
Upgrading an existing Open mSupply central server to v3 is much the same as any other upgrade. The one thing to note is that before upgrading, you must set override_is_central_server to true under server in the yaml settings file. From v3 onwards, every central server configuration requires this setting. Then run the upgrade as you normally would, and you will be able to log in as usual.
As with a new central initialisation (described above), follow the legacy mSupply documentation to sync all of the stores across to the Open mSupply central server. All of the stores for a remote site must have synced before you can initialise that site on, or upgrade it to, sync v7.
Remote upgrade🔗
This is the simplest of the steps. Upgrade the remote site to v3 as you would for any other version; you don't need to change any yaml settings. Once the upgrade (and data migration) has finished, you can log in and use the site as you normally would.
If the Open mSupply central server has already received all of the stores for this remote site from legacy mSupply, the remote site switches over to sync v7 the next time it syncs. This happens automatically and you are unlikely to notice it unless you trigger a sync manually. If the central server is not ready yet, the switch to sync v7 fails. This is nothing to worry about: the remote site keeps trying on each sync until the central server has the stores it needs.
Once the switch to sync v7 has completed, you will see that the sync modal and the sync settings have changed, as shown below. From this point on, the remote site no longer communicates with legacy mSupply directly. It only communicates with the Open mSupply central server.


Site management🔗
When initialising a remote site locally from customer data, you would usually clear the site's hardware ID in legacy mSupply. Once a site's stores have started syncing to the Open mSupply central server (as described above), legacy mSupply no longer lets you clear the hardware ID. From now on, the Open mSupply central server is responsible for hardware ID checks.
To reset a hardware ID, open the page shown below on the Open mSupply central server and click the site whose hardware ID you want to reset.

Then click the Clear Hardware ID button in the modal, as shown below.

You will also notice a Clear Sync Token button. Sync tokens are new in sync v7: every remote site that syncs to the Open mSupply central server using sync v7 needs a token. The central server issues the token automatically when the site is initialised or first switches over to sync v7. The only time you need to clear it is when reinitialising a site.
Testers and developers who need to bypass the hardware ID and token checks can use the setting described in the Sync settings section.
For now, these are the only site management features controlled by the Open mSupply central server. Everything else is still managed in legacy mSupply.
Synchronisation🔗
This section gives a basic overview of how synchronisation works with sync v7. For more detail, see the synchronisation section of the developer documentation.
Sync v7 is the API and mechanism a remote Open mSupply site uses to sync with the Open mSupply central server. The central server still supports sync v5 and v6, and still communicates with legacy mSupply using sync v5. Remote sites that have not yet switched to sync v7 can still sync with both the Open mSupply central server and legacy mSupply using sync v6 and v5. A remote site on sync v7 no longer communicates with legacy mSupply directly.
For example, say you have two remote sites on sync v7, A and B. You create an internal order in a store on site A, addressed to a store on site B. For site B to see the order, you need to trigger a sync on site A (or wait for it to sync in the background) and then trigger a sync on site B. This is what happens:
Site A:
- Pushes its new records, including the order, to the Open mSupply central server
- Waits for the central server to finish integrating the records it pushed
- Pulls any records the central server has for it
- Integrates the pulled records
Site B:
- Pushes any new records it has
- Waits for the central server to finish integrating them
- Pulls its records from the central server, including the order from site A
- Integrates the pulled records
You will then see the order as a requisition on site B. To see both the internal order and the requisition in legacy mSupply, trigger another sync on site B. This sends the requisition lines that were created during the previous integration to the Open mSupply central server. Once the central server has all the information it needs, trigger a sync on the central server. This pushes the data to legacy mSupply, where you can then view the order for both stores.
In short, sync v7 syncs are started by the remote sites. The Open mSupply central server only authenticates sites and makes sure the correct records are sent to each remote site.
Backward compatibility🔗
As explained in the Synchronisation section, the Open mSupply central server still supports sync v5 and v6 after upgrading to v3. A remote site that is still running a v2.x version can continue to sync with legacy mSupply and the Open mSupply central server as it does now. When you are ready to upgrade the site, follow the steps in the Remote upgrade section.
All older versions of Open mSupply that are still being maintained are supported. If you run into any compatibility problems, please raise an issue on GitHub.
Standalone central🔗
Although you will see an option to initialise a standalone central server, this feature is still a work in progress. You are welcome to try it out, but it should not be considered functional yet. Sync v7 lays the groundwork for standalone operation, but more work is needed before standalone central servers are supported.
Settings changes🔗
This section describes the changes to the yaml settings file.
server:
# Setting all three values below on a new database initialises a standalone Open mSupply
# central server. Comment out the sync settings when using these.
# Also requires `override_is_central_server: true`.
standalone_store_name: 'Central Config'
standalone_admin_username: 'admin'
standalone_admin_password: 'pass'
sync:
# url/username/password_sha256/interval_seconds are all-or-nothing: set them all, or omit them
# all to carry only flags (e.g. on a central server). A partial set is a startup error.
# Central server only. Relax the v7 hardware ID and "token already allocated" checks so a site
# can re-pair from a new machine without an admin reset (name and password still required).
# For recovery/migration only – leave false in normal operation.
relax_hardware_id_token_checks: false
changelog_partition: # Postgres only; controls partitioning of the changelog table
partition_size: 5000000 # cursor values per partition
lookahead: 30000000 # headroom of insertable changelog records; also the minimum – lower yaml values are raised to this
interval: # how often the background task checks headroom and adds partitions
hours: 0
mins: 1
secs: 0
changelog_dedup: # central server and Postgres only; periodically deletes superseded (duplicate) changelog rows
interval: # how often the task wakes up to consider a dedup run
hours: 24
mins: 0
secs: 0
time_window: # optional; if set, dedup only runs between these local times and stops at 'to'
from: '02:00'
to: '05:00'
batch_size: 50000 # changelog rows deleted per committed batch
Server🔗
The settings with the standalone_ prefix only apply to standalone operation. There are currently three: the store name, and the admin username and password. All of them are optional. As mentioned above, standalone operation is still a work in progress.
Sync🔗
relax_hardware_id_token_checks is an optional setting for use when setting up automated tests or during development. Do not use it in production. When it is set to true, the Open mSupply central server issues a new token whenever a remote site requests one, even if it has already allocated a token to that site. Hardware ID checks are also turned off completely.
Changelog partition🔗
With sync v7, the Open mSupply central server holds data for every Open mSupply site, so its changelog table can grow to more than 100 million rows for some customers. To keep the server running smoothly at that size, the changelog table is now partitioned. These settings let you tune how partitioning is done.
This entire section is optional. If it is left out, the server uses default values, which should work well in most cases.
partition_size: the number of records a single partition can holdlookahead: the number of records of headroom to keep available. Together withpartition_size, this determines how many empty partitions are created ahead of time for new recordsinterval: how often the server checks the headroom and creates new partitions if needed
Changelog dedup🔗
Like the changelog partition settings, these settings control how often duplicate records are removed from the changelog table (deduplication). Previously, deduplication was done using a database view. Because the changelog can now be very large on central servers, it is more efficient to deduplicate periodically by deleting old duplicate records. Previously, deduplication treated UPSERT and DELETE records as duplicates of each other. With Open mSupply v3 and sync v7 they are treated as distinct records.
interval: how often deduplication runs, as for the changelog partition settingtime_window: if set, deduplication only starts within this time window (optional)batch_size: the number of records deleted in each batch during deduplication (optional)