laradock 部署的项目中如何增加 GitLab 的 webhook ?
最近打算在项目中增加 webhook 来实现,有 push event 的时候,可以自动 git pull,不过总是不可以,不知道是不是跟 laradock 有关。
下面是我的做法:
- 将docker 跑起来:
docker-compose up -d nginx redis mysql
- 在gitlab 中增加 webhook
比如,指向地址 http://example.com/deploy - laravel 中增加路由和控制器
// web.php Route::post('/deploy', 'DeployController@index')->name('deploy'); // DeployController //........ $result = shell_exec("/usr/bin/git pull"); logger('success result: ' . $result); $this->success(); //.........
然后就是一直都没法自动跑起来,没有执行git pull这个操作
我找了下 php-fpm 会有对应的报错:sh: 1: /usr/bin/git: not found
[22-Jan-2018 07:46:46] WARNING: [pool www] child 7 said into stderr: "sh: 1: /usr/bin/git: not found"
有没有大佬帮忙看一下!!
public
目录下面, 需要cd
到网站根目录git
的用户是nginx
的用户,laradock
的nginx
用户为www-data
(是否有权限pull)git仓库
是公开的还是私有的,私有的需要配置git
用户信息或者sshkey
请教同样的问题,麻烦各位高手解惑
使用laradock环境
nginx容器中触发shell脚本
但shell脚本在workspace容器中才能执行,麻烦各位高手帮忙解惑
能问下这个问题最后怎么解决的吗
laradock的nginx运行的php-fpm不是workspace这个容器的,而且php-fpm这个容器,php-fpm这个容器并没有安装git,deployer等工具