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

Spec helpers #331

Merged
merged 4 commits into from Aug 6, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1,6 +1,6 @@
---
title: Articles
nav_order: 85
nav_order: 88
---

{% include tutorials.md %}
@@ -1,6 +1,6 @@
---
title: The Jets Community Conduct Guideline
nav_order: 90
nav_order: 93
---

We have picked the following conduct guideline based on Ruby's. We wish for the Jets community to be safe, productive, and collaborative. Each Jets related community may pick their own Conduct Guideline or Code.
@@ -1,6 +1,6 @@
---
title: Considerations
nav_order: 82
nav_order: 85
---

The following sections cover some considerations, limits, and benefits. Hopefully they are helpful.
@@ -1,6 +1,6 @@
---
title: API Gateway Routes
nav_order: 83
nav_order: 86
---

Jets translates `config/routes.rb` definitions to API Gateway Resources: [Routing Overview](http://rubyonjets.com/docs/routing/). Essentially, API Gateway is the routing layer of a Jets application. From the [AWS API Gateway](https://aws.amazon.com/api-gateway/) product page:
@@ -1,6 +1,6 @@
---
title: VPC
nav_order: 84
nav_order: 87
---

Though running your AWS Lambda functions within a VPC is supported, unless completely necessary, it is generally not recommended. The reasons are:
@@ -1,6 +1,6 @@
---
title: Contributing to Jets
nav_order: 88
nav_order: 91
---

Hi there! Interested in contributing to Jets? We'd love your help. Jets is an open source project, built one contribution at a time by users like you.
@@ -1,6 +1,6 @@
---
title: Core Resource Model
nav_order: 57
nav_order: 60
---

At the core of Jets is the resource model. Understanding the core `resource` model and method will allow you to create any resource supported by CloudFormation with Jets.
@@ -1,6 +1,6 @@
---
title: Custom Resources
nav_order: 56
nav_order: 59
---

You can create any custom AWS resources with Jets as a first-class citizen. There are 2 types of custom resources:
@@ -1,6 +1,6 @@
---
title: Debugging CloudFormation
nav_order: 45
nav_order: 48
---

Underneath the hood, CloudFormation is used to provision AWS resources. This is discussed in this [podcast](http://5by5.tv/rubyonrails/253) interview. Jets actually creates several CloudFormation stacks. It creates a parent stack and a bunch of nested child stacks. Jets manages this all for you.
@@ -1,6 +1,6 @@
---
title: CloudWatch Logs Search
nav_order: 47
nav_order: 50
---

CloudWatch search field might look like a simple plain text search box but it is not. The search filter supports some advanced Filter and Pattern matching syntax. More info here on the AWS Docs: [Filter and Pattern Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).
@@ -1,6 +1,6 @@
---
title: Debugging CloudWatch Logs
nav_order: 46
nav_order: 49
---

Being able to inspect the CloudWatch logs effectively helps debug your Lambda functions. The CloudWatch Logs interface may take a little time to get used to for those who are new to using the CloudWatch console. Hopefully, these docs provide a few useful tips to help you use CloudWatch logs effectively.
@@ -1,6 +1,6 @@
---
title: Debugging Event Payloads
nav_order: 48
nav_order: 51
---

Here are examples of event payloads for a typical CRUD controller. You must always specify the `path` key.
@@ -1,6 +1,6 @@
---
title: Debugging Tips
nav_order: 44
nav_order: 47
---

The next sections provide some debugging help tips for common issues. Hopefully, they are helpful.
@@ -1,6 +1,6 @@
---
title: Email Sending
nav_order: 52
nav_order: 55
---

Jets supports sending emails via ActionMailer.
@@ -1,6 +1,6 @@
---
title: Email Configuration Mailgun
nav_order: 54
nav_order: 57
---

Here's an example on how to set up email with Mailgun.
@@ -1,6 +1,6 @@
---
title: Email Configuration STMP
nav_order: 53
nav_order: 56
---

You can configure email with [initializers]({% link _docs/initializers.md %}). Example:
@@ -1,6 +1,6 @@
---
title: Email Previews
nav_order: 55
nav_order: 58
---

Jets supports previewing emails from [localhost:8888/jets/mailers](localhost:8888/jets/mailers). This can be enabled with:
@@ -1,6 +1,6 @@
---
title: Filters
nav_order: 67
nav_order: 70
---

Filters are methods that are run before or after a controller action.
@@ -1,6 +1,6 @@
---
title: Assets Serving
nav_order: 65
nav_order: 68
---

Jets handles asset serving by uploading asset files to s3 and serving them directly from s3. This is particularly beneficial for binary assets like images as s3 is better suited for serving them.
@@ -1,6 +1,6 @@
---
title: Blue-Green Deployment
nav_order: 74
nav_order: 77
---

## Background
@@ -1,6 +1,6 @@
---
title: 'Continuous Integration: Jets and CodeBuild'
nav_order: 76
nav_order: 79
---

This page discusses setting up Continuous Integration. We'll use [CodeBuild](https://aws.amazon.com/codebuild/), a fully managed build service from AWS. It is similar to other services like: [circleci](https://circleci.com/), [travis-ci](https://travis-ci.org/), [semaphoreci](https://semaphoreci.com/), etc.
@@ -1,6 +1,6 @@
---
title: Config Rules
nav_order: 71
nav_order: 74
---

Jets supports creating [AWS Config Rules](https://aws.amazon.com/config/) and associating them with lambda functions. First, make sure you have a `app/rules/application_rule.rb`:
@@ -1,6 +1,6 @@
---
title: Custom Inflections
nav_order: 70
nav_order: 73
---

Jets lookups folders, files, and classes based on naming conventions. It singularizes or pluralizes words as a part of this naming convention. For example:
@@ -1,6 +1,6 @@
---
title: Custom Lambda Layers
nav_order: 73
nav_order: 76
---

You can include and use your own [Custom Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html). This allows you to handle cases of extra customization like additional system libraries and gems. Here's how you configure custom Lambda Layers.
@@ -1,6 +1,6 @@
---
title: Gem Layer
nav_order: 72
nav_order: 75
---

Jets bundles your project's gem dependencies in a Gem Layer which is a [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html). From the AWS Docs:
@@ -1,6 +1,6 @@
---
title: Minimal Deploy IAM Policy
nav_order: 69
nav_order: 72
---

The IAM user you use to run the `jets deploy` command needs a minimal set of IAM policies in order to deploy a Jets application. Here is a table of the baseline services needed:
@@ -1,6 +1,6 @@
---
title: Rake Tasks
nav_order: 75
nav_order: 78
---

You can add custom rake tasks in the `lib/tasks` folder in your project. There's a `jets generate task` command to help you get started.
@@ -1,6 +1,6 @@
---
title: Error Handling
nav_order: 68
nav_order: 71
---

Jets provides some error handling capabilities in controllers that can rescue errors that occur during the callbacks or action. This is done with the `rescue_from` method.
@@ -1,6 +1,6 @@
---
title: Upgrading Guide
nav_order: 77
nav_order: 80
---

Upgrading Jets to some releases might require some extra changes. For example, the Jets project structure can change. Or some version require a manual blue-green deployment. This page provides a summary of the releases requiring some upgrade work.
@@ -1,6 +1,6 @@
---
title: 'Upload Binary Files: Images, Attachments, Etc'
nav_order: 66
nav_order: 69
---

Jets supports the ability to upload files like images via [Binary Support](https://aws.amazon.com/about-aws/whats-new/2016/11/binary-data-now-supported-by-api-gateway/). Binary support is enabled for `multipart/form-data` data. Jets converts the uploaded data from a standard HTML file input field and passes it to your controller as a file object through the `params` helper.
@@ -1,6 +1,6 @@
---
title: Faster Development
nav_order: 49
nav_order: 52
---

Here are some suggestions to speed up development with Jets and AWS Lambda.
@@ -1,6 +1,6 @@
---
title: Associated Resources
nav_order: 58
nav_order: 61
---

As explained in the [Core Resource Model](http://rubyonjets.com/docs/core-resource/) docs, methods like `rate` and `cron` simply perform some wrapper logic and then ultimately call the `resource` method. We'll cover that wrapper logic and expansion process in more details here.
@@ -1,6 +1,6 @@
---
title: Associated Resources Extensions
nav_order: 59
nav_order: 62
---

You can define your own custom associated resource methods. This helps for shorter and cleaner code. Remember that methods like `cron` and `rate` are just convenience methods that ultimately call the `resource` method. You can extend Jets with custom convenience methods.
@@ -1,6 +1,6 @@
---
title: Initializers
nav_order: 51
nav_order: 54
---

Jets supports custom initialization by running your app's `config/initializers` files during the bootup process.
@@ -1,6 +1,6 @@
---
title: Jets Turbine
nav_order: 50
nav_order: 53
---

A `Jets::Turbine` provides hooks to extend Jets and or modify the initialization process.
@@ -1,6 +1,6 @@
---
title: Lambda Gems
nav_order: 87
nav_order: 90
---

Jets deploy packages up the gems used by your application as part of the zip file and deploys it to AWS Lambda. Most gems can be used with Lambda as-is because they are pure Ruby code. However, some gems use compiled native extensions. For example, nokogiri uses compiled native extensions. This presents a problem as your machine's architecture likely does not match the AWS Lambda environment's architecture. The same compiled gems on your machine will not work on Lambda.
@@ -1,6 +1,6 @@
---
title: Next Steps
nav_order: 91
nav_order: 94
---

Hopefully, you have a good feel for how Jets works now. From here, there are a few resources that can help you continue along:
@@ -1,6 +1,6 @@
---
title: Polymorphic Node
nav_order: 80
nav_order: 83
---

To write your Jets Lambda functions in node, it would look like this:
@@ -1,6 +1,6 @@
---
title: Polymorphic Python
nav_order: 79
nav_order: 82
---

Polymorphic support for python works like so for the controller code:
@@ -1,6 +1,6 @@
---
title: Polymorphic Support
nav_order: 78
nav_order: 81
---

## What is polymorphic support?
@@ -1,6 +1,6 @@
---
title: 'Rails Support: Afterburner Mode'
nav_order: 81
nav_order: 84
---

Jets supports deploying Rails applications sometimes without any changes to your code. Note, this is an experimental feature.
@@ -1,6 +1,6 @@
---
title: Shared Resources
nav_order: 60
nav_order: 63
---

Shared resources are how you create **standalone** custom AWS resources with Jets. With the [Associated Resources]({% link _docs/function-resources.md %}), you can add custom AWS resources which are associated with Lambda functions. Shared resources are also fully customizable AWS resources, but they are not as meant to be associated with a Lambda function. Understanding Shared Resources will allow you to customize a Jets application with any custom resource.
@@ -1,6 +1,6 @@
---
title: Shared Resources Depends On
nav_order: 63
nav_order: 66
---

CloudFormation has a concept of the [DependsOn Attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html). Normally, you do not have to use it as CloudFormation is smart enough to figure out how to sequence the creation of the dependent resources most of the time. For example, if you are creating a Route53 Record that's connected to ELB, CloudFormation knows to create the ELB before proceeding to create the Route53 record. There are times though when you need to specify the DependsOn attribute to control the creation order explicitly.
@@ -1,6 +1,6 @@
---
title: Shared Resources DSL
nav_order: 61
nav_order: 64
---

As mentioned in [Shared Resources]({% link _docs/shared-resources.md %}), the `sns_topic` is simply a convenience method that calls the `resources` and `output` methods that add sections to the CloudFormation template. Shared Resources inherit from the `Jets::Stack` class. By inheriting from the `Jets::Stack` class, Shared Resources are provided access to a general CloudFormation template DSL. Here are the main methods of that DSL:
@@ -1,6 +1,6 @@
---
title: Shared Resources Extensions
nav_order: 62
nav_order: 65
---

To create your own Shared Resource Extensions, you define a module with the methods in the `app/shared/extensions` folder. Here's a simple example:
@@ -1,6 +1,6 @@
---
title: Shared Resources Functions
nav_order: 64
nav_order: 67
---

For some Shared Resources you might need to create Lambda functions themselves. Instead of writing the Lambda function code inline with the Shared Resource definition, you can define them in `app/shared/functions` and declare them with the `function` helper. Here's an example:
@@ -0,0 +1,8 @@
---
title: Testing
nav_order: 44
---

Jets uses rspec for its default testing framework. Jets has some light support for spec helpers. Contributions are appreciated for more spec helpers!

{% include prev_next.md %}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.