I am building a desktop application in Go
that uses a Chrome window in app
mode as the user interface. I have no plans to run this application from a server.
The application is going to run on two Windows computers. I was planning to have the application store the user files on a BTSync shared folder as plain text files. But I would rather use a database hosted on the local machine(s)
I am planning to use PostgreSQL
as the database.
I need a way to keep the database in sync on these two Windows computers, I prefer not to host a copy on an online server. I am wondering if there is a solution where they can sync whilst both machines are online (in a similar way to BTSync
for plain text files.)
So far I have a crude plan:
- Every time there is a DB change on either computer A or B, the application will dump the DB (probably encrypted) to a
BTSync
folder shared by both computers. - When the other computer (A or B) is loaded and the application notices the DB dump is newer than the active DB on that machine, it loads the dump into PostgreSQL to keep both in sync.
Can anyone think of a better way to do this? I am trying to minimise the amount of programs I am using in my solution. Is there anything inside PostgreSQL
that allows for database replication across to another machine that isn't always online?
The end result is to have a local desktop application that uses a database that is in sync across a couple or several local machines.