diff --git a/.gitlab/production-values.yaml b/.gitlab/production-values.yaml index 9d9541ad96b961592b96a7bc2c19795a1e5ba4e4..e4f3fb44ae2aa6b16a8dc958c4b85a35c7fe702c 100644 --- a/.gitlab/production-values.yaml +++ b/.gitlab/production-values.yaml @@ -3,7 +3,14 @@ service: internalPort: 80 hpa: minReplicas: 5 - maxReplicas: 25 + maxReplicas: 100 +resources: + limits: + cpu: 500m + memory: 1Gi + requests: + cpu: 500m + memory: 1Gi podDisruptionBudget: enabled: true minAvailable: 4 diff --git a/app/Console/Commands/RequestFetcher.php b/app/Console/Commands/RequestFetcher.php index 5f796f15e0835b5440170c1af78bc1d33862b3c3..113617ad732009e04b5101dc0dc27c8b058c3d45 100644 --- a/app/Console/Commands/RequestFetcher.php +++ b/app/Console/Commands/RequestFetcher.php @@ -82,33 +82,39 @@ class RequestFetcher extends Command $blocking = false; while ($this->shouldRun) { $status = curl_multi_exec($this->multicurl, $active); - $currentJob = null; + $currentJobs = []; if (!$blocking) { - $currentJob = Redis::lpop(\App\MetaGer::FETCHQUEUE_KEY); + $elements = Redis::pipeline(function($redis){ + $redis->lrange(\App\MetaGer::FETCHQUEUE_KEY, 0, -1); + $redis->del(\App\MetaGer::FETCHQUEUE_KEY); + }); + $currentJobs = $elements[0]; } else { $currentJob = Redis::blpop(\App\MetaGer::FETCHQUEUE_KEY, 1); if (!empty($currentJob)) { - $currentJob = $currentJob[1]; + $currentJobs[] = $currentJob[1]; } } - if (!empty($currentJob)) { - $currentJob = json_decode($currentJob, true); - $ch = $this->getCurlHandle($currentJob); - if (curl_multi_add_handle($this->multicurl, $ch) !== 0) { - $this->shouldRun = false; - Log::error("Couldn't add Handle to multicurl"); - break; - } - $this->fetchedDocuments++; - if ($this->fetchedDocuments > $this->maxFetchedDocuments) { - Log::info("Reinitializing Multicurl after " . $this->fetchedDocuments . " requests."); - $this->oldMultiCurl = $this->multicurl; - $this->multicurl = curl_multi_init(); - $this->fetchedDocuments = 0; + if (sizeof($currentJobs) > 0) { + foreach($currentJobs as $currentJob){ + $currentJob = json_decode($currentJob, true); + $ch = $this->getCurlHandle($currentJob); + if (curl_multi_add_handle($this->multicurl, $ch) !== 0) { + $this->shouldRun = false; + Log::error("Couldn't add Handle to multicurl"); + break; + } + $this->fetchedDocuments++; + if ($this->fetchedDocuments > $this->maxFetchedDocuments) { + Log::info("Reinitializing Multicurl after " . $this->fetchedDocuments . " requests."); + $this->oldMultiCurl = $this->multicurl; + $this->multicurl = curl_multi_init(); + $this->fetchedDocuments = 0; + } + $blocking = false; + $active = true; } - $blocking = false; - $active = true; } $answerRead = $this->readMultiCurl($this->multicurl); diff --git a/resources/lang/en/footer.php b/resources/lang/en/footer.php index 758f589618fe29a2bac32464f93badb095ff5c40..d57f157050df472bdd2ee587b3a1342ddd7d6c65 100644 --- a/resources/lang/en/footer.php +++ b/resources/lang/en/footer.php @@ -3,5 +3,5 @@ return [ "sumaev.1" => "MetaGer is developed and run by ", "sumaev.2" => "SUMA-EV - Association for Free Access to Knowledge.", - 'sumaev.link' => 'https://suma-ev.de/en/index.html', + 'sumaev.link' => 'https://suma-ev.de/', ]; diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 017f1cd00093f4ce895fde4beab9a4d0dee775d0..25d8debd4120c1a5baa6f955d5bbac3ed4fc9c33 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -22,7 +22,7 @@ @if(LaravelLocalization::getCurrentLocale() === "de") <a href="https://suma-ev.de" target="_blank"> @else - <a href="https://suma-ev.de/en/index.html" target="_blank"> + <a href="https://suma-ev.de/" target="_blank"> @endif <img alt="rainbow" src="/img/rainbow.svg"> <span>@lang('index.about.2.1')</span> diff --git a/routes/web.php b/routes/web.php index edc101c0a2262718362e14fef93bef9a56cd150b..3c9b095cc861986066c025efe4ae534cd24ab6de 100644 --- a/routes/web.php +++ b/routes/web.php @@ -222,10 +222,38 @@ Route::group( ->with('navbarFocus', 'dienste'); }); Route::get('metager', function () { - return redirect("https://gitlab.metager.de/open-source/app-en/raw/latest/app/release/app-release.apk?inline=false"); + return response()->streamDownload(function () { + $fh = null; + try{ + $fh = fopen("https://gitlab.metager.de/open-source/app-en/raw/latest/app/release/app-release.apk?inline=false", "r"); + while (!feof($fh)) { + echo(fread($fh, 1024)); + } + }catch(\Exception $e){ + abort(404); + }finally { + if($fh != null){ + fclose($fh); + } + } + }, 'MetaGerSearch.apk', ["Content-Type" => "application/vnd.android.package-archive"]); }); Route::get('maps', function () { - return redirect("https://gitlab.metager.de/open-source/metager-maps-android/raw/latest/app/release/app-release.apk?inline=false"); + return response()->streamDownload(function () { + $fh = null; + try{ + $fh = fopen("https://gitlab.metager.de/open-source/metager-maps-android/raw/latest/app/release/app-release.apk?inline=false", "r"); + while (!feof($fh)) { + echo(fread($fh, 1024)); + } + }catch(\Exception $e){ + abort(404); + }finally { + if($fh != null){ + fclose($fh); + } + } + }, 'MetaGerMaps.apk', ["Content-Type" => "application/vnd.android.package-archive"]); }); Route::get('maps/version', function () {