到位桶网络挂接 [英] Bitbucket Webhooks

查看:235
本文介绍了到位桶网络挂接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的一个项目自动部署到我的服务器。
我米通过使用混帐到位桶到版本控制我的软件。
我来到这个防空火炮的很好的教程。遗憾的是我不能得到它的工作。

如果我从我的本地工作副本推变化,远程回购被更新,但网络挂接给我的 404 错误。所以,我的服务器通信成立,但剧本没有被发现。

当我手动启动通过 PHP到位桶-hook.php脚本拉请求在回购发行,一切正常。

我猜的东西是错误的URL。我试图 HTTP://ip.ip.ip.ip/home/<用户名&gt; /app/deploy/bitbucket-hook.php ,也是域名<。 / p>

解决方案

我已经实现了自己的网络挂接相当倍。

您正在使用访问PHP文件的路径不正确。此路径应该是相对于你的apache的DocumentRoot的(如在/ var / www / html等)

说你的DocumentRoot是/ var / www / html等,然后把你的到位桶,hook.php文件在该路径(即/var/www/html/bitbucket-hook.php),并使用URL作为的 HTTP://ip.ip.ip.ip/bitbucket-hook.php

另外,你可以指向/(根)虚拟主机和使用的http:// ip.ip.ip.ip /家庭/ {用户名} /app/deploy/bitbucket-hook.php

请注意:您还需要与在/ var / WWW当您触发网络挂接的私钥添加您的.ssh文件夹,然后Apache会发现在它的主文件夹的关键即在/ var / WWW

下面是我已经写信给我的自动部署的bash的一部分

`

 回声implenting自动部署的网络挂接......
如果! [-d /var/www/.ssh]];然后
须藤CP -R的〜/ .ssh /无功/网络/
如果[\\ $? == 0]];然后
回声-e'复制的〜/ .ssh记录根apache和[在/ var / WWW] \\ n'
其他
回声-e'出事了,而复制的〜/ .ssh到/ var / WWW \\ n'
科幻
其他
回声已经在/ var /网络文件夹名称的.ssh
科幻
须藤CHOWN R的阿帕奇。 /var/www/.ssh 2 - ;&放大器; 1
如果[\\ $? == 0]];然后
回声-e'/var/www/.ssh的所有权变更到Apache \\ n'
其他
回声-e'出事了,同时改变/var/www/.ssh\
的所有权
科幻
PUSHD的/ var / www / html等
触摸auto_pull.php
须藤CHOWN阿帕奇。 auto_pull.php
回声-e&LT; PHP内容到PHP文件写入&GT;&GT;&GT; auto_pull.php
POPD

`

我希望这将有助于:)

I want to automate the deployment of one of my projects onto my server. I m using git via bitbucket to version control my software. I came accross this this nice tutorial. Unfortunately i cannot get it to work.

If i push changes from my local working copy, the remote repo gets updated but the webhook gives me the 404 error. So communication with my server was established but the script was not found.

When i manually start the script via php bitbucket-hook.php a pull request is issued on the repo and everything works as expected.

I guess something is wrong with the URL. I tried http://ip.ip.ip.ip/home/<username>/app/deploy/bitbucket-hook.php and also the domain name.

解决方案

I have implemented the webhook myself quite a times.

The path you are using to access the .php file is incorrect. This path should be relative to your DocumentRoot of apache (eg /var/www/html)

say your DocumentRoot is /var/www/html then put your bitbucket-hook.php file in in this path (i.e. /var/www/html/bitbucket-hook.php) and use the URL as http://ip.ip.ip.ip/bitbucket-hook.php

Alternatively, you can make a Virtual host which points to / (root) and use http://ip.ip.ip.ip/home/{username}/app/deploy/bitbucket-hook.php

NOTE : you also need to add your .ssh folder with private key in /var/www as when you trigger the webhook then apache will find the key in its home folder i.e. /var/www.

Here is part of my bash which I have written to autodeploy

`

echo "implenting the web hook for auto deployment..."
if ! [[ -d /var/www/.ssh ]]; then
sudo cp -R ~/.ssh /var/www/
if [[ \$? == 0 ]];then
echo -e 'copied ~/.ssh to document root to apache [/var/www]\n'
else
echo -e 'something went wrong while copying ~/.ssh to /var/www\n'
fi
else
echo "Already a folder name .ssh in /var/www"
fi
sudo chown -R apache. /var/www/.ssh 2>&1
if [[ \$? == 0 ]];then
echo -e 'ownership of /var/www/.ssh has changed to apache \n'
else
echo -e 'something went wrong while changing ownership of /var/www/.ssh\n'
fi
pushd /var/www/html
touch auto_pull.php
sudo chown apache. auto_pull.php
echo -e "<?php content to write in php file ?>">>auto_pull.php  
popd

`

I hope this will help :)

这篇关于到位桶网络挂接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆