Answer the question
In order to leave comments, you need to log in
How to properly set up a dev environment for web development?
Hi all! Guys, tell me some best practices on how to properly organize a dev environment for web development. There is the following specific case: An
international portal, with several separate services. For example, as Yandex has metrika.ya.ru, webmasters.yandex.ru, direct.yandex.ru and all these are different services/offices.
We have the same thing, we have the main portal and several separate services:
/home
- vasya (dev1)
- www
- company
- frontend
- backend
- service1
- service2
- service3
- petya (dev2)
- www
- company
- frontend
- backend
- service1
- service2
- service3
- kolya (dev3)
- www
- company
- frontend
- backend
- service1
- service2
- service3
company-dev.com
and virtual hosts are configured for each developer:dev1.company-dev.com
dev1service1.company-dev.com
dev1service2.company-dev.com
dev1service3.company-dev.com
dev1admin.company-dev.com
dev2.company-dev.com
dev2service1.company-dev.com
dev2service2.company-dev.com
dev2service3.company-dev.com
dev2admin.company-dev.com
dev3.company-dev.com
dev3service1.company-dev.com
dev3service2.company-dev.com
dev3service3.company-dev.com
dev3admin.company-dev.com
company.com -> company-dev.com
service1.company.com -> service1.company-dev.com
service2.company.com -> service2.company-dev.com
service3.company.com -> service3.company-dev.com
admin.company.com -> admin.company-dev.com
Answer the question
In order to leave comments, you need to log in
Don't think about domains. You have mixed administration and programming. No dev server needed. Do work on the local dev machine, push changes to a remote repository, and that's it. You don't have to install nginx/apache at all, etc. to the local dev machine, so as not to bother with all sorts of domains, and run the project under the built-in PHP server , for example, from the project root, and then you will access your services at localhost:port/service1/index.php
, localhost:port/service2/index.php
etc.
Domains will be created already in production. In the simplest case, clone the remote project repository to the production machine and in the nginx configs you will need to write something like this
server {
server_name company.com;
root /home/www/company/frontend;
...
}
server {
server_name admin.company.com;
root /home/www/company/backend;
...
}
server {
server_name service1.company.com;
root /home/www/company/service1;
...
}
server {
server_name service2.company.com;
root /home/www/company/service2;
...
}
Deploy GIT?
The ideal scheme in my opinion would be:
And actually the branch will not be for the developer, but for the feature / fix / dev You
can read about the structure of the repository here: https://habrahabr.ru/post/106912/
I won’t tell you how to implement this, so this is nothing more than a concept.
PS as for me, if the developers edit the same file, then it's a matter of setting tasks for them.
I did this for myself:
There was a combat server, for example, prosto-tak.ru, and a dev server - dev.prosto-tak.ru
Started a separate domain for each developer, like
parotikov.dev.prosto-tak.ru there was access to the control panel (we used vesta cp), where he could build further a hierarchy on top of his nominal subdomain: project1.parotikov.dev.prosto-tak.ru, project2.parotikov.dev.prosto-tak.ru
Further, if necessary even more detailed, you can add the release version, branch name, etc: feature.project1.parotikov.dev.prosto-tak.ru, service.project1.parotikov.dev.prosto-tak.ru
Yes, it looks a bit redundant, but worth it once to explain to everyone this domain model, namespace, so to speak, and everything becomes very harmonious.
The burden of creating your own subdomains fell on the developer himself, since everything is done there in 3 clicks. Who needs it - he creates the necessary structure for himself, and nothing superfluous is duplicated for him.
In a conversation, it’s generally very simple: Pupkin tells you - open a site with a branch55 branch on the third service. And you open branch55.service3.project1.pupkin.dev.prosto-tak.ru. And locally at home, so as not to drive in a long url every time, you can also hang an alias in hosts.
PS: But if it's massive, then it's better to use some kind of ansible conductor with templates.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question