https://github.com/phstc/shoryuken-serverless
PoC for Shoryuken Serverless - SQS as an Event Source for Lambdas
https://github.com/phstc/shoryuken-serverless
Last synced: about 1 year ago
JSON representation
PoC for Shoryuken Serverless - SQS as an Event Source for Lambdas
- Host: GitHub
- URL: https://github.com/phstc/shoryuken-serverless
- Owner: phstc
- Created: 2018-12-01T01:57:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-14T04:32:01.000Z (over 3 years ago)
- Last Synced: 2025-03-31T00:01:34.560Z (over 1 year ago)
- Language: Ruby
- Homepage: https://github.com/phstc/shoryuken/wiki/Shoryuken-Serverless---SQS-as-an-event-source-for-Lambdas
- Size: 27.5 MB
- Stars: 19
- Watchers: 2
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Shoryuken Serverless
This is a PoC for making existing [Shoryuken](https://github.com/phstc/shoryuken) (Active Job or Standard workers) to work with [Lambda Ruby using SQS as an event source](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html).
### Shoryuken Lambda
Check [this sample Lambda](https://github.com/phstc/shoryuken-serverless/blob/master/rails_sample_app/lambda.rb) for an example of Shoryuken compatible Lambda
It is important to load Rails outside the method `handler` so that it gets "cached" while your Lambda (container) is still hot.
#### Lambdas vs Queues
The number of Lambdas or queues is entirely up to you. You can use multiple queues and Lambdas - it is all up-to-you.
### Deploy your Lambdas
For deploying your Ruby Lambdas, you need to vendorize your gems with the same container Ruby Lambdas run.
```sh
docker run -v `pwd`:`pwd` -w `pwd` -i -t lambci/lambda:build-ruby2.5 bundle install --deployment --without development test
docker run -v `pwd`:`pwd` -w `pwd` -i -t lambci/lambda:build-ruby2.5 gem pristine --all
```
#### Deploy with aws-cdk
This sample app uses [aws-cdk](https://github.com/awslabs/aws-cdk) for making it easy to create stacks and deploy Lambda.
For deploying your stack using this sample project, you can run the commands below (or `./deploy.sh`).
```sh
(
cd rails_sample_app
docker run -v `pwd`:`pwd` -w `pwd` -i -t lambci/lambda:build-ruby2.5 bundle install --deployment --without development test
docker run -v `pwd`:`pwd` -w `pwd` -i -t lambci/lambda:build-ruby2.5 gem pristine --all
)
npm run build
cdk deploy
```