1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
Daniel Neto 2024-06-11 14:07:39 -03:00
parent e0070be0ef
commit f8e22fc7fc
5 changed files with 15 additions and 7 deletions

View file

@ -117,7 +117,7 @@ echo "entrypoint -- Writing /var/www/docker_vars.json"
echo "{\"SOCKET_PORT\":${SOCKET_PORT}, \"HTTP_PORT\":${HTTP_PORT}, \"HTTPS_PORT\":${HTTPS_PORT}, \"SERVER_NAME\":\"${SERVER_NAME}\", \"NGINX_RTMP_PORT\":${NGINX_RTMP_PORT}, \"NGINX_HTTP_PORT\":${NGINX_HTTP_PORT}, \"NGINX_HTTPS_PORT\":${NGINX_HTTPS_PORT}}" > /var/www/docker_vars.json echo "{\"SOCKET_PORT\":${SOCKET_PORT}, \"HTTP_PORT\":${HTTP_PORT}, \"HTTPS_PORT\":${HTTPS_PORT}, \"SERVER_NAME\":\"${SERVER_NAME}\", \"NGINX_RTMP_PORT\":${NGINX_RTMP_PORT}, \"NGINX_HTTP_PORT\":${NGINX_HTTP_PORT}, \"NGINX_HTTPS_PORT\":${NGINX_HTTPS_PORT}}" > /var/www/docker_vars.json
echo "entrypoint -- Starting socket server..." echo "entrypoint -- Starting socket server..."
ulimit -n 1048576 && nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php & nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php &
echo "Clear cache" echo "Clear cache"

View file

@ -20,9 +20,9 @@ class YPTSocket extends PluginAbstract
global $global; global $global;
$desc = '<span class="socket_info" style="float: right; margin:0 10px;">' . getSocketConnectionLabel() . '</span><script>if(isSocketActive()){setSocketIconStatus(\'connected\');}</script> '; $desc = '<span class="socket_info" style="float: right; margin:0 10px;">' . getSocketConnectionLabel() . '</span><script>if(isSocketActive()){setSocketIconStatus(\'connected\');}</script> ';
$desc .= "Socket Plugin, WebSockets allow for a higher amount of efficiency compared to REST because they do not require the HTTP request/response overhead for each message sent and received<br>"; $desc .= "Socket Plugin, WebSockets allow for a higher amount of efficiency compared to REST because they do not require the HTTP request/response overhead for each message sent and received<br>";
$desc .= "<br>To start it on server now <code>ulimit -n 1048576 && sudo nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &</code>"; $desc .= "<br>To start it on server now <code>sudo ".YPTSocket::getStartServerCommand()."</code>";
$desc .= "<br>To test use <code>php {$global['systemRootPath']}plugin/YPTSocket/test.php</code>"; $desc .= "<br>To test use <code>php {$global['systemRootPath']}plugin/YPTSocket/test.php</code>";
$desc .= "<br>To start it on server reboot add it on your crontab (Ubuntu 18+) <code>sudo crontab -eu root</code> than add this code on the last line <code>@reboot sleep 60;nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &</code>"; $desc .= "<br>To start it on server reboot add it on your crontab (Ubuntu 18+) <code>sudo crontab -eu root</code> than add this code on the last line <code>@reboot sleep 60;".YPTSocket::getStartServerCommand()."</code>";
$desc .= "<br>If you use Certbot to renew your SSL use (Ubuntu 18+) <code>sudo crontab -eu root</code> than add this code on the last line <code>0 1 * * * nohup php {$global['systemRootPath']}plugin/YPTSocket/serverCertbot.php &</code>"; $desc .= "<br>If you use Certbot to renew your SSL use (Ubuntu 18+) <code>sudo crontab -eu root</code> than add this code on the last line <code>0 1 * * * nohup php {$global['systemRootPath']}plugin/YPTSocket/serverCertbot.php &</code>";
$help = "<br>run this command start the server <small><a href='https://github.com/WWBN/AVideo/wiki/Socket-Plugin' target='_blank'><i class='fas fa-question-circle'></i> Help</a></small>"; $help = "<br>run this command start the server <small><a href='https://github.com/WWBN/AVideo/wiki/Socket-Plugin' target='_blank'><i class='fas fa-question-circle'></i> Help</a></small>";
@ -324,7 +324,15 @@ class YPTSocket extends PluginAbstract
global $global; global $global;
exec("php {$global['systemRootPath']}plugin/YPTSocket/stopServer.php"); exec("php {$global['systemRootPath']}plugin/YPTSocket/stopServer.php");
exec("sleep 1"); exec("sleep 1");
execAsync("ulimit -n 1048576 && nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &"); execAsync(YPTSocket::getStartServerCommand());
return true; return true;
} }
static public function getStartServerCommand()
{
global $global;
$command = "nohup bash -c 'ulimit -n 1048576 && php {$global['systemRootPath']}plugin/YPTSocket/server.php &'";
return $command;
}
} }

View file

@ -23,7 +23,7 @@ if (!empty($obj->debugAllUsersSocket) || (User::isAdmin() && !empty($obj->debugS
if (isset($_COOKIE['socketInfoPositionLeft'])) { if (isset($_COOKIE['socketInfoPositionLeft'])) {
$socket_info_container_left = $_COOKIE['socketInfoPositionLeft']; $socket_info_container_left = $_COOKIE['socketInfoPositionLeft'];
} }
$command = "sudo ulimit -n 1048576 && sudo nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &"; $command = "sudo ".YPTSocket::getStartServerCommand();
?> ?>
<style> <style>
#socket_info_container>div{ #socket_info_container>div{

View file

@ -131,7 +131,7 @@ function restartServer($kill=true) {
killProcessOnPort(); killProcessOnPort();
sleep(1); sleep(1);
} }
$cmd = "php {$global['systemRootPath']}plugin/YPTSocket/server.php"; $cmd = YPTSocket::getStartServerCommand();
echo 'Starting server with command ' . $cmd . PHP_EOL; echo 'Starting server with command ' . $cmd . PHP_EOL;
exec($cmd, $output, $retval); exec($cmd, $output, $retval);
echo implode(PHP_EOL,$output); echo implode(PHP_EOL,$output);

View file

@ -23,4 +23,4 @@ _session_write_close();
killProcessOnPort(); killProcessOnPort();
exec('certbot renew'); exec('certbot renew');
exec("sudo ulimit -n 1048576 && sudo nohup php {$global['systemRootPath']}plugin/YPTSocket/server.php &"); exec("sudo ".YPTSocket::getStartServerCommand());