We're building our first webproject with laravel and angularjs and trying to figure out how to setup our development environment. Our current approach looks like this:
So some of us could work on the backend/frontend without the need of messing around with the frontend/backend files. Now, if there is a new version of e.g. a dev branch on the backend repo and I am working on the frontend, I want the frontend repo to automatically pull this new backend version from the git server and copy it into the development environment of the developer (on his workstation). That should guarantee that we can use the latest api routes in our frontend development.
The questions are:
This answer is just one of the many ways to accomplish this and defining a "best approach" is quite relative.
In your Apache or Nginx, create different hostnames for different branches and, in each root directory (like public_html
) pull the specific branch.
This way you allow your frontend devs to test multiple branches without compromising other devs.
git pull
periodicallyThis is not an optimized option but it is simple. Many complex solutions exist to auto pulling (like here and here) but, as I said, they are complex.
You can define an extremely short period to your cron job (like 5 or 10 minutes) since there are no problems when you pull and there aren't updates.
Probably you have one but, if not, define a branching model with your co-workers, like the old but gold Git branching model by Vincent Driessen.
One key aspect is that you allow your devs (both front and back) to work with their changes without affecting the others.
Usually each dev will only merge its local branch with the upper level after some tests (local to dev, dev to release, release to master), avoiding undesired error propagation.
This way each one can test its own code, including frontend devs using one of the backend virtual hosts to complete the test.