In a discussion about integrating a custom Ruby application with Discourse, Mike_Jenkins seeks advice on user access conventions between a main domain and a Discourse subdomain, as well as local development setup requirements. mpalmer recommends investigating Single Sign-On (SSO) to handle user authentication across domains. Regarding infrastructure, pfaffman suggests that running two separate machines simplifies configuration by avoiding the need for a front-end web server to route traffic. codinghorror counters that two Docker containers on a single host are also a viable solution. pfaffman clarifies that while separate machines offer simplicity and avoid complex Nginx or Caddy configurations (especially since Discourse fits on a 1GB droplet), fiscal advantages for a single droplet are minimal. However, for local development, pfaffman advises that running both apps on the same machine using different ports (e.g., rails server -p 10524) is sufficient and does not require separate VMs.
It’s simpler to run two machines. With enough ram, you could set up some other web server in front of your two rails apps. You can find threads here about running Discourse and other things on the same host.
My point was with two machines x.example.com and example.com one doesn’t need to configure Nginx (or caddy) as a front door to deal with directing traffic to the correct site. Discourse just gets by on a 1GB droplet, so you’d probably want to bump to a 2GB droplet, so there’s no fiscal advantage to having a single droplet, and the simplicity of not configuring two Rails apps and another web server is probably good advice to someone who’s not sure.
BUT if you’re talking about how to set up a dev box, where you don’t care if you’re accessing localhost:3000 and localhost:3001, then that’s a different question. You can just use the same local dev setup and set the port of one of the apps like this: