]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6278 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Oct 2023 16:46:00 +0000 (18:46 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Oct 2023 16:46:00 +0000 (18:46 +0200)
app/Fluidbook/Farm.php
app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php

index 4dd8b12e6fabc3b21f7725e8997707067028eb42..82cf2dd366d369c78dab8c488e2bf57caa8f7e04 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace App\Fluidbook;
 
-use App\Notifications\ToolboxNotification;
 use Cubist\Util\Files\Files;
 use Fluidbook\Tools\Jobs\ProcessFile;
 use hollodotme\FastCGI\Client;
@@ -16,8 +15,8 @@ class Farm
 {
 
     protected static $_outPDF = [];
-    protected static $_forceServer = false;
-    //protected static $_forceServer = 'alphaville';
+    //protected static $_forceServer = false;
+    protected static $_forceServer = 'alphaville';
     protected static $_farmServers = [
         ['name' => 'alphaville', 'host' => 'fluidbook-processfarm', 'port' => 9000, 'weight' => 24, 'region' => 'UE'],
         ['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 2, 'region' => 'US'],
@@ -159,6 +158,7 @@ class Farm
         });
 
         if ((!$res || !file_exists($res)) && $attempts > 0) {
+            Cache::forget($cachekey);
             return self::getFileFromPDF($pdf, $page, $format, $resolution, $quality, $withText, $withGraphics, $version, $out, true, $attempts - 1);
         }
 
@@ -194,8 +194,6 @@ class Farm
         $time = round(microtime(true) - $start, 4);
         $log = '[' . $farmer['name'] . ']' . "\t" . date('Y-m-d H:i:s') . "\t" . $time . "\t" . implode('|', $params) . "\t($res)\t>>" . $output . "\n";
 
-        error_log($log);
-
         if (!$res) {
             if ($attempts > 0) {
                 Log::warning('Farm failure ('.$farmer['name'].') : ' . $output);
index aef6300aed2b22fc627439e7e84db2502ac9213e..e9da0a30644f5855b6f8c787e0762f9ae577c3ea 100644 (file)
@@ -61,7 +61,7 @@ trait DockerWebContainer
             $dockerSuffix = $env === 'production' ? '' : '-' . $env;
 
 
-            $variables = ['$name' => $name.$dockerSuffix,
+            $variables = ['$name' => $name . $dockerSuffix,
                 '$portadminer' => rand(10000, 60000),
                 '$portmatomo' => rand(10000, 60000),
                 '$matomodbpassword' => Str::random(16),
@@ -95,6 +95,9 @@ trait DockerWebContainer
             if ($request->get('mysql', true)) {
                 $compose[] = 'mysql';
             }
+            if ($request->get('redis', true)) {
+                $compose[] = 'redis';
+            }
             if ($request->get('matomo', true)) {
                 $compose[] = 'matomo';
             }
@@ -128,7 +131,7 @@ trait DockerWebContainer
             foreach ($infos as $k => $v) {
                 $notification .= '* ' . $k . ' : ' . $v . "\n";
             }
-            $notification.="\n";
+            $notification .= "\n";
 
             Files::recursiveReplaceStringInDir($dir, $variables);
         }