Update Project
Let’s make some changes. Let’s start with manual changes. It’ll help you get to know how things work.
Change Lambda Function
The Lambda Console allows us to edit code directly with the browser. It allows us to test, debug, and learn quickly. We’ll add a puts "debug 1"
statement.
You can click Deploy to deploy the changes.
Jets Logs
You can also use the jets logs command to tail the logs in your terminal.
❯ jets logs -f
Tailing logs for /aws/lambda/rack-dev-controller
debug 1
2024-05-22 21:04:22 +0000: hello from rack
The jets logs command will use the Log Group from the controller Lambda function, IE: /aws/lambda/rack-demo-dev-controller
, so we do not have to specify the name as we did in the Jets Project Job Learn Guide.
Update Code and Deploy Changes
So far, we have been making manual changes. We should codify the changes. To help see the changes, let’s make some additional changes so that it’s easy to check.
app.rb
class App
def self.call(env)
puts "debug 2"
text = "hello from rack"
puts "#{Time.now}: #{text}"
headers = {"Content-Type" => "text/plain"}
body = [text]
status = 200
[status, headers, body]
end
end
Deploy again
❯ jets deploy -y
Packaging code for deploy: rack-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/rack-dev-remote/build/rack-dev-remote%3Abc307021-b524-49fc-b594-af39c1fca62c/log
...
Running: jets-remote deploy
...
#14 [build 7/13] RUN bundle install
...
Built docker image: rack-dev-build-18a17437
Building CloudFormation templates
Built CloudFormation templates at /tmp/jets/rack-dev/templates
Deploying app: rack-dev
Waiting for stack to complete
09:07:02PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack rack-dev User Initiated
...
09:08:04PM UPDATE_COMPLETE AWS::CloudFormation::Stack rack-dev
Stack success status: UPDATE_COMPLETE
Release 2: https://www.rubyonjets.com/projects/rack/releases/release-rNYWfkTivZkKcnFl
Prewarming application
Lambda Url
Once changes have been deployed, confirm Lambda Source code changes.
If you still have jets logs running in a terminal, you’ll see logs tailing as you’re testing.
Next, we’ll delete the project.