search

Home  >  Q&A  >  body text

多台服务器集群, 如何使用git自动部署代码

我们用git托管代码, 线上有多台服务器, 求代码自动部署同步所有服务器的方法;

希望提供较详细的方案信息, 谢谢!

淡淡烟草味淡淡烟草味2762 days ago1631

reply all(6)I'll reply

  • 滿天的星座

    滿天的星座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

    reply
    0
  • 怪我咯

    怪我咯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.

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-02 09:31:33

    rsync server file synchronization

    reply
    0
  • phpcn_u1582

    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

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:31:33

    Use Capistrano

    reply
    0
  • 为情所困

    为情所困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.

    reply
    0
  • Cancelreply