If you’re using Docker to self-host Plausible on DigitalOcean or any other virtual machine, you might’ve run into a “502 Bad Gateway” error when attempting to navigate to the administrator dashboard.
It’s a more common problem than you might think, but there are fortunately a few says to figure it out:
1. Give it a minute or two after start-up.
If you set up Plausible using the Plausible Bootstrapper or their recommended docker-compose.yml
, you started everything up by running docker compose up -d
. That -d
flag is helpful, but can also hide feedback from your containers about what’s goin on under the good.
If you ran docker compose up
without that flag, you’d see logs from every container running under the good, and you’d be more aware of the fact that a lot is going on under the hood, and it might take a bit to get to the point of it being ready to receive requests.
On my own virtual machine, it takes several seconds to become fully functional after turning on every container. And in the meantime, incoming requests may be met with a 502 error.
So, if you’re seeing this issue just seconds after turning on everything, it might just required waiting a couple minutes for the containers to boot up properly until they’re ready to received requests.
2. Allocate more RAM.
By default, the Docker engine running on your machine doesn’t have specific memory constraints when running your containers — it’ll just assume the resources available on the machine itself.
But that can mean the specifications of your machine can impact Plausible’s ability to function effectively. Using docker compose logs
in the directory of your Plausible instance can reveal odd errors being through by various components, and they’re often tied to limited RAM available at the time.
On DigitalOcean, an easy way to test this is to resize your machine to one with more RAM:
If you’re on the 512MB size, switching to 1BG can make a big impact. Restart your containers, and it’s possible your issues will go away.
Other Causes?
These are the two most common causes of a 502 Gateway when running my own instances of self-hosted Plausible, but I’m sure it’s not an exhaustive list. If you’ve identified any other culprits, I’d love to hear them. Send me a message or find me on X.
Top comments (1)
Thank you very much for the information about self-hosted.