www-data lance les serveurs tmux

This commit is contained in:
Valentin
2024-02-25 22:18:51 +01:00
parent 5ef8f2271d
commit 394c2dfb21
3 changed files with 41 additions and 33 deletions

View File

@@ -23,23 +23,6 @@ if (empty($payload)) {
exit();
}
// get header signature
$header_signature = isset($_SERVER['HTTP_X_GITEA_SIGNATURE']) ? $_SERVER['HTTP_X_GITEA_SIGNATURE'] : '';
if (empty($header_signature)) {
error_log('FAILED - header signature missing');
exit();
}
// calculate payload signature
$payload_signature = hash_hmac('sha256', $payload, $secret_key, false);
// check payload signature against header signature
if ($header_signature !== $payload_signature) {
error_log('FAILED - payload signature');
exit();
}
// convert json to array
$decoded = json_decode($payload, true);
@@ -50,5 +33,6 @@ if (json_last_error() !== JSON_ERROR_NONE) {
}
// success, do something
shell_exec('sh ../webhook/webhook.sh')
echo "launching hook script ";
shell_exec('sh ../webhook/webhook.sh 2>&1');
?>

View File

@@ -1,3 +1,15 @@
#!/bin/bash
username=$(getent passwd 1000 | cut -d: -f1)
touch /home/$username/webhook_ok
cd /home/$username
directories=$(find . -maxdepth 1 -type d -printf "%f\n")
for dir in $directories; do
if [[ ! "$dir" =~ ^cms ]]; then
cd "$dir" || exit
break
fi
done
git pull origin prod
tmux send-keys -t directus C-c
NUXT_TELEMETRY_DISABLED=1 bash -c \"npm run build\"
tmux send-keys -t front \"cd /home/${username}/${front_folder} && node .output/server/index.mjs\" C-m
tmux send-keys -t directus \"npx directus start\" C-m