Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #4

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ yarn-error.log
/.idea
/.vscode
/xdebug
/.serverless/
/dump.rdb
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,53 @@ but it's extremely recommended to use [Supervisor](http://supervisord.org/) when

Laravel has a nice guide to properly [configure](https://laravel.com/docs/10.x/queues#supervisor-configuration) the Supervisor.

## Serverless deployment to AWS Lambda

This project uses [Bref](https://bref.sh/) framework to empower a smoothly deployment to
AWS Lambda.

It has a tiny list of dependencies to achieve that:

- Node.js 14.0+
- [Serverless](https://www.serverless.com/framework/docs) framework
- and, an AWS account (key and secret).

To install the Serverless framework:

```bash
$ npm install -g serverless
```

Install Serverless plugin dependency:
```bash
$ npm install
```

And them, setup the AWS credentials for the Serverless framework:
```bash
$ serverless config credentials --provider aws --key "key" --secret "secret"
```

You can change the project name on file `serverless.yml` to match your project name,
right on the first line:

```yml
service: laravel-mail-api
```

Last step before the actual deployment is to clear local cashed files:
```bash
$ php artisan config:clear
```

and, them:
```bash
$ serverless deploy
```

Once the process is finished, you will be prompted with the endpoint,
functions and jobs created on AWS Lambda!

## Contributing

Please, see [CONTRIBUTING](./contributing.md) for details.
Expand Down
1 change: 1 addition & 0 deletions app/Jobs/EmailDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function handle()
Mail::to($this->toEmail, $this->receiver)
->locale($this->getLanguage($this->language))
->send($this->message);
Log::info('Email sent');
}

/**
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"license": "MIT",
"require": {
"php": "^8.1",
"bref/bref": "^2.1",
"bref/laravel-bridge": "^2.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.2",
Expand Down
Loading