具有离线访问权限的 Discourse 从属实例

背景
我们为澳大利亚 Ruby 社区托管了一个云端的 Discourse 实例(我将其称为 Master)。每年我们举办两次 RailsCamp 活动。在这些活动中,我们会在偏远地点共度整个周末(每场活动约有 50 至 150 人)。通常现场几乎没有或完全没有手机信号,这使得协调工作变得具有挑战性。

我一直在考虑,如果在活动现场的本地网络上托管一个 Discourse 实例会非常理想(我将其称为 Slave)。我们可以用它来发布公告、日程安排、分享照片等。

由于 Master 上已经有一个不断壮大的社区,如果能加以利用就太好了。例如,当您到达活动现场时,您的个人资料已经设置好,并且您拥有所有内容的副本。

挑战
如何在 Slave 离线三天的情况下,让 Slave 与 Master 同时运行。

建议方案
我理解 Discourse 并非为此设计。但我认为有一种方法可以满足我们的需求。我很想听听您对此的想法。

计划如下:

  • 在活动现场的本地网络上设置一个 Slave Discourse 实例
  • 在活动开始前,备份 Master 并将其恢复到 Slave
  • 在 Slave 上:
    • 所有分类将被标记为只读
    • 我们创建一个用于活动的新可读写分类
  • 活动结束后,使用 Ruby 脚本将信息从 Slave 传输到 Master
    • 新创建的用户
    • 活动分类中的所有主题和帖子
  • 大功告成

问题

  • 您认为建议的方案存在任何问题吗?
  • 您能想到更好的方法吗?

虽然希望允许在 Slave 上对所有分类进行写操作,但我感觉同步过程可能会非常复杂。此外,这也可能造成混淆,因为有些人如果仍有信号,仍然可以访问 Master。

4 个赞

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.

8 个赞

@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 ?

1 个赞

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