我们用git托管代码, 线上有多台服务器, 求代码自动部署同步所有服务器的方法;
希望提供较详细的方案信息, 谢谢!
滿天的星座2017-05-02 09:31:33
Don’t deploy code like this. Synchronization cannot be guaranteed with git pull, and what should I do if the pull fails on a machine? It is recommended to use a separate deployment machine to pull the code and incrementally synchronize it to the server. You can use ansible
怪我咯2017-05-02 09:31:33
First of all, I want to know whether you place the origin bare library on a certain server online, or whether you treat these online servers as clients that clone code from origin.
Secondly, online servers can do the following things to achieve automated deployment: 1. Add hook actions to git. Every time git completes an action, the corresponding action can be executed through the hook; 2. Use Linux corntab and shell scripts can perform some checks regularly, or perform some git updates regularly; 3. Still use the method in 2 to synchronize files regularly, which is the sync mentioned above.
This is my thinking.
phpcn_u15822017-05-02 09:31:33
You have deployed one of the servers in the term using git, and all other servers can be synchronized with the current machine using one-way rsync
为情所困2017-05-02 09:31:33
Use teamcity or jenkins to automatically build tools, and then write scripts to upload the built files to each machine.