Hosting Discourse on a Raspberry Pi?

I have a raspberry Pi 3 B+. How do I host Discourse on it so I don’t have to pay money? How do I get a domain name for free?

2 Likes

Did you try searching?

That isn’t really a Discourse question.

You’re going to hit a bunch of problems here, running a docker image on ARM rather than x64, slow microSD storage speeds, pinning a DNS name to a dynamic IP.

All of these things fall outside the scope of what we support here. The scope of support is the standard install which requires a domain name, x64 cloud server and SSD storage.

11 Likes

I think this is a fairly awesome aspiration. Do try it and Let us know how far you get, even if it is unsupported.

9 Likes

Technically? Yes you can. Will it be a good experience? I truly doubt it.

You must have a Domain Name, you can do this for free with services like No-IP, with Dynamic DNS you can keep the Domain updated and pointing to your Raspberry Pi.

Now, you will find some issues, that I think are really important and I don’t really think you have a very great developer profile.

  • Build a custom docker image from Discourse’s one to support ARM (Docker’s abstraction might help a little), but at this point maybe getting a VM on top of the Raspberry would be easier (adding ton of overhead)
  • Handling the extremely low performance of ARM cores, I don’t know how good is Discourse handling load between cores (other than building).
  • Handling Discourse with only 1GB of RAM, when it recommends at least 2GB.
  • As said by @Stephen really, but really slow performance by the SD cards, and you’ll hit that SD A LOT because if using 2GB of RAM you hit SWAP, with only 1GB, most of your forum will be running in the SD.

Is it a good idea to run Discourse that way? Maybe for testing or as a project, just to prove it can be done.

For a production instance? No way it’s a good idea. You can get Discourse running with as little as 5$/month with Digital Ocean, 2-4$ if you search for cheaper options as Vultr, OVH, etc. And ~12$/year for a domain.

We’re talking less than 10$ per month hosting it online, I think that’s even cheaper than running Discourse 24/7 on a PC.

10 Likes

This part is not correct, 1GB with swap is the minimum.

6 Likes

That’s why I talked about recommendations and not minimums.

Your post is 98% correct, but you can host a fairly sizable Discourse with 1GB RAM (and swap). It’s not a minimum in that sense.

5 Likes

This is a helpful discussion - thank you. A technical piece not mentioned above is email - one of the reasons you want to be online and have a domain name is so you can route email to and from your discourse. It’s well nigh impossible to let anyone use your discourse for anything properly without email. You can also do this for free with mailgun (though you do need to provide a credit card).

I’ve been interested in creating an offline, pocket version of my discourse forums for a while now. I am sure there are other similar sized devices with better specs I can choose from to do that.

I live in an earthquake zone on an island, and often I wonder how easy it might be for me to set up a private WAN here in my neighborhood that provides information and a place for neighbors to help one another and share information when the internet and mobile networks go down. When the Internet is available, the forum is accessible as usual. But for when the Internet is not available for whatever reason, it also provides wifi access to a local network for about 100 people. I know this is technically possible and the obstacles can be overcome, but am a bit rusty on my local networking skills.

3 Likes

Probably a good application for the scooter PCs @codinghorror has been tinkering with.

They’re x64, SSD-ready, and passively cooled so no moving parts. None of the problems that the rPi will bump into.

4 Likes

Ok. So how do I get Discourse on my Raspberry Pi? Do I need to follow a step by step guide? What’s next?

There are no guides for installing Discourse on a Raspberry Pi, because it has a different CPU architecture (ARM) than Discourse has been designed to run on (x64).

You’re going to need to learn how to create your own docker images, and reengineer the installation process around that.

You’re also going to need to find yourself a workaround to the painfully slow microSD. Discourse is very sensitive to disk speeds, this is a normal SSD:

512+0 records in
512+0 records out
536870912 bytes (537 MB, 512 MiB) copied, 5.32941 s, 101 MB/s

Whereas this is typical of microSD:

512+0 records in
512+0 records out
536870912 bytes (537 MB, 512 MiB) copied, 28.5342 s, 18.8 MB/s

So ~80% slower.

We don’t have any solutions for you in terms of the DNS address, but a DNS name is mandatory, so you’re going to need to do some research there and prepare to spend some money.

Honestly I don’t even think it is worth bothering, unless you know you can host a vanilla website from home. Most consumer ISPs really do not like it when people host services from their home.

So I suggest you try something easier: can you host a single page, plain HTML website on your Raspberry Pi and have it remain accessible to others for a week or more?

10 Likes

The latter is absolutely a thing, the chap who figured out how to get Django running on the rPi ~7 years ago landed himself a job at Facebook.

1 Like

Yeah. I’ve already spent 23 hours trying to figure it out.

1 Like

I will try that and see if that works.

2 Likes

Yeah it’s better to start simple here. Once you’ve done that, other possibilities open up…

4 Likes

I’m attempting to set up a private Discourse forum on a Raspberry Pi 4 (quad core, 4GB ram) with reasonably fast disk. It’s only going to have maybe a few dozen users, and I’m not really concerned about speeds. I use 4GB Pi4s for some other, much more disk-intensive tasks and they work okay, especially with USB3 storage.

I ran into some issues related to expectations of x86_64 arch:

standard_init_linux.go:211: exec user process caused "exec format error"

I’m going to begin looking into fixing them. There’s theoretically nothing I know about that would prevent any of the code or gems or supporting services from running fine on this system.

7 Likes

It is a quite tech challenging issue. Some tech guys may be interested in this topic.

In reality, I would like to use an 2nd hand cheap laptop to host discourse, rather than raspberry pi.

You would get much better user exp.

4 Likes

I might be wrong but I belive it’s the docker metadata that only specified x86? It needs to be built for arm. I’ll be trying something like this as well probably in a month or so. Don’t see why the pi 4 with 4 gigs wouldn’t work.
It’s perfect with the low energy use and small factor.

Also interested in setting up a cluster, to use more than one device. Kubernetes works fine on arm

2 Likes

On my Pi 4:

536870912 bytes (537 MB, 512 MiB) copied, 2.31501 s, 232 MB/s

Depends on which microSD speed rating you buy.