A simple laravel installer package that guides you into installing a fully optimised Laravel Serverless app
Run composer require sagarchauhan/laravel-serverless-installer
into your app and then follow the steps.
This is not required in laravel , but if you are in lumen then you have to register service provider in bootstrap/app.php.
$app->register(sagarchauhan\LaravelServerlessServiceProvider::class);
php artisan vendor:publish --tag="serverless"
php artisan sagarchauhan:publish serverless
./vendor/bin/serverless-installer
./vendor/bin/serverless-installer
Move the vendor/bin/serverless-installer
to /usr/bin
or /usr/local/bin
and then run serverless-installer
to setup the serverless framework.
- Add
'token' => env('AWS_SESSION_TOKEN'),
as a node in your queue.phpsqs
driver. This is running issue in Laravel. You can read more about it here
-
Define
AWS_SESSION_TOKEN=
in your env file. Leave its value empty. It just needs to be there. That's it. -
Next add AWS related env values in your .env file
AWS_ACCESS_KEY_ID=<key>
AWS_SECRET_ACCESS_KEY=<secret>
AWS_DEFAULT_REGION=ap-south-1
QUEUE_CONNECTION=sqs
SQS_PREFIX=<you-will-get-this-once-you-deploy-your-app-till-then-you-can-leave-empty> #put the actual value on second deployment
SQS_QUEUE=<you-will-get-this-once-you-deploy-your-app-till-then-you-can-leave-empty> #put the actual value on second deployment
ASSET_URL=https://<bucket-name>.s3.ap-south-1.amazonaws.com #required for apps that have front-end and back-end coupled
- For enabling scheduler, open your
Kernal.php
file insideapp/Console.
Inside schedule function add
$schedule->command('telescope:prune --hours=48')->daily()->timezone('Asia/Kolkata'); for pruning telescope logs on daily basis.
Sagar Chauhan works as a Project Manager - Technology at Greenhonchos. In his spare time, he hunts bug as a Bug Bounty Hunter. Follow him at Instagram, Twitter, Facebook, Github
MIT