Deploy Project

Jets Account

You will need a Jets account to deploy. You can sign up at www.rubyonjets.com. New users get a 14-day free trial period for their AWS account.

Deploy

Let’s deploy the project to AWS Lambda.

❯ jets deploy

The deploy command shows the stack that will be deploy and ask if you are sure.

❯ jets deploy
Will deploy events-dev
Are you sure? (y/N) y

Type y and press enter to kick off the deploy.

Are you sure? (y/N) y
Syncing bootstrap: events-dev
Waiting for stack to complete
10:12:58PM CREATE_IN_PROGRESS AWS::CloudFormation::Stack events-dev User Initiated
...
10:13:21PM CREATE_COMPLETE AWS::CodeBuild::Project Codebuild
10:13:25PM CREATE_COMPLETE AWS::S3::Bucket S3Bucket
10:13:26PM CREATE_COMPLETE AWS::CloudFormation::Stack events-dev
...
Packaging code for deploy: events-dev
Started remote run for deploy
Ctrl-C will stop showing logs. Jets will continue to run remotely.
If you want to stop the remote process, use: jets stop
Console Log Url:
https://us-west-2.console.aws.amazon.com/codesuite/codebuild/projects/events-dev-remote/build/events-dev-remote%3A866ee4a9-4a41-4902-87cd-b9b7c62cee9a/log
Phase: SUBMITTED Status: SUCCEEDED Duration: 0s
Phase: QUEUED Pending
Phase: QUEUED Status: SUCCEEDED Duration: 0s
Phase: PROVISIONING Pending
Phase: PROVISIONING Status: SUCCEEDED Duration: 8s
[Container] 2024/05/22 22:13:42.813604 Running command ./jets-go deploy
Extracting code
Running: jets-remote deploy
Building docker image: events-dev-build-a610e36f
#0 building with "default" instance using docker driver
...
#7 [internal] load metadata for public.ecr.aws/lambda/ruby:3.2
...
#16 [build  7/13] RUN bundle install
Built docker image: events-dev-build-a610e36f
Building CloudFormation templates
Built CloudFormation templates at /tmp/jets/events-dev/templates
Deploying app: events-dev
Waiting for stack to complete
10:14:32PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack events-dev User Initiated
...
10:16:13PM UPDATE_COMPLETE AWS::CloudFormation::Stack events-dev
Stack success status: UPDATE_COMPLETE
Release 1: https://www.rubyonjets.com/projects/events/releases/release-dDsBRgkJXVaveXXs

How Jets Deployment Works

  1. Jets first creates a bootstrap stack to create an S3 bucket and CodeBuild project.
  2. It packages up your code to a zip file and uploads it S3 for deployment.
  3. The rest of the deploy runs on the CodeBuild Remote Runner. It analyzes your source code, uses Docker to build dependencies, and deploys with CloudFormation to your AWS account.

Serverless Resources like AWS Lambda Functions, CloudWatch Event Rules, CloudFront Distributions, SQS Job Queues are created based on what you’ve configured. At the end, you see an AWS Lambda Function URL that points to your deployed app.

Tip: For faster deploys, you can use a Remote Docker Daemon or CodeBuild Fleets. This speeds up the build times since Docker caches can be reused.

Release History

A release record is created at the end of the deployment. You can see the release history with:

❯ jets release:history
Releases for stack: events-dev
+---------+-----------------+---------------+---------+
| Version |     Status      |  Released At  | Message |
+---------+-----------------+---------------+---------+
| 1       | UPDATE_COMPLETE | 8 minutes ago | Deploy  |
+---------+-----------------+---------------+---------+

For detailed information about each release you can also use jets release:info. You can also rollback to previous code and infrastructure with jets rollback if needed.

Next, we’ll review the deployed project.