Skip to content

equivalent/my_awesome_lambda-lamby

Repository files navigation

Lamby test project

Ipossible is here. You can now run Ruby on Rails applications on AWS Lambda

All thanks to mr Ken Collins and his briliant project Lamby

We have Serverless Ruby for couple of years, now we will have serverless Ruby on Rails. How cool is that !?

This repo is a test project where I test limitations of what is possible and what is not.

It's alive !

hosted at: https://ror.serverless-ruby.org/

I'm using Cloudfront as a DNS for custom domain for https

Direct AWS API Gateway link: https://1m1x0sga74.execute-api.eu-west-1.amazonaws.com/production (JS will not load as it's /production)

Code desicions:

  • I'm loading app JS via Webpacker (StimulusJS controllers)
  • webpacker needs to be compiled via rails webpacker:compile before deploy (check bin/_build)
  • Asset pipeline is not that good idea. I tried it first but found it too much work compared to Webpacker for this particular setup (Lambda)
  • I'm loading Bootstrap Css & JS via CDN (because this is serverless platform, it's better this way)

original Readme

Made with Lamby's quick start to create a new Rails application for AWS Lambda. Details:

  • Rails v6.x on Ruby 2.7 runtime.
  • Integrated JavaScript development.
  • Compiles CSS/JS assets with LibSass & Webpacker.
  • No ActiveRecord. Read our Database Options guides.

Lamby: Simple Rails & AWS Lambda Integration using Rack.

Setup & Deploy

$ ./bin/bootstrap
$ ./bin/setup
$ ./bin/deploy

Next Steps

  • Provide a new value for the SECRET_KEY_BASE. Alternatively, you can set this using Dotenv & SSM Parameter Store in the Environments & Configuration section of your build file.
  • Using JavaScript? Webpacker is setup and ready to go, but we commented out the yarn install in the ./bin/_setup script. Uncomment to enable. Also uncomment both the CSS & JavaScript include tags in the app/views/layouts/application.html.erb file.

Related resources