diff --git a/.env.example b/.env.example index de1aadc..7d64dce 100644 --- a/.env.example +++ b/.env.example @@ -68,3 +68,10 @@ VITE_APP_NAME="${APP_NAME}" TRMNL_PROXY_BASE_URL=https://trmnl.app TRMNL_PROXY_REFRESH_MINUTES=15 REGISTRATION_ENABLED=1 + +PUPPETEER_MODE= +SIDECAR_ACCESS_KEY_ID= +SIDECAR_SECRET_ACCESS_KEY= +SIDECAR_REGION= +SIDECAR_ARTIFACT_BUCKET_NAME= +SIDECAR_EXECUTION_ROLE= diff --git a/app/Jobs/GenerateScreenJob.php b/app/Jobs/GenerateScreenJob.php index 5c3708c..4dcf876 100644 --- a/app/Jobs/GenerateScreenJob.php +++ b/app/Jobs/GenerateScreenJob.php @@ -11,6 +11,7 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Storage; use Ramsey\Uuid\Uuid; use Spatie\Browsershot\Browsershot; +use Wnx\SidecarBrowsershot\BrowsershotLambda; class GenerateScreenJob implements ShouldQueue { @@ -35,13 +36,23 @@ class GenerateScreenJob implements ShouldQueue $bmpPath = Storage::disk('public')->path('/images/generated/'.$uuid.'.bmp'); // Generate PNG - try { - Browsershot::html($this->markup) - ->setOption('args', config('app.puppeteer_docker') ? ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu'] : []) - ->windowSize($device->width ?? 800, $device->height ?? 480) - ->save($pngPath); - } catch (\Exception $e) { - throw new \RuntimeException('Failed to generate PNG: '.$e->getMessage(), 0, $e); + if (config('app.puppeteer_mode') === 'sidecar-aws') { + try { + BrowsershotLambda::html($this->markup) + ->windowSize($device->width ?? 800, $device->height ?? 480) + ->save($pngPath); + } catch (\Exception $e) { + throw new \RuntimeException('Failed to generate PNG: '.$e->getMessage(), 0, $e); + } + } else { + try { + Browsershot::html($this->markup) + ->setOption('args', config('app.puppeteer_docker') ? ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu'] : []) + ->windowSize($device->width ?? 800, $device->height ?? 480) + ->save($pngPath); + } catch (\Exception $e) { + throw new \RuntimeException('Failed to generate PNG: '.$e->getMessage(), 0, $e); + } } try { diff --git a/composer.json b/composer.json index 2dafbba..c39ca24 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ "laravel/tinker": "^2.10.1", "livewire/flux": "^2.0", "livewire/volt": "^1.7", - "spatie/browsershot": "^5.0" + "spatie/browsershot": "^5.0", + "wnx/sidecar-browsershot": "^2.6" }, "require-dev": { "fakerphp/faker": "^1.23", diff --git a/composer.lock b/composer.lock index 59fbbf3..38b0569 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,159 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0511a36a7943d2b2cac63ca735d1e03d", + "content-hash": "951d87dde4cac7a99c191269fd08d979", "packages": [ + { + "name": "aws/aws-crt-php", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/awslabs/aws-crt-php.git", + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/d71d9906c7bb63a28295447ba12e74723bd3730e", + "reference": "d71d9906c7bb63a28295447ba12e74723bd3730e", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35||^5.6.3||^9.5", + "yoast/phpunit-polyfills": "^1.0" + }, + "suggest": { + "ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality." + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "AWS SDK Common Runtime Team", + "email": "aws-sdk-common-runtime@amazon.com" + } + ], + "description": "AWS Common Runtime for PHP", + "homepage": "https://github.com/awslabs/aws-crt-php", + "keywords": [ + "amazon", + "aws", + "crt", + "sdk" + ], + "support": { + "issues": "https://github.com/awslabs/aws-crt-php/issues", + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.7" + }, + "time": "2024-10-18T22:15:13+00:00" + }, + { + "name": "aws/aws-sdk-php", + "version": "3.343.6", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "3746aca8cbed5f46beba850e0a480ef58e71b197" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3746aca8cbed5f46beba850e0a480ef58e71b197", + "reference": "3746aca8cbed5f46beba850e0a480ef58e71b197", + "shasum": "" + }, + "require": { + "aws/aws-crt-php": "^1.2.3", + "ext-json": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/promises": "^2.0", + "guzzlehttp/psr7": "^2.4.5", + "mtdowling/jmespath.php": "^2.8.0", + "php": ">=8.1", + "psr/http-message": "^2.0" + }, + "require-dev": { + "andrewsville/php-token-reflection": "^1.4", + "aws/aws-php-sns-message-validator": "~1.0", + "behat/behat": "~3.0", + "composer/composer": "^2.7.8", + "dms/phpunit-arraysubset-asserts": "^0.4.0", + "doctrine/cache": "~1.4", + "ext-dom": "*", + "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", + "phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5", + "psr/cache": "^2.0 || ^3.0", + "psr/simple-cache": "^2.0 || ^3.0", + "sebastian/comparator": "^1.2.3 || ^4.0 || ^5.0", + "symfony/filesystem": "^v6.4.0 || ^v7.1.0", + "yoast/phpunit-polyfills": "^2.0" + }, + "suggest": { + "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", + "doctrine/cache": "To use the DoctrineCacheAdapter", + "ext-curl": "To send requests using cURL", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Aws\\": "src/" + }, + "exclude-from-classmap": [ + "src/data/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "support": { + "forum": "https://github.com/aws/aws-sdk-php/discussions", + "issues": "https://github.com/aws/aws-sdk-php/issues", + "source": "https://github.com/aws/aws-sdk-php/tree/3.343.6" + }, + "time": "2025-05-07T18:10:08+00:00" + }, { "name": "bnussbau/laravel-trmnl", "version": "0.1.4", @@ -1133,6 +1284,64 @@ ], "time": "2025-02-03T10:55:03+00:00" }, + { + "name": "hammerstone/sidecar", + "version": "v0.7.0", + "source": { + "type": "git", + "url": "https://github.com/aarondfrancis/sidecar.git", + "reference": "91a7001be31b16b51536aad42b14797653c3d862" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aarondfrancis/sidecar/zipball/91a7001be31b16b51536aad42b14797653c3d862", + "reference": "91a7001be31b16b51536aad42b14797653c3d862", + "shasum": "" + }, + "require": { + "aws/aws-sdk-php": "^3.216.1", + "guzzlehttp/guzzle": "^6.5.8|^7.2", + "illuminate/console": "^8|^9|^10|^11|^12.0", + "illuminate/filesystem": "^8|^9|^10|^11|^12.0", + "illuminate/support": "^8|^9|^10|^11|^12.0", + "maennchen/zipstream-php": "^3.1", + "php": "^8.1" + }, + "require-dev": { + "mockery/mockery": "^1.3.3", + "orchestra/testbench": "^5|^6|^7|^8|^9|^10.0", + "phpunit/phpunit": ">=8.5.23|^9|^10" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Hammerstone\\Sidecar\\Providers\\SidecarServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Hammerstone\\Sidecar\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Francis", + "email": "aaron@hammerstone.dev" + } + ], + "description": "A Laravel package to deploy Lambda functions alongside your main application.", + "support": { + "issues": "https://github.com/aarondfrancis/sidecar/issues", + "source": "https://github.com/aarondfrancis/sidecar/tree/v0.7.0" + }, + "time": "2025-05-07T23:03:51+00:00" + }, { "name": "intervention/gif", "version": "4.2.2", @@ -1415,16 +1624,16 @@ }, { "name": "laravel/framework", - "version": "v12.12.0", + "version": "v12.13.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "8f6cd73696068c28f30f5964556ec9d14e5d90d7" + "reference": "52b588bcd8efc6d01bc1493d2d67848f8065f269" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/8f6cd73696068c28f30f5964556ec9d14e5d90d7", - "reference": "8f6cd73696068c28f30f5964556ec9d14e5d90d7", + "url": "https://api.github.com/repos/laravel/framework/zipball/52b588bcd8efc6d01bc1493d2d67848f8065f269", + "reference": "52b588bcd8efc6d01bc1493d2d67848f8065f269", "shasum": "" }, "require": { @@ -1445,7 +1654,7 @@ "guzzlehttp/uri-template": "^1.0", "laravel/prompts": "^0.3.0", "laravel/serializable-closure": "^1.3|^2.0", - "league/commonmark": "^2.6", + "league/commonmark": "^2.7", "league/flysystem": "^3.25.1", "league/flysystem-local": "^3.25.1", "league/uri": "^7.5.1", @@ -1537,7 +1746,7 @@ "php-http/discovery": "^1.15", "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^10.5.35|^11.5.3|^12.0.1", - "predis/predis": "^2.3", + "predis/predis": "^2.3|^3.0", "resend/resend-php": "^0.10.0", "symfony/cache": "^7.2.0", "symfony/http-client": "^7.2.0", @@ -1569,7 +1778,7 @@ "pda/pheanstalk": "Required to use the beanstalk queue driver (^5.0).", "php-http/discovery": "Required to use PSR-7 bridging features (^1.15).", "phpunit/phpunit": "Required to use assertions and run tests (^10.5.35|^11.5.3|^12.0.1).", - "predis/predis": "Required to use the predis connector (^2.3).", + "predis/predis": "Required to use the predis connector (^2.3|^3.0).", "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).", "resend/resend-php": "Required to enable support for the Resend mail transport (^0.10.0).", @@ -1626,7 +1835,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-05-01T16:13:12+00:00" + "time": "2025-05-07T17:29:01+00:00" }, { "name": "laravel/prompts", @@ -2640,6 +2849,84 @@ }, "time": "2025-04-08T15:13:36+00:00" }, + { + "name": "maennchen/zipstream-php", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/maennchen/ZipStream-PHP.git", + "reference": "aeadcf5c412332eb426c0f9b4485f6accba2a99f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/aeadcf5c412332eb426c0f9b4485f6accba2a99f", + "reference": "aeadcf5c412332eb426c0f9b4485f6accba2a99f", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-zlib": "*", + "php-64bit": "^8.2" + }, + "require-dev": { + "brianium/paratest": "^7.7", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.16", + "guzzlehttp/guzzle": "^7.5", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.5", + "phpunit/phpunit": "^11.0", + "vimeo/psalm": "^6.0" + }, + "suggest": { + "guzzlehttp/psr7": "^2.4", + "psr/http-message": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZipStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Duncan", + "email": "pabs@pablotron.org" + }, + { + "name": "Jonatan Männchen", + "email": "jonatan@maennchen.ch" + }, + { + "name": "Jesse Donat", + "email": "donatj@gmail.com" + }, + { + "name": "András Kolesár", + "email": "kolesar@kolesar.hu" + } + ], + "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", + "keywords": [ + "stream", + "zip" + ], + "support": { + "issues": "https://github.com/maennchen/ZipStream-PHP/issues", + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.2" + }, + "funding": [ + { + "url": "https://github.com/maennchen", + "type": "github" + } + ], + "time": "2025-01-27T12:07:53+00:00" + }, { "name": "monolog/monolog", "version": "3.9.0", @@ -2743,6 +3030,72 @@ ], "time": "2025-03-24T10:02:05+00:00" }, + { + "name": "mtdowling/jmespath.php", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "symfony/polyfill-mbstring": "^1.17" + }, + "require-dev": { + "composer/xdebug-handler": "^3.0.3", + "phpunit/phpunit": "^8.5.33" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "files": [ + "src/JmesPath.php" + ], + "psr-4": { + "JmesPath\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "support": { + "issues": "https://github.com/jmespath/jmespath.php/issues", + "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" + }, + "time": "2024-09-04T18:46:31+00:00" + }, { "name": "nesbot/carbon", "version": "3.9.1", @@ -3057,31 +3410,31 @@ }, { "name": "nunomaduro/termwind", - "version": "v2.3.0", + "version": "v2.3.1", "source": { "type": "git", "url": "https://github.com/nunomaduro/termwind.git", - "reference": "52915afe6a1044e8b9cee1bcff836fb63acf9cda" + "reference": "dfa08f390e509967a15c22493dc0bac5733d9123" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/52915afe6a1044e8b9cee1bcff836fb63acf9cda", - "reference": "52915afe6a1044e8b9cee1bcff836fb63acf9cda", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/dfa08f390e509967a15c22493dc0bac5733d9123", + "reference": "dfa08f390e509967a15c22493dc0bac5733d9123", "shasum": "" }, "require": { "ext-mbstring": "*", "php": "^8.2", - "symfony/console": "^7.1.8" + "symfony/console": "^7.2.6" }, "require-dev": { - "illuminate/console": "^11.33.2", - "laravel/pint": "^1.18.2", + "illuminate/console": "^11.44.7", + "laravel/pint": "^1.22.0", "mockery/mockery": "^1.6.12", - "pestphp/pest": "^2.36.0", - "phpstan/phpstan": "^1.12.11", - "phpstan/phpstan-strict-rules": "^1.6.1", - "symfony/var-dumper": "^7.1.8", + "pestphp/pest": "^2.36.0 || ^3.8.2", + "phpstan/phpstan": "^1.12.25", + "phpstan/phpstan-strict-rules": "^1.6.2", + "symfony/var-dumper": "^7.2.6", "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, "type": "library", @@ -3124,7 +3477,7 @@ ], "support": { "issues": "https://github.com/nunomaduro/termwind/issues", - "source": "https://github.com/nunomaduro/termwind/tree/v2.3.0" + "source": "https://github.com/nunomaduro/termwind/tree/v2.3.1" }, "funding": [ { @@ -3140,7 +3493,7 @@ "type": "github" } ], - "time": "2024-11-21T10:39:51+00:00" + "time": "2025-05-08T08:14:37+00:00" }, { "name": "phpoption/phpoption", @@ -6766,6 +7119,92 @@ "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, "time": "2022-06-03T18:03:27+00:00" + }, + { + "name": "wnx/sidecar-browsershot", + "version": "v2.6.0", + "source": { + "type": "git", + "url": "https://github.com/stefanzweifel/sidecar-browsershot.git", + "reference": "20c5a56c34298f7edb7334890e919c0521a7f467" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/stefanzweifel/sidecar-browsershot/zipball/20c5a56c34298f7edb7334890e919c0521a7f467", + "reference": "20c5a56c34298f7edb7334890e919c0521a7f467", + "shasum": "" + }, + "require": { + "hammerstone/sidecar": "^0.4 || ^0.5 || ^0.6 || ^0.7", + "illuminate/contracts": "^10.0 || ^11.0 || ^12.0", + "php": "^8.2", + "spatie/browsershot": "^4.0 || ^5.0", + "spatie/laravel-package-tools": "^1.9.2" + }, + "require-dev": { + "ext-imagick": "*", + "laravel/pint": "^1.13", + "league/flysystem-aws-s3-v3": "^1.0|^2.0|^3.0", + "nunomaduro/collision": "^7.0|^8.0", + "orchestra/testbench": "^8.0|^9.0|^10.0", + "pestphp/pest": "^2.0|^3.0", + "pestphp/pest-plugin-laravel": "^2.0|^3.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^10 | ^11.0", + "spatie/image": "^3.3", + "spatie/pixelmatch-php": "dev-main" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "SidecarBrowsershot": "Wnx\\SidecarBrowsershot\\Facades\\SidecarBrowsershot" + }, + "providers": [ + "Wnx\\SidecarBrowsershot\\SidecarBrowsershotServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Wnx\\SidecarBrowsershot\\": "src", + "Wnx\\SidecarBrowsershot\\Database\\Factories\\": "database/factories" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Stefan Zweifel", + "email": "stefan@stefanzweifel.dev", + "role": "Developer" + } + ], + "description": "A Sidecar function to run Browsershot on Lambda.", + "homepage": "https://github.com/stefanzweifel/sidecar-browsershot", + "keywords": [ + "browsershot", + "lambda", + "laravel", + "sidecar", + "sidecar-browsershot", + "wnx" + ], + "support": { + "issues": "https://github.com/stefanzweifel/sidecar-browsershot/issues", + "source": "https://github.com/stefanzweifel/sidecar-browsershot/tree/v2.6.0" + }, + "funding": [ + { + "url": "https://github.com/stefanzweifel", + "type": "github" + } + ], + "time": "2025-05-08T06:40:32+00:00" } ], "packages-dev": [ @@ -7296,16 +7735,16 @@ }, { "name": "laravel/pint", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36" + "reference": "941d1927c5ca420c22710e98420287169c7bcaf7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36", - "reference": "7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36", + "url": "https://api.github.com/repos/laravel/pint/zipball/941d1927c5ca420c22710e98420287169c7bcaf7", + "reference": "941d1927c5ca420c22710e98420287169c7bcaf7", "shasum": "" }, "require": { @@ -7317,11 +7756,11 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.75.0", - "illuminate/view": "^11.44.2", - "larastan/larastan": "^3.3.1", + "illuminate/view": "^11.44.7", + "larastan/larastan": "^3.4.0", "laravel-zero/framework": "^11.36.1", "mockery/mockery": "^1.6.12", - "nunomaduro/termwind": "^2.3", + "nunomaduro/termwind": "^2.3.1", "pestphp/pest": "^2.36.0" }, "bin": [ @@ -7358,7 +7797,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2025-04-08T22:11:45+00:00" + "time": "2025-05-08T08:38:12+00:00" }, { "name": "laravel/sail", diff --git a/config/app.php b/config/app.php index 0ef676e..e5b3078 100644 --- a/config/app.php +++ b/config/app.php @@ -129,7 +129,8 @@ return [ 'force_https' => env('FORCE_HTTPS', false), 'puppeteer_docker' => env('PUPPETEER_DOCKER', false), - + 'puppeteer_mode' => env('PUPPETEER_MODE', 'local'), + /* |-------------------------------------------------------------------------- | Application Version diff --git a/config/sidecar-browsershot.php b/config/sidecar-browsershot.php new file mode 100644 index 0000000..217f3ef --- /dev/null +++ b/config/sidecar-browsershot.php @@ -0,0 +1,56 @@ + env('SIDECAR_BROWSERSHOT_MEMORY', 2048), + + /** + * The default ephemeral storage available to SidecarBrowsershot, in megabytes. (Defaults to 512MB) + * + * @see https://hammerstone.dev/sidecar/docs/main/functions/customization#storage + */ + 'storage' => env('SIDECAR_BROWSERSHOT_STORAGE', 512), + + /** + * The default timeout to use for SidecarBrowsershot, in seconds. (Defaults to 300) + * + * @see https://hammerstone.dev/sidecar/docs/main/functions/customization#timeout + */ + 'timeout' => env('SIDECAR_BROWSERSHOT_TIMEOUT', 300), + + /** + * Define the number of warming instances to boot. + * + * @see https://hammerstone.dev/sidecar/docs/main/functions/warming + */ + 'warming' => env('SIDECAR_BROWSERSHOT_WARMING_INSTANCES', 0), + + /** + * AWS Layers to use by the Lambda function. + * Defaults to "shelfio/chrome-aws-lambda-layer" and "sidecar-browsershot-layer" in your respective AWS region. + * + * If you customize this, you must include both "sidecar-browsershot-layer" and "shelfio/chrome-aws-lambda-layer" + * in your list, as the config overrides the default values. + * (See BrowsershotFunction@layers for more details) + * + * @see https://github.com/shelfio/chrome-aws-lambda-layer + * @see https://github.com/stefanzweifel/sidecar-browsershot-layer + */ + 'layers' => [ + // "arn:aws:lambda:us-east-1:821527532446:layer:sidecar-browsershot-layer:2", + // "arn:aws:lambda:us-east-1:764866452798:layer:chrome-aws-lambda:42", + ], + + /** + * Path to local directory containing fonts to be installed in the Lambda function. + * During deployment, BorwsershotLambda will scan this directory for + * any files and will bundle them into the Lambda function. + */ + 'fonts' => resource_path('sidecar-browsershot/fonts'), +]; diff --git a/config/sidecar.php b/config/sidecar.php new file mode 100644 index 0000000..cb83e0e --- /dev/null +++ b/config/sidecar.php @@ -0,0 +1,10 @@ + [ + \Wnx\SidecarBrowsershot\Functions\BrowsershotFunction::class, + ], +];