From ecf50979d4159c4b1094f050d4eebe5a630152e8 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 11 Mar 2024 12:06:33 +0100 Subject: [PATCH] Document how to optimize cold starts with Laravel --- docs/laravel/getting-started.mdx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/laravel/getting-started.mdx b/docs/laravel/getting-started.mdx index 2a491a1d6..0d22e2459 100644 --- a/docs/laravel/getting-started.mdx +++ b/docs/laravel/getting-started.mdx @@ -64,7 +64,17 @@ At the moment, we deployed our local codebase to Lambda. When deploying for prod - our local `.env` file, - or any other dev artifact. -Follow [the deployment guide](/docs/deploy.md#deploying-for-production) for more details. +Follow [the deployment guide](/docs/deploy.md#deploying-for-production) for more details about deploying in general. + +Specifically for Laravel, Bref will automatically cache the configuration on "cold starts". This means that you don't need to run `php artisan config:cache` before deploying. However, if you want to improve the cold start time you can pre-generate the config cache before deploying: + +```bash +php artisan config:clear && php artisan config:cache +``` + + + Laravel will hardcode absolute paths in the cached configuration. To deploy a valid cached configuration, you should run the commands above in Docker, with the application mounted in `/var/task` (the same path as on AWS Lambda). + ## Troubleshooting