Hi i have set up discourse now (working) but i get the “502 Bad Gateway” error often, and the site is very slow? How to fix this problem in the best way?:s
AI-generated summary
The discussion revolves around fixing the “502 Bad Gateway” error on a Discourse setup. ignatus reports experiencing the error and slow site performance on a VPS with 1GB RAM and 20GB disk space. pfaffman and riking suggest that the issue may be due to insufficient RAM. ignatus reveals that they bypassed the discourse-setup warning about insufficient RAM and didn’t create swap space.
Experts, including pfaffman and RGJ, emphasize the importance of swap space, especially with less than 2GB RAM. Benjamin_D suggests that the VPS provider might not allow swap creation due to virtualization limitations, and RGJ reiterates that swap space is necessary to fix the issue. ssvenn recommends upgrading RAM to at least 4GB to avoid needing swap space, as RGJ notes that 4GB RAM is required to perform upgrades without swap space.
Do you have a spinning disk or very little ram?
my Discourse is on VPS
here is the VPS data
| CPU Cores | 1 |
|---|---|
| Total CPU Speed | 2.4Ghz |
| Memory | 1Gb |
| Disk Space | 20Gb |
Generic Unix server performance guides can help diagnose, but you may have too little RAM for the current load.
Did you let discourse-setup create swap?
Do you have plugins installed?
no, that was the issue, my VPS provider didnt allow me to execute the command
“swapon /swapfile” but somehow i did install docker without it, and then i just “nano containers/app.yml” with all the data, and then ran “./launcher start app”… Yes i have some plugins installed also.
So discourse-setup warned you that you didn’t have enough ram and you were clever enough I bypass that warning. And the docs say that you need swap of you have less than two gb. Even with 2gb, without swap, you’ll likely have trouble when you rebuild to do an upgrade.
idk, 1 only have 1 GIG Ram on my VPS, (as i mentioned in the earlier post). so i need to fix the swap and the docker? Right
Any useful commands i can use then? (i be grateful for any help) thank you
reminds me this topic
So your vps might not have full virtualization, and it might be easier to change hosting provider, getting ahead of future problems.
Contact them and get that resolved.
However, many VPS providers just don’t want you to do that since it wears out their SSD drives too quickly.
ok 2nd option? i cannot change VPS provider and i cannot execute “swapon /swapfile”, is they no other way to fix the issue? ![]()
No, there is no other way to fix the issue. You need swap.
Talk to the VPS provider about upgrading your RAM amount. You don’t need swap with enough RAM.
You could look at using a service monitoring utility like monit to automatically restart your container when processes crash but the problem will get worse the more active users you have and there’s a risk of corrupting the database over time.
ok thanks for the answer, then i know
If you want to do without swap completely then you’ll need at least 4GB of RAM otherwise your upgrades will miserably fail - which will probably mean you will need to spend 4x what you’re spending right now.

