Discourse slave instance with offline access

AI-generated summary

The discussion revolves around setting up a Discourse “Slave” instance for offline access during events with limited internet connectivity. antulik proposes a solution where a local Slave instance is set up, backed up from the Master instance, and then synced back to the Master after the event using a Ruby script. The Slave instance would have a read-only Master content and a read/write category for the event. sam suggests using the Discourse JSON API to sync topics and posts after the event and advises against merging topics. Surendra-Patil shares a similar requirement for syncing Master and Slave instances, with multiple Slave instances going online and offline, and is considering tweaking PostgreSQL and using Syncthing for file syncing. He seeks advice on updating PostgreSQL data without conflicts. antulik responds that they haven’t implemented the solution yet due to having internet access at event locations.

Background
We have cloud hosted discourse instance for the Australian Ruby community (I’ll refer to it as Master). Twice a year we host RailsCamp events. That’s when we spend a full weekend together at a remote location (50-150 people per event). Often there is little to no cell reception, which makes it challenging to coordinate.

I was thinking that discourse instance hosted on the local network at the event would be ideal (I’ll refer to it as Slave). We could use it to post announcements, schedule, share photos etc.

Since we already have growing community on Master, it would be great to leverage that. E.g. your profile is already setup when you get to the event, and you have a copy of all of the content.

Challenge
How to have the Slave discourse instance running along the Master when the Slave is offline for three days.

Proposed solution
I understand discourse is not designed for that. But I think there is a way to fit to our needs. I’m interested in your ideas on this

The plan

  • We setup a Slave discourse instance on the local network at the event
  • Right before the event we backup the Master and restore it on Slave
  • On Slave:
    • all categories will be marked as read-only
    • we create a new read/write category for the event
  • After the event we use a ruby script to transfer information from Slave to Master
    • Newly created users
    • All topics and posts from the created category for the event
  • Profit

Questions

  • Do you see any issues with the proposed solution?
  • Can you see a better approach?

Would be great to allow write access to all categories on Slave, but I feel the synchronisation process could be very complicated. Also that could be confusing as some people could still access Master if they have reception.

Hello from a fellow Australian Rubyist… :wave:

This all sounds fine to me. To sync stuff up after the event I would recommend writing a small script that zooms through your read write categories and then makes API requests using our JSON API to create the topics / posts on the master.

I definitely recommend strongly against having any kind of merge topic scenario, it will be full of dragons and not worth the effort.

@antulik

Did you try anything for the same ?
I am into a similar thing where I need to take discourse offline with sync.
I have a master server and I will be having more than 100-200 slave instance. Slave instance can be online/offline but will be used by users. But whenever an offline instance comes online it should be able to sync with master server without creating conflicts and all update all the latest data. I do not want to create any code related changes as discourse keeps updating itself quite often and don’t want to break instance due to code changes.

I am thinking of tweaking postgresql to some extent. Other files related data can be synced using syncthing. But updating postgresql data is something which worries me because if i directly sync master data then the work done by offline user will get erased after the sync. How was your experience writing scripts for the same ?

We didn’t do it yet as we had internet access at all event locations.