Occasionally, after starting my Docksal project for local development, I will get a 502 error when visiting the site. I need help troubleshooting this. I’ve tried a fresh install of Docker, colima (I prefer it to Docker Desktop), and Docksal, but I still get the occasional 502 error. The full error is:
502 Bad Gateway
openresty/1.19.9.1
docker ps
shows that all the required Docksal containers are running and healthy. docker context list
shows that I’m in the "colima" context, which should be correct.
Nothing shows up in fin logs -f
when I load the page and the 502 error occurs.
What else can I do to troubleshoot this error? Right now, the only way I’ve gotten past the error consistently is to shut everything down and cold boot the computer (Mac OS 11.7.3).
UPDATE: I found this issue in the Docksal github. Until the fix is in production, they suggesting running DOCKSAL_VERSION=develop fin update
. So far, it’s working for me.
3
Answers
I asked this in the Docksal Github, and was told this:
After two weeks, this fix appears to work consistently.
I have no detailed explanation, and my answer is not about Mac OS.
My answer is about how I solved the same problem on Linux (Fedora)
.docksal/docksal.env
, replaced this lineVIRTUAL_HOST="abc.docksal"
(you should replace "abc" with your domain) with this one
VIRTUAL_HOST="abc.docksal.site"
(‘.site’ added).
and added these two lines to the top of the file
DOCKSAL_DNS_DOMAIN=docksal.site
DOCKSAL_NO_DNS_RESOLVER=1
From
/etc/hosts
, removed (commented out) this line (probably you don’t have similar line in your file but maybe you’ve added it like me… because of some similar reasons…)192.168.64.100 abc.docksal
Restarted the service
fin p stop; systemctl restart docker.service; fin p start;
The new address of the project is
http://abc.docksal.site
.Manual page: https://docs.docksal.io/stack/configuration-variables/#docksal-dns-disabled
Same problem here, except that even a cold reboot does not help. I actually had the NO_DNS_RESOLVER in place and up and running before it randomly stopped working. (This should be a comment but I don’t have the reputation points.)
EDIT — this might help someone. In the Docker desktop, I deleted the project that was giving me a 502. Then I ran fin project start to re-create it. Not only did it work, it brought up the old db server with a fully populated database. That seems unlikely but it worked.