Skip to content

Latest commit

 

History

History
106 lines (72 loc) · 4.11 KB

README.md

File metadata and controls

106 lines (72 loc) · 4.11 KB

serverless AWS Rust HTTP template

A sample template for bootstraping Rustlang AWS Lambda HTTP applications with ⚡ serverless framework ⚡.

✨ features

  • 🦀 Build Rustlang applications with ease
  • 🛵 Continuous integration testing with travis CI
  • 🚀 Continuous deployment with travis CI
  • 🧪 Tests
  • 👩‍🏭 Simplified make based workflow

📦 install

Install the serverless framework cli.

Then then run the following in your terminal

$ npx serverless install \
  --url https://github.com/softprops/serverless-aws-rust-http \
  --name my-new-api

This will download the source of a sample Rustlang application and unpack it as a new service named "my-new-api" in a directory called "my-new-api"

🧙 how to be a wizard

Assumming you have aws credentials with appropriate deployment permissions configured in a profile named "prod", you could impress your friends by creating a project that is born in production.

$ npx serverless install \
  --url https://github.com/softprops/serverless-aws-rust-http \
  --name my-new-api \
  && cd my-new-api \
  && AWS_PROFILE=prod make dependencies deploy

make dependencies will make sure npm dependencies are installed, this only needs run once. The first time you run make deploy it will pull down and compile the base set of dependencies and your application. Unless the dependencies change afterwards, this should only happen once, resulting in an out of the box rapid deployment cycle.

🛵 continuous integration and deployment

This template includes an example travis configuration file which can unlock a virtuous cycle of continuous integration and deployment ( i.e all tests are run on prs and every push to master results in a deployment ).

To set up travis you will need to do a view things.

Firstly, version control your source. Github is free for opensource.

$ git init
$ git remote add origin git@github.com:{username}/{my-new-service}.git

Using the travis cli, bootstrap your git repos' travis integration.

$ travis enable
# set up AWS credentials for serverless deployment
# https://serverless.com/framework/docs/providers/aws/guide/credentials/
$ travis env set AWS_ACCESS_KEY_ID 'xxx'
$ travis env set AWS_SECRET_ACCESS_KEY 'xxx'

⭐ You can optionally generate code coverage reports with coveralls by enabling your repo here. You may need to sync repos first. You can then view your coverage reports at https://coveralls.io/github/{username}/{my-new-service}

Add your changes to git and push them to github.

Finally, https://travis-ci.org/{username}/{my-new-service} in your browser and grab a bucket of popcorn 🍿

🔫 function triggering

With your function deployed in production you can now start triggering it using serverless framework directly or the AWS integration you've configured to trigger it on your behalf

$ AWS_PROFILE=prod npx serverless invoke --stage prod -f hello -d '{"foo":"bar"}'

👴 retiring

Experimentation will likely facilitate retiring ideas. Retiring applications should be as easy as creating and deploying them them. This project provides a dual to make deploy for doing so: make destroy

$ AWS_PROFILE=prod make destroy

ℹ️ additional information

👯 contributing

This template's intent is to set a minimal baseline for getting engineers up an running with a set of repeatable best practices. See something you'd like in this template that would help others? Feel free to open a new github issue. Pull requests are also welcome.