Discourse slave instance with offline access

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

Пробовали ли вы что-то для решения этой задачи?
У меня схожая ситуация: мне нужно развернуть Discourse в офлайн-режиме с возможностью синхронизации. У меня есть главный сервер, и у меня будет более 100–200 подчинённых экземпляров. Подчинённые экземпляры могут быть как онлайн, так и офлайн, но они будут использоваться пользователями. Однако, когда офлайн-экземпляр выходит в сеть, он должен иметь возможность синхронизироваться с главным сервером без возникновения конфликтов и обновлять все данные до актуального состояния. Я не хочу вносить какие-либо изменения в код, так как Discourse часто обновляется, и я не хочу, чтобы изменения в коде ломали работу экземпляров.

Я думаю о некоторой настройке PostgreSQL. Другие файлы, связанные с данными, можно синхронизировать с помощью Syncthing. Но обновление данных в PostgreSQL беспокоит меня, потому что если я напрямую синхронизирую данные с главного сервера, то работа, выполненная офлайн-пользователем, будет удалена после синхронизации. Как был ваш опыт написания скриптов для решения этой задачи?

Мы еще не сделали этого, так как у нас не было доступа к интернету на всех площадках мероприятия.