Git as a Deployment, Development, and Backup

I've been using Git for over a year now, but I feel like I need to fine-tune my workflow. I hope you help! Now I have 5 computers:

3 DESKTOPS / DEVELOPERS: Where we do all the work, and when we are happy with the changes, we push them to the web server.

WEBSERVER: The web server receives clicks, and then it has a hook to automatically check them (so that they immediately begin to live immediately after clicking on the desktop). This is the central unit that all computers use to push and pull.

BACKUP: Well, I don't have this yet, but I plan to install it. First you need some advice.

Some questions about all of this:

  • Of course, sometimes images, etc. loaded via Apache directly on the web server. We do not receive these files on desktop computers unless we manually add and commit remotely on a web server. Would it be nice to have a cronjob that automatically adds and commits every night to the web server?

  • I plan to install a backup server for websites. At first I watched Rsync and rdiff-backup, but then it hit me, it might be better to use Git. Then I will also have a story with all the fixations. Would that be a good idea? If so, am I just doing a cronjob with git pull?

  • Some repositories become very large due to deleted and cached images. We have a lot of hard drives on desktop computers and on a backup server, so this is not a big problem, but a hard drive is very expensive on a web server. Is it possible to automatically delete and reset all deleted and cached files on the web server every night, but still have a complete history on the desktops and backup server?

+4
source share
1 answer

This is a lot of questions. The most important answer: do not save your dynamic images in git. This is not what git was designed for and is usually a bad idea. It also answers the question number 3: no, it is impossible. Only store images in git that are part of your code / site.

Regarding backups: it looks like your code does not need more backups. You already have 4 full copies of the code on different computers in different places. If yours doesn’t need another backup in a fireproof bunker, I don’t think there is much room for improvement.)

If you want dynamic images from the server on your clients to write a script that synchronizes them via ftp.

+2
source

Source: https://habr.com/ru/post/1435800/


All Articles