I’m working on a fairly low-budget game, and my users have asked for a leaderboard. Rather than building my own and trying to work out the pitfalls, I thought I’d use Nakama.
Does anyone have a guide, or tips for hosting on Heroku? Running Docker containers there seems easy enough, but I’m not clear on how to forward Nakama’s multiple ports to a single container. Is that possible, or would I need to run several, only exposing one port for each? That seems a bit inefficient if so.
Failing that, is there a better, easy option for just slapping up a Docker container somewhere and not worrying about it? I have plenty experience hosting things, but thus far I’ve gotten away with a static site and an Itch page for this title. If I can pay a bit of cash, point an external provider at a Docker image, and let it handle the rest, I’d prefer that to spinning up a DO droplet and having to perpetually keep that updated.
We used to have some code snippets on how to handle the Nakama containers on Heroku with their Docker integration but it was quite new at the time and was outdated often. We dropped the recommendation for it at some point as a result. I do think in general that Heroku or Digital Ocean are good options for your needs at the price point and level of maintenance you want to take on.
I think the best route may be to revisit the Heroku docs on how to run Docker containers on their managed VMs. You can use the environment variables exposed by the Heroku runtime to connect to a managed database instance.
I think the overall steps to work out for the Heroku YML setup are:
- The Docker container deployment.
- The dependence on a managed database VM.
- What format to export logs in case there’s a builtin way to parse and read them via the PaaS.
- Same as above but for metrics.
Have a look at the documentation on the server configuration for what cmd flags you can pass to the server to generate the output you might need to use with Heroku.
Hope this helps.
Right, but what I’m confused about is how Nakama requires something like
3-4 ports. Is it somehow possible to expose everything necessary via
Heroku? Or do I have to run a separate container per port I want to
expose, backed by the same database instance? In my case, I just want to
host a leaderboard and have admin access, and my game will use the Godot
API, so I’m not sure if that changes which ports I’d need. I thought
Heroku was mainly meant for web apps exposing single ports, not for a
server needing several.
@nolan That’s a good question. The GRPC related ports (server and console) will only need to be exposed to the web if you use them instead of the HTTP interfaces. I don’t think Heroku load balancers support HTTP2 traffic yet so I’d be surprised if they could handle the GRPC option.
It’s been a while since I looked at Heroku. Is it not possible to configure two load balancers to point at each of the two ports as separate “backends” for the server?
I don’t know much about Heroku. Was honestly just looking for a
no-hassle way to throw up a Docker container either for free or for a
low fee, and not worry about the underlying server. But I don’t see a
way to configure Heroku’s load balancers unless I’m missing something.
I’ll keep poking the docs, but was hoping someone might chime in and
tell me they were currently doing this and how. Open to other
suggestions if anyone has them.