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
`
`
I hope this will help :)