For a long time in the department of the company where I work, different projects were led and developed by different people. But as time went on, projects grew, and many projects began to demand participation in the development of the team. How it happened with us - there was a test server and a local version of the project for each developer. When someone made changes, he rolled them out to the test server, but, a situation regularly occurred when one developer overwritten the changes of another. So we made our first step towards “civilization” - we deployed our git server. The situation has improved significantly, but there remains a big problem - configs. At first they solved it by adding them to .gitignor, but this did not add any convenience. Plus, when a new person connected to the project, he had to take default configs and configure them for his environment (not every tester or the same layout designer can adequately do it). Again - questions with installed modules for each team member.
And here comes an understanding - the environment should be as uniform as possible for everyone, and it should be as close as possible to the actual conditions of operation of the final products. In this case, you can not deprive the developers of their favorite IDE. Whatever they say, but most developers use Windows, and the final web hosting with PHP is unix. In my practice, I have repeatedly stumbled upon a "rake" - locally everything works under Windows - we post on hosting and everything is bad.
So I came to the conclusion - you need to organize a symbiosis of Windows and Unix. The solution, in general, lies on the surface - a virtual machine under windows, with any unix-like system inside.
VMware Workstation was chosen as a virtualization system.
We add to the virtual machine two network cards. One type of "NAT" (you need to go to the virtual machine to the Internet), another type "For the site only". Through it we will walk from the parent car.
')
Ubuntu Server was installed into the virtual server (the choice is based solely on my preferences, plus it impresses with the presence, and timely updating, of all the necessary packages), plus the standard LAMP (there are enough installation instructions on the Internet). Nothing unusual yet.
But then a little bit of "magic" in setting up this economy, so that everything is convenient.
Be sure to install VMware Tools in the virtual. Create a “web” folder on any local disk under Windows (the name can be anything, but then it should be such for all team members). We connect this folder to the virtual folder as a shared folder.
We look where we connected in the system
We see that the mount point is "/ mnt / hgfs".
Now we need the folders from "/ mnt / hgfs / web" to automatically connect to apache.
First of all, add the config to "/ etc / apache2 / sites-enabled":
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /mnt/hgfs/web ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Thus, we get that we can open any of the project at the address “https: // server_name / folder_name /”. But it is not always convenient. That is why we add the creation of local domains as well.
Create the file "/root/web/elap.conf" as follows:
<VirtualHost *:80> ServerName domen ServerAdmin webmaster@localhost DocumentRoot path ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <Directory "path"> Options Indexes FollowSymLinks MultiViews AllowOverride all Require all granted </Directory> </VirtualHost>
Then we write the following script:
And we add it to kroner (I put it once a minute) - only you have created a new folder in the “web” folder, while pulling data from the git, the domain in the “http: //name_folder.local” virtual folder is already connected.
Now we need Windows to learn about these local domains. It was possible to go two ways - to raise a server in a virtual server or use the “hosts” file in windows. I decided to go the second way.
We look at the address that is issued to the network card type "Only for the node." Unfortunately, for each installation of VMware it is individual (or I did not find how to fix it), and therefore, when setting up this bundle on the team members' computers, it is necessary to change it. One thing pleases - later it does not change already locally.
We see that the “eth0” network card we need with the address “192.168.81.128”. We add the following line to “C: \ Windows \ System32 \ drivers \ etc \ hosts”:
192.168.81.128 web
And we write the following script:
@echo off set workdir=d:\web\ dir %workdir% /A:D /B > %workdir%list_project.txt find /V ".local" C:\Windows\System32\Drivers\etc\hosts > %workdir%hosts_new for /F %%i in (%workdir%list_project.txt) do ( echo 192.168.81.128 %%i.local >> %workdir%hosts_new ) copy %workdir%hosts_new C:\Windows\System32\Drivers\etc\hosts
Now, after adding a new project to the “web” folder, we need to run this script once as an administrator (!!!) and the local domain will be available to you.
Then just clone the virtualka to all employees.
Actually such a system is run-in, and it works fruitfully. One problem has not been solved yet - DB. Now in all projects we save the database in the folder “sql” and when installing a local copy of the project we have to manually fill the database. There are questions how to track changes in the database. How to notify about them. If you have a solution - please in the comments.