Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用gitlab自动部署_Git_Deployment_Nginx_Gitlab_Ubuntu Server - Fatal编程技术网

使用gitlab自动部署

使用gitlab自动部署,git,deployment,nginx,gitlab,ubuntu-server,Git,Deployment,Nginx,Gitlab,Ubuntu Server,我们办公室的ubuntu服务器上运行着Gitlab服务器。我正在使用来自每个repo的post-receive钩子进行自动部署。这就是我所做的 我在post-receive文件中编写了shell脚本,将代码从gitlab服务器推送到实际的生产服务器 因此,我们的gitlab服务器中的所有repo都有post-receive钩子来进行自动部署 我在生产服务器中安装了git bare repo以接收代码gitlab server 在生产服务器的裸repo中,我编写了另一个post-receive钩子

我们办公室的ubuntu服务器上运行着Gitlab服务器。我正在使用来自每个repo的post-receive钩子进行自动部署。这就是我所做的

  • 我在post-receive文件中编写了shell脚本,将代码从gitlab服务器推送到实际的生产服务器
  • 因此,我们的gitlab服务器中的所有repo都有post-receive钩子来进行自动部署
  • 我在生产服务器中安装了git bare repo以接收代码gitlab server
  • 在生产服务器的裸repo中,我编写了另一个post-receive钩子,使用
    GIT\u-WORK\u树部署代码,并在相同的post-receive钩子中重新启动nginx服务器
  • 现在,我想通过现有的标准工具进行自动部署,因为使用这种部署方式,我需要配置所有repo,因此再次需要花费大量时间。执行此自动部署的其他方法有哪些

    生产服务器:ubuntu 14.04LTS, 生产Web服务器:nginx, 本地git服务器:gitlab

    更新:我现在想这样做,因为正如@Ciro Santilli解释的那样,我对gitlab shell有问题。在我遇到gitlab shell问题后,@Ciro Santilli answer的链接提到,我也在做git推送生产。但我想做的就是Gitlab_CI所做的,
    push to master branch
    我们的生产服务器应该更新。我将尝试使用Gitlab_CI,但我想知道是否还有其他工具可以这样做。

    编辑:对于,如果您具有文件系统访问权限,不使用挂钩的旧理由不再适用。但是,我仍然建议使用CI,因为它是:

    • 更易于维护,特别是使用
      .yaml
    • 与存储库更为隔离,因此不太可能分解内容
    在自定义挂钩功能之前不使用挂钩的原因:

    • 它们在所有回购协议中共享
    • 当您更新gitlab shell时,它们可能会生成合并冲突
    • 它们是gitlab的安全关键,触碰它们会让您面临漏洞
    正如在以下会议上所讨论的:

    除非您指定了更多关于部署的信息,而不是希望使用Git进行部署,否则GitLab对此没有任何特定信息,答案与一般Git问题的答案相同:


    如果您有更具体的需求,可能会有一个服务可以满足您的需求:,但我将把它留给另一个更具体的问题

    对我的自动部署有用吗?@niren我从未接触过ansible,所以我不知道=(