Fix updater git dubious ownership
This commit is contained in:
@@ -6,4 +6,4 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- ${DOCKER_CONFIG_DIR}:/config
|
- ${DOCKER_CONFIG_DIR}:${DOCKER_CONFIG_DIR}
|
||||||
@@ -9,6 +9,12 @@ if (empty($secret_key)) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$docker_config_dir = getenv('DOCKER_CONFIG_DIR');
|
||||||
|
if (empty($docker_config_dir)) {
|
||||||
|
error_log('FAILED - docker config dir missing from environment');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
// check for POST request
|
// check for POST request
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
error_log('FAILED - not POST - ' . $_SERVER['REQUEST_METHOD']);
|
error_log('FAILED - not POST - ' . $_SERVER['REQUEST_METHOD']);
|
||||||
@@ -60,9 +66,9 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
// success, log something without error_log
|
// success, log something without error_log
|
||||||
error_log('SUCCESS - ' . $decoded['ref']);
|
error_log('SUCCESS - ' . $decoded['ref']);
|
||||||
|
|
||||||
chdir('/config');
|
chdir($docker_config_dir);
|
||||||
exec('git pull');
|
exec('git pull');
|
||||||
exec('docker compose up -d --quiet-pull > /proc/1/fd/1 2>/proc/1/fd/2 &');
|
exec('docker compose up -d --quiet-pull > /dev/stdout 2>/dev/stderr &');
|
||||||
|
|
||||||
// send return code and text message
|
// send return code and text message
|
||||||
http_response_code(200);
|
http_response_code(200);
|
||||||
|
|||||||
Reference in New Issue
Block a user