How can I include discourse in my local dev stack?

My organisation runs a web application and a forum, as well as a few other applications like bitwarden. I’ve containerised everything to achieve dev/prod parity and a simple development setup using docker compose. We use a very similar compose file to run it in production and it works very well for our basic use case.

I’d like to switch our forum to discourse, but I’m struggling to figure out how to maintain dev/prod parity and a simple development setup.

The docs suggest that even though discourse uses docker to install and run, it doesn’t actually fit into the container paradigm like other docker containers: you can’t add it to a compose/swarm/kubernetes stack and run it, connecting it to database and redis containers like you would another application container. And alternative solutions or suggestions are strongly discouraged in an effort to not bifurcate the community, so I’m not here to question the approach.

I’ve accepted that, rather than running and managing discourse the way I do the rest of my stack, I’ll need to run a dedicated VM in production and manage it differently. But I’m curious how to address my underlying goals: a simple development setup that has decent parity with production.

For context, my current development setup is “install docker, clone this repo, and run docker-compose up”. If I’m understanding correctly from the local installation guide, we’ll now need 9 system dependencies (ruby, postgres, etc.) before we manually clone and setup discourse itself. To my mind, one of the advantages of docker (and docker compose) is that you don’t need things like postgres and redis running on your system (and the associated issues with setting those up when devs are on windows); you can just run a stack and the processes are isolated to throaway containers. Is there any way to keep that advantage?

The other downside is, since we’re a small team of volunteers, most of the other developers are on windows 10 home, which as far as I know does not support WSL, which means they won’t be able to follow the windows install instructions anyway (docker does work on windows 10 home).

Well, the good news is that most of the time, you shouldn’t have to!

Unless you’re developing specific integrations against the forum or theming for the forum itself, the Discourse site can mostly sit on its own outside the rest of your stack.

There are options to do a Docker-based development install on Linux and WSL; we don’t recommend this on MacOS due to filesystem performance reasons.

1 Like

Actually it’s pretty critical because I want to use discourse as the sign on system for my applications. Without it, that will mean users can’t login locally.

In that case, I’d recommend doing SSO with a live staging site.

Set up a second copy of discourse on the same-ish hosting, give everyone admin, and create SSO Provider Secrets for localhost:3000, localhost:4000, localhost:4001, *.cluster.local, etc as necessary.

Everyone on your development team will be able to forge authentication payloads from this site, so it’s important to document that and use your real production site for real authentication.