diff --git a/Dockerfile b/Dockerfile index 7e3e534331..3c854ad3b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,8 +56,6 @@ COPY deploy/apache/crontab /etc/cron.d/crontab RUN dos2unix /etc/cron.d/crontab RUN chmod 0644 /etc/cron.d/crontab RUN chmod +x /etc/cron.d/crontab -RUN service cron start -RUN crontab /etc/cron.d/crontab # Configure AVideo RUN dos2unix /usr/local/bin/docker-entrypoint && \ @@ -87,5 +85,3 @@ EXPOSE $PHPMYADMIN_PORT EXPOSE $PHPMYADMIN_ENCODER_PORT ENTRYPOINT ["/usr/local/bin/docker-entrypoint"] -CMD ["apache2-foreground"] -HEALTHCHECK --interval=60s --timeout=55s --start-period=1s CMD curl --fail https://localhost/ || exit 1 diff --git a/deploy/apache/crontab b/deploy/apache/crontab index 29b8a0bd24..1d0eedb640 100644 --- a/deploy/apache/crontab +++ b/deploy/apache/crontab @@ -1,4 +1,4 @@ # m h dom mon dow command 1 1 * * * pip3 install --upgrade youtube-dl > /proc/1/fd/1 2>/proc/1/fd/2 * * * * * php /var/www/html/AVideo/plugin/Scheduler/run.php > /proc/1/fd/1 2>/proc/1/fd/2 -#2 1 * * * php /var/www/html/AVideo/plugin/CDN/tools/moveMissingFiles.php > /proc/1/fd/1 2>/proc/1/fd/2 \ No newline at end of file +2 1 * * * php /var/www/html/AVideo/plugin/CDN/tools/moveMissingFiles.php > /proc/1/fd/1 2>/proc/1/fd/2 \ No newline at end of file diff --git a/deploy/apache/docker-entrypoint b/deploy/apache/docker-entrypoint index dda4504442..50163c86d2 100644 --- a/deploy/apache/docker-entrypoint +++ b/deploy/apache/docker-entrypoint @@ -102,7 +102,6 @@ cd /var/www/html/AVideo/ echo "lets encrypt apache ${SERVER_NAME}" certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --redirect --keep-until-expiring -d ${SERVER_NAME} - /etc/init.d/apache2 stop echo "Start socket" @@ -120,12 +119,12 @@ cd /var/www/html/AVideo/Encoder/install && php reencodeAllVideos.php echo "crontab starting" cron +service cron start +crontab /etc/cron.d/crontab bash source /etc/bash_completion -sleep 5 - echo "apache2-foreground start" apache2-foreground echo "apache2-foreground done" diff --git a/deploy/nginx/nginx.conf b/deploy/nginx/nginx.conf index de39b50f52..bc1b313b0a 100644 --- a/deploy/nginx/nginx.conf +++ b/deploy/nginx/nginx.conf @@ -1,6 +1,6 @@ user www-data; worker_processes 1; -error_log logs/error.log debug; +error_log stderr debug; events { worker_connections 1024; } @@ -26,10 +26,10 @@ rtmp { sync 500ms; #Experimental. Force dropped stream, or ended stream from being watched. (idle_streams) #idle_streams off; - on_publish http://127.0.0.1/plugin/Live/on_publish.php; - on_publish_done http://127.0.0.1/plugin/Live/on_publish_done.php; - on_play http://127.0.0.1/plugin/Live/on_play.php; - on_record_done http://127.0.0.1/plugin/Live/on_record_done.php; + on_publish http://avideo/plugin/Live/on_publish.php; + on_publish_done http://avideo/plugin/Live/on_publish_done.php; + on_play http://avideo/plugin/Live/on_play.php; + on_record_done http://avideo/plugin/Live/on_record_done.php; #exec ffmpeg -re -i rtmp://localhost/live/$name -c:v libx264 -preset veryfast -c:a copy -f hls -hls_time 5 -hls_list_size 0 -f flv rtmp://localhost/adaptive/$name_hi; #exec ffmpeg -re -i rtmp://localhost/live/$name diff --git a/docker-compose.yml b/docker-compose.yml index 161d624f7f..0fe9ccb10c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,8 +59,15 @@ services: - "./.compose/encoder:/var/www/html/AVideo/Encoder" - "./.compose/letsencrypt:/etc/letsencrypt/" depends_on: - - database - - database_encoder + database: + condition: service_healthy + database_encoder: + condition: service_healthy + healthcheck: + test: ["CMD-SHELL", "curl --silent --fail http://localhost || exit 1"] + interval: 30s + timeout: 10s + retries: 3 networks: - app_net @@ -85,7 +92,15 @@ services: - "${NGINX_HTTP_PORT:-8080}:8080" - "${NGINX_HTTPS_PORT:-8443}:8443" depends_on: - - avideo + avideo: + condition: service_healthy + database: + condition: service_healthy + healthcheck: + test: ["CMD-SHELL", "curl --silent --fail http://localhost:8080 || exit 1"] + interval: 30s + timeout: 10s + retries: 3 networks: - app_net @@ -100,6 +115,11 @@ services: MYSQL_PASSWORD: "${DB_MYSQL_PASSWORD}" volumes: - ./.compose/db:/var/lib/mysql + healthcheck: + test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -pexample"] + interval: 30s + timeout: 10s + retries: 3 networks: - app_net @@ -114,6 +134,11 @@ services: MYSQL_PASSWORD: "${DB_MYSQL_PASSWORD}" volumes: - ./.compose/db_encoder:/var/lib/mysql + healthcheck: + test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -pexample"] + interval: 30s + timeout: 10s + retries: 3 networks: - app_net diff --git a/locale/function.php b/locale/function.php index 98acff9ac6..e6997db0ac 100644 --- a/locale/function.php +++ b/locale/function.php @@ -128,6 +128,9 @@ function setSiteLang() { _session_start(); $_SESSION['language'] = $config->getLanguage(); } + if(empty($_SESSION['language'])){ + $_SESSION['language'] = 'en_us'; + } return setLanguage($_SESSION['language']); } diff --git a/objects/functions.php b/objects/functions.php index 27c3720b45..2128bb5465 100644 --- a/objects/functions.php +++ b/objects/functions.php @@ -3323,7 +3323,10 @@ function isGlobalTokenValid() { * @return string */ function removeQueryStringParameter($url, $varname) { - $parsedUrl = parse_url($url); + $parsedUrl = parse_url($url); + if(empty($parsedUrl) || empty($parsedUrl['host'])){ + return $url; + } $query = []; if (isset($parsedUrl['query'])) { @@ -4406,7 +4409,7 @@ function postVariables($url, $array, $httpcodeOnly = true, $timeout = 10) { function _session_start(array $options = []) { try { - if (!_empty($_GET['PHPSESSID'])) { + if (isset($_GET['PHPSESSID']) && !_empty($_GET['PHPSESSID'])) { $PHPSESSID = $_GET['PHPSESSID']; unset($_GET['PHPSESSID']); if (!User::isLogged()) { diff --git a/objects/include_config.php b/objects/include_config.php index e04f8573b8..d4980167fe 100644 --- a/objects/include_config.php +++ b/objects/include_config.php @@ -61,8 +61,7 @@ session_name($global['session_name']); if (empty($global['logfile'])) { $global['logfile'] = $global['systemRootPath'] . 'videos/avideo.log'; } - -ini_set('error_log', $global['logfile']); +ini_set('error_log', "exec:/usr/bin/tee {$global['logfile']} 1>&2"); global $global, $config, $advancedCustom, $advancedCustomUser; diff --git a/objects/video.php b/objects/video.php index 6ad2926e1f..6a4161b7d8 100644 --- a/objects/video.php +++ b/objects/video.php @@ -3250,7 +3250,7 @@ if (!class_exists('Video')) { $title = _substr($title, 0, 187) . '...'; _error_log("Video::setTitle($originalTitle) Title resized {$title} "); } - AVideoPlugin::onVideoSetTitle($this->id, $title, $new_title); + AVideoPlugin::onVideoSetTitle($this->id, $originalTitle, $title); if (!empty($new_title)) { _error_log("Video::setTitle($originalTitle) Title 1 set to [" . json_encode($new_title) . "] "); $this->title = $new_title; @@ -3797,10 +3797,12 @@ if (!class_exists('Video')) { * @var array $global * @var array $global['avideo_resolutions'] */ - foreach ($global['avideo_resolutions'] as $value) { - $search[] = "_{$value}"; - - $search[] = "res{$value}"; + if(!empty($global['avideo_resolutions']) && is_array($global['avideo_resolutions'])){ + foreach ($global['avideo_resolutions'] as $value) { + $search[] = "_{$value}"; + + $search[] = "res{$value}"; + } } $cleanName = str_replace($search, '', $filename); if ($cleanName == $filename || preg_match('/([a-z]+_[0-9]{12}_[a-z0-9]{4})_[0-9]+/', $filename)) { @@ -5513,6 +5515,7 @@ if (!class_exists('Video')) { $totalPL = count($plids); $img .= '