How to start discourse inside a linux container?

Hello Discourse Friends!
I managed to setup discourse inside a LXD/LXC and want to ask, is there a recommendation how to start the deamon process?

Is there a better ‘method’ than starting it with:

bundle exec rails s -b 0.0.0.0 2>&1 > /var/log/discourse.log

How can this be done with systemd? Thank you in advance.

Kind Regards,
Ingo Baab from Germany

If you want to install Discourse in anything resembling a production environment, you should follow the cloud install instructions. discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub

Thank you for this answer, Jay, but I am happy with my installation. Works fine inside Linuxcontainer.. (I do not like docker at all..)

There are a zillion ways that you might install Discourse that can all work just fine, but only one is supported here.

Hi,
how to install it using LCX container. I dont want to use docker, because I use proxmox to manage VMs and docker cant be installed in LCX container.

You would be entering uncharted territory and would need to build something that you alone support. The code for discourse docker is open so you could adapt it, I guess.

You mean an LXC container? I know someone who worked for canonical and had a lot to do with LXC. He uses docker now.

I just installed Discourse in a Docker container inside an LXD container, which may seem weird but it’s something LXD was intentionally designed to support.

How to Install Discourse in an LXD / Docker Container

If you encounter problems with Docker / Discourse failing to run in LXD then you’ll likely need to tweak some settings in your host’s /etc/sysctl.conf namely:

kernel.keys.maxkeys=2000
kernel.keys.maxbytes=200000
net.ipv4.tcp_mem=182757 243679 365514
net.core.netdev_max_backlog=182757

These are production values for LXD and for me they were neccessary to get Discourse running.

Can you send this guide somewhere else? The site is blocking access for me, and I would also like to install discourse on LXC ProxMox

그것은 틀렸습니다

위 링크의 다음 게시물을 따르시면 됩니다 :slight_smile:

수정: 저는 LXC 컨테이너 내부에서 공식 방식으로 Discourse를 이렇게 설치했습니다 :wink:

Raspberry Pi 4에서 USB SSD를 사용하여 Ubuntu Server의 LXD 안에 Discourse를 실행해 보았지만, 재빌드(rebuild) 과정에서 계속 멈추고 타임아웃이 발생했습니다. btrfs 루프백(loopback) 스토리지 풀을 사용할 때보다 나중에 zfs 루프백 스토리지 풀을 사용할 때 멈춤 현상이 더 심하고 더 일찍 발생했습니다. 메모리 사용량은 1GB 정도로 일관성이 있었으며, 피크 시 3GB까지 상승했습니다. 멈춤 현상 발생 시 SSH와 top 명령어는 응답했지만 모든 사용 활동이 무시할 수 있는 수준으로 떨어져, 시스템이 작업을 포기한 것으로 판단되었습니다.

요즘 LXD 문서에서는 Docker 사용을 활성화하기 위해 security.nesting을 문자열 값 true로 설정하는 것을 권장하고 있으며, 저는 그렇게 했습니다. 하지만 LXD 문서에는 프로덕션 구성 페이지에도 약 20개의 설정 변경 사항이 필요하다고 나와 있는데, 이는 아직 시도해 보지 않았습니다.

결국 저는 LXD에서 Discourse를 실행하는 시도를 포기하고, 같은 기계에서 Docker를 통해 Discourse를 실행하기로 했습니다.

제 시도에 대한 자세한 내용은 여기 있습니다:

이상하게도 아래 LXD Docker 가이드는 LXD 문서에서 btrfs 사용을 비추천하고 있음에도 btrfs를 권장하고 있으며, 파티션을 사용하지 않는 것으로 보입니다(다만 일부 추가 설정을 하고 docker.io 대신 다른 패키지를 설치하며, btrfs 볼륨을 Docker에만 연결하는 방식입니다). 그래서 왜 제가 그런 문제를 겪었는지 궁금합니다:

@vmsman 님, 지금까지 가장 성공적인 설정을 이루신 것으로 보이므로, 프로파일, 스토리지 풀, 변경이 필요한 시스템 설정 등 LXD 설정에 대해 더 자세한 정보를 공유해 주실 수 있을까요:

LXD와 관련하여 궁금한 점들이 있습니다:

  • 루프백 파일 대신 스토리지 풀에 파티션을 사용하면 성능 문제가 해결되어 멈춤 현상이 사라질까요?
  • microcloud나 LXD 클러스터를 사용하거나, Ceph를 스토리지 풀로 사용하면 도움이 될까요?

전반적으로, LXD에서 Discourse를 작동시키지 못했지만, LXD와 그 사용 편의성에 매우 인상 받았습니다. 이전에 HashiCorp와 씨름하며 수개월을 보냈는데, HashiCorp는 엔터프라이즈 사용 사례에만 관심이 있는 것 같았습니다. 반면 LXD는 그냥 작동하며, 사람들이 충분히 지원해 줌으로써 소규모 팀과 인디 개발자들이 진전을 이룰 수 있도록 도와주는 것 같습니다.