Nearly There!

After a few weeks of wrangling, I’ve moved over to almost entirely containerized hosting. After configuring a SWAG instance and learning nginx (and redoing all my subdomains), I only had one thing left in a VM: Discourse.

Unfortunately, my repeated attempts to “containerize” Discourse have failed every time. Discourse itself runs its own “compose-like” Docker manager, which is the main trouble I was having. I’m sure I could have figured it out eventually, but I am not gifted enough to do so.

Having made that conclusion, I decided to focus on setting up a new, uncluttered VM solely for hosting Discourse. It wouldn’t be as resource-friendly an option, but it was definitely better for my blood pressure. After a day of trial and error, I finally got it done!

I wanted to write down some of my pitfalls, primarily for my future self who will inevitably try this again and forget all that we’ve learned today.

  • First, for whatever reason the default Ubuntu server install doesn’t occupy the full vdisk, so you need to expand the volume and then the filesystem
  • Second, it’s best to install Docker via their official repos, and not via Canonical’s — better compatibility
  • Third, the Discourse guided install requires you to direct ports 80 and 443 to the VM’s IP instead of your reverse proxy — for whatever reason Discourse doesn’t like starting behind a proxy, but you can switch back after setup with no issue
  • Finally, after accomplishing some progress, it’s a good idea to “save” by closing the VM and copying the vdisk — saves time running through setup again

I think if I had known all that at the outset, I would have saved myself a lot of time and headaches. The biggest waste of time was trying to figure out why the Discourse setup couldn’t successfully ping 80 and 443. I still don’t know! My guess is it has to do with some of the proxy configs in the nginx proxy altering the expected response for the startup script, but it’s so much easier to temporarily change firewall routing in my router.

Discourse backup and restore is super smooth for a small forum like mine, so once I had a working installation it was migrated in minutes. Going forward, I would like to potentially spin up a forum for a community Minecraft server, so now I can do that via a second VM for minimal hassle.

There we have it! Going forward, I’m going to target containerized versions of everything. Hopefully that way I’ll never had to deal with a single-purpose VM again!


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *