Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3717 om supply central backup kdd #3924

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

andreievg
Copy link
Collaborator

Fixes #3717

Didn't really deal with B.3 use cases. Started thinking about how cursors on both sides can help re-integrate data from remote to central etc, but realised it's a bit of a rabbit hole, so I didn't want to get too deep into it. I did want to outline some problems that result with backup recency mismatch.

Also do I need to get into more details about the actual backup and restore operations for postgres ?

@github-actions github-actions bot added this to the V2.1.0 milestone May 16, 2024
@github-actions github-actions bot added enhancement New feature or request Priority: Must Have The product will not work without this Team Ruru 🦉 Laché, Carl, Andrei labels May 16, 2024
Copy link
Collaborator

@mark-prins mark-prins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice! thanks @andreievg that's great.
have popped in some spelling nits that stood out while reading - while it's a bit late in the day to comment sensibly, I'm leaning to option 3. I like the idea of being able to configure backup schedule within oms, and it's a straightforward option for support

decisions/central server backup.md Outdated Show resolved Hide resolved
decisions/central server backup.md Outdated Show resolved Hide resolved
decisions/central server backup.md Outdated Show resolved Hide resolved
decisions/central server backup.md Outdated Show resolved Hide resolved
decisions/central server backup.md Outdated Show resolved Hide resolved
### (B) Other areas of consideration

1. When data is stored remotely, it needs to be safe from prying eye (encrypted)
2. We also have Grafana installed on most central instances, and I think we've been using the same postgres instance for both omSupply central and Grafana
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the grafana.db SQLite database is generally backed up along with the mSupply backup - added into the additional files and bundled with

decisions/central server backup.md Outdated Show resolved Hide resolved
@andreievg andreievg changed the title 3717 om supply central kdd 3717 om supply central backup kdd May 16, 2024
@jmbrunskill
Copy link
Contributor

very nice! thanks @andreievg that's great. have popped in some spelling nits that stood out while reading - while it's a bit late in the day to comment sensibly, I'm leaning to option 3. I like the idea of being able to configure backup schedule within oms, and it's a straightforward option for support

I agree it's nice to build a solution that doesn't rely on mSupply.
It's worth thinking about what happens when the postgres server is on a different machine to open-mSupply though. I can see that happening. I guess at the stage,the postgres backup wouldn't be OMS's responsibility but good to note I think. With this low level backup approach it sounds like you need to physically copy the datafiles, not like PGDump that can stream the data to a separate machine. Am I understanding correctly?

Copy link
Contributor

@Chris-Petty Chris-Petty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great write up!

_Pros:_

- Should be reasonably simple
- A.3 is handled automatically (using the same mechanism as mSupply)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this would fail A.3 as unless the backup happens at the exact same time as mSupply and pauses activity on both MC and OMC, otherwise the cloud backups (A.3) aren't guaranteed to be in sync with each other?

|:---------:|:--------------------:|:----------------------:|:---------------------:|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| B.3.1 | old | recent | recent | Loss of data while restore of OMR data (via sync initialisation), due to missing data for that site on MC. OMC and OMR may miss some central data being added, since their cursor for that data would be ahead of central_change_log on MC. Some OMR remote records that are pushed to OMC may be related to central records on MC that are not present anymore, thus when OMR is re-initialised some constraints may fail. |
| B.3.2 | recent | old | recent | Loss of data while restore of OMR (via sync initialisation), due to missing data for that site on OMC. Some data being pushed OMC from OMR may not be integrated due to missing relation dependencies (that were pushed previously but are now missing). Some new OMC central data may not travel to OMR since the cursor of OMR for central data would be ahead of current OMC |
| B.3.3 | recent | recent | old | This would require some restore of backup on omSupply remote site, which is not something we recommend or support (if remote site data is lost, you should re-initialise) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one key question - isn't B.3.3 essentially what we're trying to achieve? That's basically what we rely on for current MC prior to OMS2.0? But the complication I see is: don't we require both MC and OMC to backed up together at precisely the same time? Otherwise we're constantly going to end up with B.3.1 and B.3.2? At least for the cloud files anyway

Currently MC pauses all processes while it executes the backup process, including sync APIs. Would we not need to do the same with OMC at the same time?

andreievg and others added 6 commits June 20, 2024 12:51
Co-authored-by: Mark Prins <9192912+mark-prins@users.noreply.github.com>
Co-authored-by: Mark Prins <9192912+mark-prins@users.noreply.github.com>
Co-authored-by: Mark Prins <9192912+mark-prins@users.noreply.github.com>
Co-authored-by: Mark Prins <9192912+mark-prins@users.noreply.github.com>
Co-authored-by: Mark Prins <9192912+mark-prins@users.noreply.github.com>
Co-authored-by: Mark Prins <9192912+mark-prins@users.noreply.github.com>
@roxy-dao roxy-dao modified the milestones: V2.1.0, v2.1.0-rc5 Jun 27, 2024
@mark-prins mark-prins modified the milestones: v2.1.0-rc5, V2.2.0 Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority: Must Have The product will not work without this Team Ruru 🦉 Laché, Carl, Andrei
Projects
None yet
Development

Successfully merging this pull request may close these issues.

omSupply central server backup KDD
5 participants