npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-cli-deploy-fastboot-api-lambda

v0.0.7

Published

An ambitious ember-cli-deploy plugin for serving Ember FastBoot Applications entirely from within AWS Lambda/API Gateway (assets and all!).

Downloads

12

Readme

ember-cli-deploy-fastboot-api-lambda

npm version

An ambitious ember-cli-deploy plugin for serving Ember FastBoot Applications entirely from within AWS Lambda/API Gateway (assets and all!).

Background

API Gateway now supports the handling binary payloads, which means an end-to-end fastboot hosting solution can now be achieved through API gateway and Lambda without the use of S3 for serving static files. This is what this addon aims to achieve.

Prerequisites

Installation

  • Install the ember-cli-deploy addons
ember install ember-cli-deploy
ember install ember-cli-deploy-build
ember install ember-cli-deploy-fastboot-api-lambda

Configuration

  • Configure the deployment variables
// config/deploy.js
ENV['fastboot-api-lambda'] = {
  accessKeyId: process.env.AWS_ACCESS_KEY_ID,         // (Required) AWS accessKeyId (must have permission to deploy lambda functions)
  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, // (Required) AWS secretAccessKey
  lambdaFunction: 'my-ember-app',                     // (Required) Lambda functions name
  region: 'us-east-1',                                // (Required) Region where lambda is deployed

  fallbackPath: '/'                                   // (optional) The route that will be attempted if the current route fails. i.e. doesn't exist, fails etc.
  stringyExtensions: [                                // (optional) The file extensions that will be treated as text and not binary. Defaults are shown. Any additional items will be concatenated to this list.
    'html',
    'css',
    'js',
    'json',
    'xml',
    'ico',
    'txt',
    'map'
  ],
  validAssetPaths: [                                  // (optional) The assets paths that the lambda is explicitly allow serve. Defaults are shown. Any additional items will be concatenated to this list.
    '/assets/',
    '/robots.txt',
    '/humans.txt',
    '/crossdomain.xml',
    '/sitemap.xml'
  ]
};
  • Create the lambda function

    • Open the AWS Lambda console.
    • Select the region that you defined in your deploy variables above.
    • Create a blank lambda, with the name you defined in your deploy variables above.
      • Handler => index.handler.
      • Role => Create a custom role. Give it a name and use the default policy document.
      • Memory => 128.
      • Timeout => 30 seconds.
    • Select Next and then select Create function.
  • Create the API Gateway Proxy

    • Open the AWS API Gateway console.
    • Select the region that you defined in your deploy variables above.
    • Select New API and give it a name
    • Select Binary Support. Click Edit. Add */* and click Save.
    • Create proxy method:
      • Under resources, click /, then click Actions => Create Method. Select Any.
      • Click the Any label, choose Integration type lambda, check the Use Lambda Proxy integration checkbox, and finally select your lambda function's region and name.
    • Create proxy resource:
      • Under resources, click /, then click Actions => Create Resource. Select Any.
      • Select Configure as proxy resource, and select Enable API Gateway CORS.
      • Select Integration type Lambda Function Proxy, and finally select your lambda function's region and name.
    • Under resources, click Actions => Deploy API. Select a new stage and give it the name fastboot. Hit Deploy. You will now see the Invoke URL. This is where you site will be hosted.
  • Ember Application

    • The rootURL must match the stage name you selected when creating the api gateway. Otherwise the link-to helper wont work.
    // config/environment.js
    var ENV = {
      rootURL: '/fastboot/'
    }
  • Configuration is done! 🎉

Deployment

Is as simple as going:

ember deploy production --activate --verbose=true

Caveats

Just a word of warning.. just because this architecture is possible, doesn't make it the optimal for all use-cases. Lambda functions suffer from a cold start delay, which can make response times unpredictable.

Sites using this addon

Feel free to make a pull request if you would like your site added to the list!

Credit

ember-cli-deploy-fastboot-lambda for providing the base upload logic.

Information

For more information on using ember-cli, visit http://www.ember-cli.com/.

For more information on using ember-cli-deploy, visit https://github.com/ember-cli-deploy/ember-cli-deploy.