Hm, this is a difficult topic to write about, because it touches many different aspects of Linux server administration and maintenance. I tried to type up a "quick overview" but realized it'd either turn into a freaking book or be full of holes and pitfalls and "you'll figure it out"s.
So... on an even more abstract level, this is what you'd probably want to do:
- Set up Redis, PostgreSQL and Nginx on your host.
- Use the
web_only.yml sample instead of
- Hack the
web.template.yml or use a hook in your
app.yml so that nginx isn't started inside the container.
- Wire it all together so that Discourse connects to Postgres and Redis on your host and the host forwards requests to the Unicorn running inside the container.
The most important thing to keep in mind is that "inside the container" and "outside the container" might, for these purposes, as well be two different computers. Most importantly, THE CONTAINER'S LOCALHOST AND THE HOST'S LOCALHOST (127.0.0.1) ARE SEPARATE NETWORK DEVICES! If Unicorn-inside-the-container is set to bind to 127.0.0.1:3000, then nginx-in-the-host will not be able to connect to it. Instead, refer to the Docker Advanced networking documentation; your goal is make Docker assign a predictable IP address to the Discourse container and have Nginx forward requests there.