Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Period of 502 Bad Gateway #47

Open
erfanimani opened this issue Apr 18, 2019 · 6 comments
Open

Period of 502 Bad Gateway #47

erfanimani opened this issue Apr 18, 2019 · 6 comments

Comments

@erfanimani
Copy link

erfanimani commented Apr 18, 2019

Hi there,

Firstly, thanks for providing such a useful Docker environment — the best and fastest I've tried for Magento 2 development so far.

After every restart, there's a period where the web server will "502 Bad Gateway" instantly. At first this was quite annoying because I don't have an indication of when it has "finished" restarting, even though the command itself works quickly. Now I just look at OSX Activity Monitor, and check when the CPU has died down; com.docker.hyperkit will use 120%+ CPU during the 502 error, but Nginx will work well after the CPU has done "doing its thing".

What is it actually doing? Is there a verbose command option that ensures the work is done synchronously? On a large project with app and pub as delegated mounts this is now taking multiple minutes to finish, and it can be quite annoying because as you know, the container restarts often (during copy operations, debugging on/off, etc).

Happy to look into this myself.. I might need some tips.

Thanks

@danielozano
Copy link
Member

danielozano commented Apr 18, 2019

Hi @erfanimani thanks for your help. I'm also experiencing that in some projects (it's more visible in large projects with a big ammount of code).

I don't have much information about that, but I think that containers in mac behave different than in linux because of the filesystem. Docker for mac can't use "native" filesystem and it needs some kind of virtualization, so probably docker for mac is making virtual mounts and copying files inside it (the reason of the bad performance).

I don't recomend you to mount pub, because the filesystem sync in docker for mac is really slow, you could use a volume and do a sync container -> host like we do with vendor (watch command).

Maybe you can do a deeper debug using the Console app for Mac.

I'm sorry for not being more helpful, if you need something please let us know!

@erfanimani
Copy link
Author

erfanimani commented Apr 19, 2019 via email

@frighi-onestic
Copy link

frighi-onestic commented Apr 26, 2019

Hi, as far as I investigated you get a 502 Bad Gateway until the phpfpm container logs the "fpm is ready to handle connections" which takes approximately 15 seconds on my mac.

You can see that with a dockergento docker-compose logs -f after starting the containers.
The 502s are apparently caused by an unavailable docker socket.

@sanaeefar-saeed
Copy link

Hi, as far as I investigated you get a 502 Bad Gateway until the phpfpm container logs the "fpm is ready to handle connections" which takes approximately 15 seconds on my mac.

You can see that with a dockergento docker-compose logs -f after starting the containers.
The 502s are apparently caused by an unavailable docker socket.

phpfpm_1 | [03-May-2019 10:23:57] NOTICE: ready to handle connections
nginx_1 | 2019/05/03 10:22:40 [notice] 1#1: using the "epoll" event method

it takes more than 1 min for me!

@powelles
Copy link

@danielozano How would one go about changing pub to be mounted the same way as vendor? I've got 88GB of images in my pup folder and it takes over an hour to spin up.

@erfanimani
Copy link
Author

@powelles if it helps, I don't actually mount pub at all. I just run dockergento mirror-host /path/to/pub and leave it — there's no need for me to keep it in sync, but your use case may vary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants