logging du webhook

This commit is contained in:
Valentin 2024-02-27 16:57:10 +01:00
parent f192e4bcbe
commit da2617d9e4
3 changed files with 10 additions and 9 deletions

View File

@ -35,5 +35,5 @@ if (json_last_error() !== JSON_ERROR_NONE) {
// success, do something
$repo_name = $decoded['repository']['name'];
echo "launching hook script ";
echo shell_exec('bash ../webhook/webhook.sh ' . $repo_name . ' 2>&1');
echo shell_exec('bash ../webhook/webhook.sh ' . $repo_name . ' >> ../webhook/webhook.log 2>&1');
?>

View File

@ -1,12 +1,11 @@
#!/bin/bash
repo_name=$1
cd /var/www/repositories/$repo_name
git pull origin prod
tmux send-keys -t directus C-c
npm install -y
npx nuxt telemetry disable
npm run build
tmux send-keys -t front C-c
tmux send-keys -t front "cd /var/www/repositories/${repo_name} && node .output/server/index.mjs" C-m
cms_dir=$(ls -d /var/www/repositories/cms*/)
tmux send-keys -t directus C-c
tmux send-keys -t front C-c
cd /var/www/repositories/$repo_name &&\
git pull origin prod &&\
NUXT_TELEMETRY_DISABLED=1 ; npm install -y &&\
npm run build &&\
tmux send-keys -t front "cd /var/www/repositories/${repo_name} && node .output/server/index.mjs" C-m
tmux send-keys -t directus "cd ${cms_dir} && npx directus start" C-m

View File

@ -399,6 +399,8 @@ if [[ "$answer" == "y" ]]; then
cp ./assets/webhook.sh /var/www/webhook
chown www-data:www-data /var/www/webhook/webhook.sh
chmod u+x /var/www/webhook/webhook.sh
touch /var/www/webhook/webhook.log
chown www-data:www-data /var/www/webhook/webhook.log
head -n $(($(wc -l < $caddyfile) - 2)) $caddyfile > temp_Caddyfile && mv temp_Caddyfile $caddyfile
echo "handle /webhook.php {" >> $caddyfile