0

I am following this tutorial (https://tighten.co/blog/converting-a-legacy-app-to-laravel/) to migrate a legacy app to Laravel and have made it as far as the "Spring Cleaning" section. My legacy code is in a legacy directory inside my Laravel build.

Our development environment uses Docker Compose to build a container on the host machine (which in my case is a Mac but can be either Windows or Linux as well depending on the developer). The source code is in a volume mounted to the container so that the developer's updates can be seen in the browser as soon as the developer reloads the page.

When I go to get Laravel to load it's default route (the basic route that Laravel builds with) I get page load times in excess of 6 minutes.

I have tried using cached volumes like so: ./:/var/www/portal/:cached

I have also tried following this tutorial (https://www.jeffgeerling.com/blog/2020/revisiting-docker-macs-performance-nfs-volumes) for using an NFS mount. I got it working but the page load size was still over 6 minutes for the default page.

What is causing this extremely slow page-load time? How are Dockerized Laravel Development Environments supposed to be structured to avoid this issue with Docker's VM on Mac and Windows?

I didn't have this problem when developing just in the legacy app. I'm not inclined to think that Laravel itself is causing so large a slowdown. My thought is that it is the Docker VM running on Mac but I haven't been able to prove that yet.

1 Answers1

0

Docker on OS X is just slow. Newer Docker versions have improved this.

Are you actually deploying this Dockerized? If not, consider just using artisan serve.

Marshall Davis
  • 3,337
  • 5
  • 39
  • 47
  • I'm not deploying this dockerized but I was concerned that `artisan serve` wouldn't work for our team. We have a highly customized `php.ini` file and a number of required apt packages installed in the containers as well as xdebug configurations. I have not tried `artisan` yet though. – CarrierPigeon Feb 16 '21 at 19:18
  • I have just tried `artisan serve` and it works locally without any delay at all. The site is nearly instantaneous. But can `artisan` handle complex dev environments the way Docker can? – CarrierPigeon Feb 16 '21 at 19:23
  • Docker is working on it, but being slow on OS X is a known thing. Doubling load times or more for requests that require a lot of file system access seems pretty normal to me. – Marshall Davis Feb 16 '21 at 19:23
  • If it works for you, it should work. You'll just have to instruct your developers on what extensions they need to install prior to running the application. Sounds like you have varied setups available, so I assume they are all comfortable with doing the required installations on their preferred machine. – Marshall Davis Feb 16 '21 at 19:24
  • I appreciate the suggestion. I'll mark this as the answer. Thanks. – CarrierPigeon Feb 16 '21 at 19:27