L
L
lightalex2019-09-21 03:10:21
git
lightalex, 2019-09-21 03:10:21

How to safely git pull on a production site?

Friends, good day!
A small introduction.
Until recently, I uploaded all sites to hosting manually, via FTP. But in connection with the emergence of larger projects than just a business card site, there was a great desire to automate this process. All projects are stored in Git. And of course, to automate the process, the easiest way to do a delivery is with git pull.
But I don't understand how Git works "under the hood". Unfortunately, I did not find such information on the Internet. That's why I'm asking this question.
Let's move on to the question.
Let's assume that we have a highly loaded site, which every moment comes to any user.
If a regular git pull is performed on the server of this site, will it be safe? Will the site fail at some point for some not very lucky user?
Let me explain a little what I mean.
Let's say we have a funcs.php file and an index.php file. Let's say in a new commit in funcs.php we added a new function, and in index.php we used this new function. If we load the update via FTP and at the same time load index.php before funcs.php, then hypothetically, at the moment when index.php is already loaded, and funcs.php is not yet, the user can enter the site by accessing index.php. But at that moment, when trying to access a new function from funcs.php, an error will occur, since we have not yet had time to load the updated funcs.php with the new function added, but at the same time we are trying to access this very function from index.php. It turns out that either it is necessary to control the sequence of downloading files, or to close the site from users for technical work.
How does Git work?
Does it have any mechanisms to protect against such situations? Or does the developer, as in the case of FTP, have to take care of the secure boot himself? If Git does not provide such mechanisms, then what are the ways to safely deploy a site are used in modern web development?
PS Thanks in advance to everyone for participating in the question!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2019-09-21
@lightalex

elementary: they don't do it.
a modern deployment is much more complicated than a banal git pull . especially if you want migrations, asset builds, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question