How to start discourse inside a linux container?

I tried getting discourse going inside lxd on ubuntu server on a raspberry pi 4 with a usb ssd, and it would just hang and timeout during rebuilds, the hanging was worse/earlier using a btrfs loopback storage pool and later using a zfs loopback storage pool. Memory was consistent around 1gb with 3gb peaks. The hangs would have ssh/top be responsibe but all usage activity would drop to negligible, indicating it had given up.

These days the lxd docs just recommend setting security.nesting to the string value true to enable docker usage, which is what I did. However the lxd docs also has a page for production configuration with about 20 settings that need changing, which I haven’t tried.

In the end I gave up on my lxd attempt for discourse, and just ran discourse via docker on the same machine.

Details of my efforts here:

Strangely the below lxd docker guide recommends btrfs despite the lxd docs recommending against it, and does not appear to use a partition for it (yet they set some extra settings, install other packages rather than, and attach the btrfs volume only to docker), so I wonder why I had such issues:

@vmsman can you share more details about your lxd setup, such as profiles, storage pools, and any system settings that needed changes, as seems you’ve had the most successful setup so far:

For lxd, some things I wonder about:

  • whether partitions for storage pools instead of loopback files would solve the performance issues enough the hanging issues goes away
  • whether using microcloud or an lxd cluster would help, or using ceph as the storage pool

All in all, despite not getting discourse working in lxd, I am very impressed with lxd and its easy of use. I previously spent months struggling with hashicorp, as hashicorp only seems interested in enterprise use cases. Whereas lxd just works and people seem supportive enough to enable small teams and indie devs to make progress.