Node execfunc and deploy script permission error

时间:2016-10-20 18:36:35

标签: node.js git bash deployment continuous

I'm doing a post-receive hook for a Git deployment to delete the directory completely, git pull and replace a Git repo. I have a node server running to listen for the webhook. After it hears the webhook, it would execute the following script.

#!/bin/bash

REPO="git@bitbucket.org:git_repo/my_project.git";
RELEASE_DIR="/var/www/my_project";

echo "deleting " $RELEASE_DIR;
rm -rf $RELEASE_DIR;

echo "making new replease dir"
mkdir $RELEASE_DIR;

echo "changing path into release dir"

cd $RELEASE_DIR;
git clone -b master $REPO $RELEASE_DIR;

chgrp -h www-data $RELEASE_DIR;

I can execute this bash script independent from the service and it runs fine, but I can't get this to run live with the server. Can someone help?

I can get the server up and running and echo the message up until the script runs. I am using Advanced Rest Client extension with Chrome to post the message. But when I run it with bitbucket, i cannot get it the script to run.

1 个答案:

答案 0 :(得分:0)

Bitbucket webhook url was set incorrectly! I had the wrong message URL set initially, debugged using ARC and never updated the URL

If anyone is interested, my original url was

http://example.com:1234/git_message

this was then debugged and the proxy server was set to accept a CNAME url instead to port 80 and rerouted internally to http://localhost:1234. This is the address that the node server was listening too.