diff --git a/Dockerfile b/Dockerfile index 5a1d7ce..53b0f2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN sed -i '/blahblah/i\return 0;' config.m4 && \ mkdir -p /iconv/lib/php8/modules/ && mv ./modules/iconv.so /iconv/lib/php8/modules/ FROM alpine:3.16 -RUN apk add --no-cache nginx php8 php8-fpm php8-iconv +RUN apk add --no-cache nginx php8 php8-fpm php8-iconv php8-pcntl COPY --from=iconv /iconv/ /usr/ COPY --from=vlmcsd /tmp/vlmcs* /usr/bin/ EXPOSE 1688/tcp 1689/tcp diff --git a/src/demo.php b/main.php similarity index 63% rename from src/demo.php rename to main.php index 67c2662..c68b0bd 100644 --- a/src/demo.php +++ b/main.php @@ -1,8 +1,10 @@ 'nginx', @@ -24,12 +26,18 @@ $vlmcsd = array( declare(ticks = 1); pcntl_signal(SIGCHLD, 'subExit'); // receive SIGCHLD signal +logging::info('Loading kms-server (' . $version . ')'); new Process($nginx['command']); +logging::info('Start nginx server...OK'); new Process($phpFpm['command']); +logging::info('Start php-fpm server...OK'); new Process($vlmcsd['command']); +logging::info('Start vlmcsd server...OK'); + +logging::info('Enter the daemon process'); while (true) { - msSleep(3000); // sleep 3s + msSleep(5000); // sleep 5s daemon($nginx); daemon($phpFpm); daemon($vlmcsd); diff --git a/src/Logger.php b/src/Logger.php index 1129ca4..14f3cb6 100644 --- a/src/Logger.php +++ b/src/Logger.php @@ -1,6 +1,6 @@ '37m', // white diff --git a/src/Process.php b/src/Process.php index 7fafb23..ea3d867 100644 --- a/src/Process.php +++ b/src/Process.php @@ -56,27 +56,3 @@ class Process { return proc_close($this->process); // return status code } } - - -//$p = new Process(['sleep', '10'], $capture = true); -//echo "PID -> $p->pid\n"; -// -//echo "Alive -> " . ($p->isAlive() ? 'yes' : 'no') . "\n"; -//echo "Sleep 5s...\n"; -//sleep(5); -// -//echo "Alive -> " . ($p->isAlive() ? 'yes' : 'no') . "\n"; -//echo "Send kill signal\n"; -//$p->signal(15); -//sleep(1); -//echo "Alive -> " . ($p->isAlive() ? 'yes' : 'no') . "\n"; -// -//echo '--------------------------------------------' . PHP_EOL; -//echo $p->getStdout(); -//echo '--------------------------------------------' . PHP_EOL; -//echo $p->getStdout(); -//echo '--------------------------------------------' . PHP_EOL; -//echo $p->getStderr(); -//echo '--------------------------------------------' . PHP_EOL; -// -//echo "Return code -> " . $p->quit() . "\n";