502 Bad Gateway - Unable to rebuild

AI-generated summary

502 Bad Gateway - Unable to rebuild

User ethanjs is experiencing issues rebuilding Discourse due to insufficient memory. Despite having a 25GB server, the rebuild process claims it needs more space. Benjamin_D suggests adding the --skip-prereqs flag to the rebuild command, and MarcP advises that if shrinking the 15GB in use is not possible, the only option is to add more disk space.

Ethanjs resolves the issue and thanks the users who assisted. Ed_S clarifies that the problem was a lack of storage space, not memory, and provides tips on how to identify large files on the server, recommending commands like du -kx / | sort -n | tail -49 and find / -xdev -size +1000k -ls | sort -n -k 2 | tail.

I searched through most of the past 502 error topics and haven’t gotten to the bottom of this problem.

I have tried multiple times to rebuild discourse but it’s saying I don’t have enough memory.

I have tried clearing memory with no luck.

For the past 5 - 6 months I haven’t had any issues with memory. Plus I haven’t really added all that much on to the discourse site. It’s just been sitting there while I build out a website.

Do I need to upgrade my memory or is there a way to clear out old updates. It has been a few weeks since the last time I updated Discourse and I believe this took up some space. I’m wondering what I can do to clear memory or if I should consider paying for more memory.

Ideally, I’d prefer to find a solution instead of spending more on space. I have 25 GB server at this moment.

You could try to add to your rebuild command the --skip-prereqs flag (but be sure to have downloaded a backup and your app.yml beforehand, just in case)

If you are unable to shrink the 15GB in use your only option is more disk space. No matter what, there needs to be enough space for the tmp downloads during the rebuild process.

I was able to resolve this.

Thank you @Benjamin_D & @MarcP for reaching out to me. I appreciate you guys taking the time to write to me.

Glad it’s sorted out. (I much prefer to say “storage” when I mean disk space, and “memory” when I mean RAM.) In this case, your problem was a lack of storage space - and indeed, a 25G instance is quite small, but still practical for a small forum. It’s always true that upgrading (updating, rebuilding) demands more resources than just running the forum.

As a tip for anyone in future, see perhaps here:

Or here: