yeswework / fabrica-dev-kit

A toolkit for faster, smoother WordPress 5 development
https://fabri.ca/
MIT License
274 stars 27 forks source link

Extremely Slow Docker Containers due to Docker on Mac issue #27

Closed tyrannosaurus-jamie closed 7 years ago

tyrannosaurus-jamie commented 7 years ago

I'm having an issue with an extremely slow Docker installation. From what I can tell, this isn't something new among Docker for Mac users.

See this issue: https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076

Like it says, one option is to use docker-sync which I've been experimenting with in my build but haven't quite gotten there.

My issue is that this doesn't seem to be an unusual problem to be having but does seem to be something nobody else using the fabrica dev kit has run into. Is this being addressed elsewhere?

tiojoca commented 7 years ago

We did consider using docker-sync in the early stages of FDK but soon realized it was tricky and error-prone to try and set it up automatically, so we decided to leave it to the user to add this manually and haven't experimented much with it since. Please let us know of your progress with it if you manage to use it successfully.

tyrannosaurus-jamie commented 7 years ago

I did manage to get it working and it does seem to help; My fans are running like mad and my system doesn't slow to a crawl. I've even manage to add it to my gulp build process. So far, the only problem seems to be if I stop the node server, they sync-containers get "un-sync'd" somehow. I haven't explored it completely. So even just running gulp doesn't work and I'm back at square one. If I run docker-sync clean so the sync containers get destroyed and then gulp again, everything works. It kind of defeats the purpose but, it's worth it, for now, to continue that. I'll likely look into how or why the container's stop syncing if the node server stops. Finally, and I don't think this would affect it, I've removed PreCSS and moved over to compass for compiling my SCSS.

tyrannosaurus-jamie commented 7 years ago

Another update.

Today I was working on my site when I had a JS error which crashed the server. Worried that I was going to have to rebuild my docker-sync containers I tried to stop them first. Running

docker-sync stop

and then running

gulp

worked. In fact, hoping I don't jinx it, my fans haven't spun up all morning. The only issue for me right now is automating this some more. I'm not the best yet with gulp. Checking to see if docker-sync is running and if it is, run docker-sync stop so that you can start again with gulp might be what I try first.

tiojoca commented 7 years ago

That's great, thanks for keep us updated with your progress. Can you share your changes to gulpfile.js?

tyrannosaurus-jamie commented 7 years ago

Here is the gulpfile.js And here are the docker-sync.yml & docker-compose-dev.yml files. It's on gitlab because reasons.

andrewstaffell commented 7 years ago

Hi @tyrannosaurus-jamie, I just wanted to add to @tiojoca's earlier comments that the reason we didn't bother to implement docker-sync, despite looking into it, was that we've never observed significant performance issues on any of our FDK installations. So it would be good to understand why it might be happening in your case. What Mac are you using? (How old / CPU / RAM?) Can you think of any other factors? Thanks!

tyrannosaurus-jamie commented 7 years ago

Hi @fewerflatlands, I wondered if that were the case. I'm using a late 2013 MacBook Pro. 2.4 Ghz i5 8GB RAM

andrewstaffell commented 7 years ago

@tyrannosaurus-jamie That doesn't sound too old, honestly I'm surprised about the bad performance. I wonder if some other program/process is interfering. Anything noticeable in Activity Monitor while you have the Docker containers up and Gulp running etc?

tyrannosaurus-jamie commented 7 years ago

I did check that out at first and I didn't see anything. And then I checked it out even more thoroughly after I realized that Docker Sync might be my best option. I can't see anything out of the ordinary but it's never a bad idea to check again. I'll do that today.

Thanks so much for your feedback.

andrewstaffell commented 7 years ago

No problem. I'll close the issue because I don't believe this is related intrinsically to FDK, but feel free to re-open or comment again if you come to conclude otherwise.

Thanks for trying FDK, always happy to have feedback.