Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper development environment for Symfony2 Windows/Linux

First of all, I know that by the title this must be the 400th time this has been asked so I'll do my best to make this time different.

From some time now (more than 2 years..) our team has struggled a lot with setting up the environment for development. Our usual setup is to use Fedora24-25/Php-fpm/nginx/mariadb as the server. However, we are "required" to use Windows due to some programs that we have to use.

The current scenario

Right now, we are using VirtualBox/VMWare Workstation to virtualize Fedora and run our Symfony2 application there. The reason that I don't want to develop on Windows and then use the application in Fedora for production is due to compatibility issues that come when you have those 2 different OS.

One of the developers (me) is currently sharing via SMB the folder with all the applications to a mounted drive in Windows and using PHPStorm on Windows.. also telling Symfony2 to redirect cache/logs to another folder so that PhpStorm doesn't have to index that, for me so far this has worked the best so far..

The problem

The problem comes when we need to do the development.. right now we are working off Fedora with PhpStorm and that means that we are coding right from our VirtualBox.. so at this point for development purposes Windows (a.k.a the host) is pretty much useless... since we have both IDE and server running on the VM..

Having that said, it is pretty obvious that the problem comes with performance, we have pretty decent setups (HP Folio 9470m i7 16GB with an SSD).. but you can still feel the overhead and the slowness of doing the development on a VM... needless to say the fact that to go between Windows and Linux you have to be switching those windows and that is painful.

Problem #2: we have a 3 monitors setup, and the importance of this clarification will come in the next section.

What I have tried

  1. Having the application files on Windows, and mounting them via CIFS/SMB/NFS on Fedora.

With this approach, the best results I've got are using NFS. Normally, on a fresh installation of Symfony2 2.8, you get a response time of around 50ms on the profiler with php-opcache installed. However, using CIFS or SMB that increases drastically to around 500ms, with NFS I've been able to get around 60ms..BUT, there is a catch.. on Windows 10 pro there is no way to use NFS natively.. we would have to upgrade to Enterprise which at the moment is not a posibility.

Also, to be able to use this approach, I've had to redirect the cache/ and logs/ folder of symfony to another folder inside Fedora. Otherwise the I/O would kill that 60ms response time using a mounted folder.

  1. Docker

With this approach, I've had exactly the same problem.. this is a very usual error that's going on around google with Symfony2 and docker slowness due to the volume being like a shared volume.. the same I/O performance issue..

  1. Using Linux as the main OS and virtualizing Windows

I thought this was going to be the real deal... but it turns out that I experienced several issues.. I have been using linux for a long time so I know how to move around.. with Linux I had issues like:

a. I use 2 headphones...one for a Softphone and one (earbuds) to listen to music.. I wasn't able to get Fedora to always use one device for the softphone and one for other applications ...everytime I rebooted it went back.. (not important, can live without this)

b. Problem #2 specified above, I tried: Fedora, Linux Mint, and Ubuntu and in every distro I got a CRTC error when trying to setup my 3 displays..

c. No HeidiSQL support (shame, but I can live without this also)

as far as NGINX/PHP/Symfony2 everything worked properly

  1. Having all the files in Linux, and mounting a drive on Windows

Same performance issues but this time with PhpStorm.. due to the fact that the files are over the network bla bla bla...

The Question

Basically, my definite question is, how is everyone doing to get a smooth development environment FROM windows using LINUX as a server and Symfony2/PHP as the language/framework?

I am pretty sure that I am not alone in this situation, and the more I research, the more the question remains..

Sorry for the long question!

like image 506
Benjamin Vison Avatar asked Oct 29 '22 12:10

Benjamin Vison


1 Answers

Ok so this is what I came up with...

  • I am sharing the application folder in Linux via CIFS and mounting it as a drive on Windows using a Host-Only network adapter so I don't have to worry about changing connections.
  • I disabled the graphical interface to save resources
  • I am using VBoxVMService (http://vboxvmservice.sourceforge.net/) to start the VM automatically as a service so I don't have to be opening VirtualBox
  • Using Putty as my terminal
  • on Symfony, I am overriding the getCacheDir() and getLogDir() on the AppKernel and throwing those off to another folder which is not in the shared folder.

I have spent a whole day working on 4 applications (that's 4 PhpStorm instances opened) and it has been working just fine. The only time it is slow is when you first add the project that the IDE has to index everything.

I'll leave this here in case it helps anyone else or anyone else has any additional comments.

like image 65
Benjamin Vison Avatar answered Nov 15 '22 07:11

Benjamin Vison