]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6615 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 8 Jan 2024 17:35:40 +0000 (18:35 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 8 Jan 2024 17:35:40 +0000 (18:35 +0100)
.docker/update.sh
app/Fluidbook/Farm.php
app/Jobs/FluidbookDocumentFileProcess.php
app/Models/FluidbookDocument.php
scripts/fixrights.sh

index 87d084c368ab4aa4ea3a5de9a910a8e9a71d1d8e..b257446093055df41349eb525ea6aadb33e7262b 100644 (file)
@@ -3,6 +3,7 @@ cd /docker/fluidbook-toolbox
 docker plugin install ucphhpc/sshfs --grant-all-permissions
 /home/toolbox/www/scripts/fixrights.sh
 chown root:root /home/toolbox/www/.docker/config/cron/host;ln -sf /home/toolbox/www/.docker/config/cron/host /etc/cron.d/toolbox
+chown root:root /home/toolbox/www/.docker/config/sudoers
 docker network create fluidbook-toolbox
 docker compose down
 docker volume rm fluidbook-toolbox_sshfsusstorage
index 43755b5f618d7bae1ceb2b9a84ae8f4efc394fe4..aa29d8ed6174a24b241d82c9cbf93cbd6dc65237 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace App\Fluidbook;
 
-use Cubist\PDF\PDFTools;
 use Cubist\Util\Files\Files;
 use Fluidbook\Tools\Jobs\ProcessFile;
 use hollodotme\FastCGI\Client;
@@ -117,6 +116,9 @@ class Farm
         return trim($response->getBody());
     }
 
+    /**
+     * @throws \Exception
+     */
     public static function getFile($page, $format, $resolution, $quality, $withText, $withGraphics, $version, $resolutionRatio, $mobileFirstRatio, $path, $force = false)
     {
         $params = [
@@ -322,6 +324,14 @@ 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";
 
+        $dir = isset($params['pdf']) ? dirname($params['pdf']) : $params['out'];
+        $logfile = $dir . '/farm.log';
+
+        if ($fp = fopen($logfile, 'ab')) {
+            fwrite($fp, $log);
+            fclose($fp);
+        }
+
         if (!$res) {
             if ($attempts > 0) {
                 Log::warning('Farm failure (' . $farmer['name'] . ') : ' . $output . ' // ' . $log);
index 5db7f88d32ac6cce28c1540b18c3776694d53ca0..32ee499e9bfa1a50de4e59dc27614e88d61ab8ad 100644 (file)
@@ -3,6 +3,7 @@
 namespace App\Jobs;
 
 use App\Models\FluidbookDocument;
+use Illuminate\Support\Facades\Log;
 
 class FluidbookDocumentFileProcess extends Base
 {
@@ -47,6 +48,7 @@ class FluidbookDocumentFileProcess extends Base
         try {
             echo $this->document->getFile($this->page, $this->format, $this->resolution, $this->quality, $this->withText, $this->withGraphics, $this->version, $this->forceCheck, $this->forceProcess) . "\n";
         } catch (\Exception $e) {
+            Log::warning($e->getMessage());
             $this->log = $e->getMessage();
         }
         $this->finish = true;
@@ -78,7 +80,8 @@ class FluidbookDocumentFileProcess extends Base
         return $this->path;
     }
 
-    public function getLog(){
+    public function getLog()
+    {
         return $this->log;
     }
 }
index f3cf142a14a6b21aa1d409daec1e08b26f7e5a04..12e2df004074d3d732b7f98202c5e9f0b98b4327 100644 (file)
@@ -18,7 +18,6 @@ use Cubist\Util\Files\Files;
 use Cubist\Util\Gzip;
 use Cubist\Util\Math;
 use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\Log;
 
 // __('!!Paramètres des fluidbooks')
 class FluidbookDocument extends ToolboxModel
@@ -371,6 +370,9 @@ class FluidbookDocument extends ToolboxModel
     }
 
 
+    /**
+     * @throws \Exception
+     */
     public function _getFile($page, $format = 'jpg', $resolution = 150, $quality = 85, $withText = true, $withGraphics = true, $version = 'html', $forceCheck = true)
     {
         Farm::setRegion($this->getRegion());
index 4d1ecece7f1c0347616d6d5dcff306e4354fe982..bda2abda460ddd49e25c93fe7cdeea372943d042 100644 (file)
@@ -7,8 +7,11 @@ chmod -R 775 /home/toolbox/www/public
 chmod -R 775 /home/toolbox/www/bin
 
 chown root:root /home/toolbox/dev/.docker/config/sudoers
+chown root:root /home/toolbox/dev/.docker/config/cron/host
 chmod -R 775 /home/toolbox/dev/scripts
 chmod -R 775 /home/toolbox/dev/protected
 chmod -R 775 /home/toolbox/dev/public
 chmod -R 775 /home/toolbox/dev/bin
 
+chown root:root /home/toolbox/alpha/.docker/config/sudoers
+chown root:root /home/toolbox/alpha/.docker/config/cron/host