### Example deployment command Source: https://docs.rubyonjets.com/reference/jets-deploy Standard usage example for the deployment command. ```bash $ jets deploy ``` -------------------------------- ### SSM Parameter Examples Source: https://docs.rubyonjets.com/docs/config/jets Example paths for SSM values required by the bootstrap configuration. ```text /dev/BUNDLE_GITHUB__COM /dev/DOCKER_PASS /dev/DOCKER_USER ``` -------------------------------- ### Start the Hanami development server Source: https://docs.rubyonjets.com/docs/learn/hanami/local-testing Use this command to start the development server, which includes automatic asset compilation. ```bash ❯ bundle exec hanami dev 03:20:47 web.1 | started with pid 708395 03:20:47 assets.1 | started with pid 708396 03:20:48 assets.1 | [demo] [watch] build finished, watching for changes... 03:20:48 web.1 | 03:20:48 - INFO - Puma starting on port 2300 in development environment. ... 03:20:49 web.1 | * Listening on http://0.0.0.0:2300 03:20:49 web.1 | * Starting control server on http://127.0.0.1:9293 03:20:49 web.1 | Use Ctrl-C to stop ``` -------------------------------- ### Install Dependencies Source: https://docs.rubyonjets.com/docs/learn/events/new-project Execute the bundler command to install the gems defined in the Gemfile. ```bash bundle ``` -------------------------------- ### Rollback Example Source: https://docs.rubyonjets.com/reference/jets-rollback Example of rolling back to release version 8. ```bash jets rollback 8 ``` -------------------------------- ### Run jets ci:start Source: https://docs.rubyonjets.com/reference/jets-ci-start Executes the CI start build process. ```bash jets ci:start ``` -------------------------------- ### Interactive REPL session examples Source: https://docs.rubyonjets.com/reference/jets-exec Examples of commands executed within the interactive REPL environment. ```bash ❯ jets exec > pwd /var/task > whoami sbx_user1051 > echo $AWS_REGION us-west-2 > env | sort ``` ```bash ❯ jets exec > env | sort > cat /etc/os-release > du -sh * | sort -sh ``` -------------------------------- ### Dockerfile Build Argument Placement Source: https://docs.rubyonjets.com/docs/docker/build-args Example of how build arguments are injected into the multi-stage Dockerfile after system and user package installations. ```dockerfile ARG BUILD_ARG1 # <===== ADDED FROM ruby:3.2.3-slim as base # ... FROM base as build RUN apt-get update && apt-get install -y build-essential ARG BUILD_ARG2 # <===== ADDED RUN bundle install # ... FROM base as deployment RUN apt-get update && apt-get install -y curl ARG BUILD_ARG3 # <===== ADDED COPY --from=build /usr/local/bundle /usr/local/bundle # ... ENTRYPOINT [ "aws_lambda_ric" ] CMD [ "handlers/controller.lambda_handler" ] ``` -------------------------------- ### Jets init command output Source: https://docs.rubyonjets.com/docs/learn/events/jets-init Example output showing the files created during the initialization process. ```text ❯ jets init This will initialize the project for Jets. It make changes to your project source code. Please make sure you have backed up and committed your changes first. Are you sure? (y/N) y create config/jets/env/.env create config/jets/bootstrap.rb create config/jets/deploy.rb create config/jets/project.rb ``` -------------------------------- ### Start Rails Server Source: https://docs.rubyonjets.com/docs/learn/rails/local-testing Command to launch the local development server. ```bash ❯ rails server => Booting Puma => Rails 7.1.3.2 application starting in development * Listening on http://127.0.0.1:3000 Use Ctrl-C to stop ``` -------------------------------- ### Monitor Create Request Logs Source: https://docs.rubyonjets.com/docs/learn/rails/local-testing Example output when creating a new post. ```text Started POST "/posts" for 127.0.0.1 at 2023-10-28 14:17:22 +0000 Processing PostsController#create Parameters: {"post":{"title":"Post 3","body":"Body 3","published":true}} Completed Status Code 201 in 0.017s ``` -------------------------------- ### Bundler Environment Variable Examples Source: https://docs.rubyonjets.com/docs/ci/private-repos Examples of environment variable formats used to authenticate with private gem sources. ```text BUNDLE_GEM__FURY__IO BUNDLE_GEMS__CONTRIBSYS__COM BUNDLE_GITHUB__COM ``` -------------------------------- ### Example SSM Parameter Paths Source: https://docs.rubyonjets.com/docs/env/ssm/conventions Example of SSM parameter paths that Jets will automatically load based on the project and environment. ```text /demo/dev/DATABASE_URL /demo/dev/SECRET_KEY_BASE ``` -------------------------------- ### SSM Environment Resolution Examples Source: https://docs.rubyonjets.com/docs/env/ssm Demonstrates how ssm_env resolves based on the one_dev configuration setting. ```text JETS_ENV=dev # ssm_env => dev JETS_ENV=prod # ssm_env => prod JETS_ENV=qa # ssm_env => dev # config.dotenv.ssm.one_dev = true ``` ```text JETS_ENV=dev # ssm_env => dev JETS_ENV=prod # ssm_env => prod JETS_ENV=qa # ssm_env => qa # config.dotenv.ssm.one_dev = false ``` -------------------------------- ### Environment-specific dotenv files Source: https://docs.rubyonjets.com/docs/env/files Example structure for environment-specific configuration files. ```text config/jets/env/.env config/jets/env/.env.dev config/jets/env/.env.prod ``` -------------------------------- ### Start local server with Puma Source: https://docs.rubyonjets.com/docs/learn/rack/local-testing Use the bundle exec puma command to launch the local development server. ```bash ❯ bundle exec puma Puma starting in single mode... * Listening on http://0.0.0.0:9292 Use Ctrl-C to stop ``` -------------------------------- ### Example output of jets init Source: https://docs.rubyonjets.com/docs/learn/sinatra/jets-init The command detects the Sinatra framework and creates the necessary configuration files in the config/jets directory. ```text ❯ jets init Detected Sinatra framework. This will initialize the project for Jets. It will make changes to your project source code. Please make sure you have backed up and committed your changes first. Are you sure? (y/N) y create config/jets/bootstrap.rb create config/jets/deploy.rb create config/jets/project.rb ``` -------------------------------- ### Generate Mailer and Setup Source: https://docs.rubyonjets.com/docs/rails/email/previews Commands to create a new Rails project and generate a mailer for testing. ```bash rails new demo cd demo rails generate migration create_users name:string rails db:migrate rails generate mailer UserMailer new_user ``` -------------------------------- ### Conventional CloudFront Alias Examples Source: https://docs.rubyonjets.com/docs/routing/lambda/cloudfront/distribution Examples of how Jets automatically generates CloudFront aliases based on environment variables. ```bash JETS_ENV=dev jets deploy => demo-dev.example.com JETS_ENV=prod jets deploy => demo-prod.example.com JETS_EXTRA=beta jets deploy => demo-dev-beta.example.com JETS_EXTRA=2 jets deploy => demo-dev-2.example.com ``` -------------------------------- ### Custom buildspec.yml File Example Source: https://docs.rubyonjets.com/docs/ci/buildspec An example of a custom buildspec.yml file located at config/jets/ci/buildspec.yml. ```yaml version: 0.2 phases: build: commands: - bundle - bundle exec jets deploy -y ``` -------------------------------- ### Example CLI session for concurrency management Source: https://docs.rubyonjets.com/docs/jobs/concurrency A demonstration of checking, setting, and verifying concurrency settings for a specific Lambda function. ```bash ❯ jets concurrency:get -n jets-urgent_queue_event-handle Settings for Function: rails-dev-jets-urgent_queue_event-handle Reserved concurreny: 22 Provisioned concurrency: not set ❯ jets concurrency:set -n jets-urgent_queue_event-handle --reserved 200 Will update the concurrency settings for rails-dev-jets-urgent_queue_event-handle Are you sure? (y/N) y Updating concurrency settings for rails-dev-jets-urgent_queue_event-handle Set reserved concurrency to 200 ❯ jets concurrency:get -n jets-urgent_queue_event-handle Settings for Function: rails-dev-jets-urgent_queue_event-handle Reserved concurrency: 200 Provisioned concurrency: not set ❯ jets concurrency:info Concurrency for rails-dev +--------------------------------------+ | Function | Reserved | +--------------------------------------+ | controller | 25 | | jets-default_queue_event-handle | 5 | | jets-low_priority_queue_event-handle | 2 | | jets-prewarm_event-handle | 2 | | jets-urgent_queue_event-handle | 200 | | total | 234 | +--------------------------------------+ Account Limits Concurrent Executions: 1000 Unreserved Concurrent Executions: 428 ``` -------------------------------- ### Define an Example Job Source: https://docs.rubyonjets.com/docs/jobs/enable Create a standard ActiveJob class that inherits from ApplicationJob. ```ruby class CleanupJob < ApplicationJob def perform(*args) puts "Cleaning up: #{args}" end end ``` -------------------------------- ### Example output of jets projects Source: https://docs.rubyonjets.com/reference/jets-projects Displays the standard output format when running the projects command. ```text ❯ jets projects api backend demo ``` -------------------------------- ### Example Output of jets url Source: https://docs.rubyonjets.com/reference/jets-url Shows the typical output format returned by the command. ```text $ jets url https://v9wa7vqcia.execute-api.us-west-2.amazonaws.com/dev ``` -------------------------------- ### Examples of jets generate:event Source: https://docs.rubyonjets.com/reference/jets-generate-event Various examples demonstrating how to generate event code for different AWS triggers and methods. ```bash jets generate:event log --trigger log --method report jets generate:event cool --trigger scheduled jets generate:event security --trigger rule --method detect_security_group_changes jets generate:event clerk --trigger dynamodb --method file jets generate:event thermostat --trigger iot --method measure jets generate:event data --trigger kinesis --method file jets generate:event upload --trigger s3 jets generate:event messenger --trigger sns --method deliver jets generate:event waiter --trigger sqs --method order ``` -------------------------------- ### Start Local Docker Container Source: https://docs.rubyonjets.com/docs/debug/docker Retrieves the current Docker image URI and starts an interactive bash session to inspect the environment. ```bash jets release:info DOCKER_IMAGE=$(jets release:info --format json | jq -r '."Docker Image"') docker run --rm -ti --entrypoint '' $DOCKER_IMAGE bash ``` -------------------------------- ### Deployment Log Output Source: https://docs.rubyonjets.com/docs/learn/hanami/deploy Example of the terminal output during a successful deployment process. ```text Are you sure? (y/N) y Syncing bootstrap: hanami-dev Waiting for stack to complete 03:45:54AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack hanami-dev User Initiated ... 03:46:16AM CREATE_COMPLETE AWS::CodeBuild::Project Codebuild 03:46:17AM CREATE_COMPLETE AWS::CodeBuild::Project CodebuildLambda 03:46:21AM CREATE_COMPLETE AWS::S3::Bucket S3Bucket 03:46:22AM CREATE_COMPLETE AWS::CloudFormation::Stack hanami-dev Stack success status: CREATE_COMPLETE Packaging code for deploy: hanami-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/hanami-dev-remote/build/hanami-dev-remote%3Ace78c307-061a-4f8f-8402-0ad33e0899e5/log Phase: SUBMITTED Status: SUCCEEDED Duration: 0s Phase: QUEUED Pending Phase: QUEUED Status: SUCCEEDED Duration: 0s Phase: PROVISIONING Pending Phase: PROVISIONING Status: SUCCEEDED Duration: 9s [Container] 2024/05/22 03:46:40.919678 Running command ./jets-go deploy Extracting code Running: jets-remote deploy Building docker image: hanami-dev-build-33105d4d #0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile ... #6 [internal] load metadata for docker.io/library/ruby:3.2.3-slim ... #22 [build 11/16] RUN bundle install ... #26 [build 15/16] RUN yarn install ... #27 [build 16/16] RUN bundle exec hanami assets compile ... Built docker image: hanami-dev-build-33105d4d => docker tag hanami-dev-build-33105d4d 536766270177.dkr.ecr.us-west-2.amazonaws.com/hanami-dev-ecrrepo-fduifazvm43b:v1-2024-05-22T03-48-00Z-main-468f142 => docker push 536766270177.dkr.ecr.us-west-2.amazonaws.com/hanami-dev-ecrrepo-fduifazvm43b:v1-2024-05-22T03-48-00Z-main-468f142 Building CloudFormation templates Built CloudFormation templates at /tmp/jets/hanami-dev/templates Deploying app: hanami-dev Waiting for stack to complete 03:48:14AM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack hanami-dev User Initiated ... 03:50:13AM UPDATE_COMPLETE AWS::CloudFormation::Stack hanami-dev Stack success status: UPDATE_COMPLETE Release 1: https://www.rubyonjets.com/projects/hanami/releases/release-02l1e7NSpB9kHsys Prewarming application Lambda Url https://x6ge6mf7vpcj5yh72tvlw522zq0zyuxd.lambda-url.us-west-2.on.aws ``` -------------------------------- ### Define SSM parameter paths Source: https://docs.rubyonjets.com/docs/env/ssm/unique-envs Examples of SSM parameter naming conventions for different environments. ```text demo/dev/DATABASE_URL demo/prod/DATABASE_URL ``` ```text demo/sbx/DATABASE_URL demo/uat/DATABASE_URL ``` -------------------------------- ### ssm_env Resolution Examples Source: https://docs.rubyonjets.com/docs/env/ssm/legacy Shows how the ssm_env helper resolves based on the long_env_helper configuration setting. ```text BUNDLE_GITHUB__COM: "SSM:/development/BUNDLE_GITHUB__COM" ``` ```text BUNDLE_GITHUB__COM: "SSM:/#{ssm_env}/BUNDLE_GITHUB__COM" ``` -------------------------------- ### Gitignore Environment File Patterns Source: https://docs.rubyonjets.com/docs/docker/dockerfile/code-zip Examples of .gitignore configurations to manage environment file inclusion for CI/CD pipelines. ```text # Ignore all environment files except templates /.env* !/.env*.erb ``` ```text # Ignore all environment files except /config/jets/env/.env .env* !/config/jets/env/* ``` -------------------------------- ### Cookie Management Source: https://docs.rubyonjets.com/reference/jets-curl Examples for passing cookies and saving them to a cookie jar file. ```bash jets curl / --cookie "cookie1=value1; cookie2=value2" ``` ```bash jets curl / --verbose --trim -c cookies.txt ``` ```bash jets curl / -b cookies.txt ``` -------------------------------- ### Monitor Update Request Logs Source: https://docs.rubyonjets.com/docs/learn/rails/local-testing Example output when updating an existing post. ```text Processing PostsController#update Parameters: {"post":{"title":"Post 3 Edit 1","body":"Body 3","published":true},"id":"3"} Completed Status Code 200 in 0.010s ``` -------------------------------- ### Example output of jets stacks Source: https://docs.rubyonjets.com/reference/jets-stacks Shows the expected output format when listing stacks for a project. ```text ❯ jets stacks Stacks for project: demo demo-dev demo-prod ``` -------------------------------- ### Example Output of jets dotenv:list Source: https://docs.rubyonjets.com/reference/jets-dotenv-list Displays the standard output format when running the command. ```text ❯ jets dotenv:list NAME1=value1 NAME2=value2 ``` -------------------------------- ### Verify Prewarm Headers Source: https://docs.rubyonjets.com/docs/config/prewarming Example output showing the custom headers appended by Jets to identify prewarmed Lambda functions. ```text x-jets-boot-at: 2024-04-17 18:08:45 UTC x-jets-prewarm-at: 2024-04-17 18:31:22 UTC x-jets-prewarm-count: 22 x-jets-gid: cb205b47 ``` -------------------------------- ### Define environment variables for SMTP Source: https://docs.rubyonjets.com/docs/rails/email/configuration Example configuration for an environment file using SSM parameter references. ```text RAILS_ENV=production SMTP_ADDRESS=SSM # /dev/demo/SMTP_ADDRESS => email-smtp.us-west-2.amazonaws.com SMTP_DOMAIN=SSM # /dev/demo/SMTP_DOMAIN => mydomain.com SMTP_USERNAME=SSM # /dev/demo/SMTP_USERNAME => ABCASD5MXAIYXEXAMPLE SMTP_PASSWORD=SSM # /dev/demo/SMTP_PASSWORD => ABCunGBKLUdbPdAH/FSxAi8eId99EyAOJz+mxEXAMPLE ``` -------------------------------- ### Docker Build Argument Example Source: https://docs.rubyonjets.com/docs/ci/private-repos Conceptual representation of how environment variables are passed to the Docker build process. ```bash docker build --build-arg BUNDLE_GITHUB__COM=*** ... ``` -------------------------------- ### Configure CI settings Source: https://docs.rubyonjets.com/docs/ci/getting-started Example configuration for CI source, environment variables, and triggers in the Jets configuration file. ```ruby Jets.deploy.configure do config.ci.source = { Type: "GITHUB", Location: "https://github.com/ORG/REPO" } config.ci.source_version = "main" config.ci.env.vars = { BUNDLE_GITHUB__COM: "SSM:/#{ssm_env}/BUNDLE_GITHUB__COM", JETS_API_TOKEN: "SSM:/#{ssm_env}/JETS_API_TOKEN" } config.ci.triggers = true end ``` -------------------------------- ### Example Prewarm Log Output Source: https://docs.rubyonjets.com/docs/config/logging Displays the log output format when prewarming requests are enabled. ```bash $ jets logs -f START RequestId: aef5f99f-3eea-4963-bc17-02717248a83f Version: $LATEST Prewarm request: {"boot_at":"2024-04-26 02:00:36 UTC","gid":"7ac4ad98","prewarm_at":"2024-04-26 02:17:59 UTC","prewarm_count":18} END RequestId: aef5f99f-3eea-4963-bc17-02717248a83f REPORT RequestId: aef5f99f-3eea-4963-bc17-02717248a83f Duration: 9.69 ms Billed Duration: 10 ms Memory Size: 1536 MB Max Memory Used: 405 MB ``` -------------------------------- ### Example Output for Managed Keys Source: https://docs.rubyonjets.com/docs/waf/listing-ips Shows the expected JSON structure returned when querying for managed IP addresses. ```json ❯ aws wafv2 get-rate-based-statement-managed-keys --scope=CLOUDFRONT --region=us-east-1 --web-acl-name=$WEB_ACL_NAME --web-acl-id=$WEB_ACL_ID --rule-name=Jets-BlanketRateLimit { "ManagedKeysIPV4": { "IPAddressVersion": "IPV4", "Addresses": [] }, "ManagedKeysIPV6": { "IPAddressVersion": "IPV6", "Addresses": [] } } ``` -------------------------------- ### Initialize Project Directory Source: https://docs.rubyonjets.com/docs/learn/events/new-project Create a new directory for the project and navigate into it. ```bash mkdir events cd events ``` -------------------------------- ### Setting SSM Variables with Conventional Expansion Source: https://docs.rubyonjets.com/reference/jets-dotenv-set Example showing how variables are expanded based on the project name and environment. ```bash ❯ jets dotenv:set NAME1=value1 NAME2=value2 Will set the SSM vars for demo-dev /demo/dev/NAME1 /demo/dev/NAME2 Are you sure? (y/N) y Setting SSM vars for demo-dev SSM Parameter set: /demo/dev/NAME1 SSM Parameter set: /demo/dev/NAME2 ``` -------------------------------- ### Bundler Git Clone Error Log Source: https://docs.rubyonjets.com/docs/debug/bundle-install-git-clone-error Example output from a failed bundle install process showing a GitCommandError when attempting to access a private repository. ```text #18 [build 6/11] COPY Gemfile Gemfile.lock ./ #18 DONE 0.1s #19 [build 7/11] RUN bundle install #19 1.557 Fetching gem metadata from https://rubygems.org/......... #19 3.259 Fetching https://github.com/org/private-repo.git #19 3.675 #19 3.676 Retrying `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch -- https://***@github.com/org/private-repo.git /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455` due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch -- https://***@github.com/org/private-repo.git /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455` in directory /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455 has failed. #19 3.676 remote: Repository not found. #19 3.676 fatal: repository 'https://github.com/org/private-repo.git/' not found #19 4.001 Retrying `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch -- https://***@github.com/org/private-repo.git /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455` due to error (3/4): Bundler::Source::Git::GitCommandError Git error: command `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch -- https://***@github.com/org/private-repo.git /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455` in directory /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455 has failed. #19 4.001 remote: Repository not found. #19 4.001 fatal: repository 'https://github.com/org/private-repo.git/' not found #19 4.001 #19 4.291 #19 4.294 Retrying `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch -- https://***@github.com/org/private-repo.git /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455` due to error (4/4): Bundler::Source::Git::GitCommandError Git error: command `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch -- https://***@github.com/org/private-repo.git /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455` in directory /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455 has failed. #19 4.294 remote: Repository not found. #19 4.294 fatal: repository 'https://github.com/org/private-repo.git/' not found #19 4.580 #19 4.608 Git error: command `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 #19 4.608 --single-branch -- #19 4.608 https://***@github.com/org/private-repo.git #19 4.608 /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455` #19 4.608 in directory #19 4.608 /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455 #19 4.608 has failed. #19 4.608 remote: Repository not found. #19 4.608 fatal: repository 'https://github.com/org/private-repo.git/' not found #19 ERROR: process "/bin/sh -c bundle install" did not complete successfully: exit code: 11 ``` ```text > [build 7/11] RUN bundle install: 4.580 4.608 Git error: command `git clone --bare --no-hardlinks --quiet --no-tags --depth 1 4.608 --single-branch -- 4.608 https://***@github.com/org/private-repo.git 4.608 /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455` 4.608 in directory 4.608 /usr/local/bundle/ruby/3.2.0/cache/bundler/git/private-repo-50fd126a1e3c214eeae71f252c3bbaa0b96a7455 4.608 has failed. 4.608 remote: Repository not found. 4.608 fatal: repository 'https://github.com/org/private-repo.git/' not found ``` ```dockerfile 41 | RUN gem install bundler --no-document 42 | COPY Gemfile Gemfile.lock ./ 43 | >>> RUN bundle install 44 | 45 | # Copy application code ``` ```text ERROR: failed to solve: process "/bin/sh -c bundle install" did not complete successfully: exit code: 11 bundler: failed to load command: jets-remote (/codebuild/output/src2293197438/src/wrapper/vendor/bundle/ruby/3.2.0/bin/jets-remote) ``` -------------------------------- ### Configure Nodejs for Asset Compilation Source: https://docs.rubyonjets.com/docs/assets/nodejs Enable asset building and Nodejs installation in the deployment configuration. ```ruby Jets.deploy.configure do config.assets.build.enable = true config.assets.build.nodejs.enable = "auto" # config.assets.build.nodejs.version = "20.12.1" # default a stable nodejs version end ``` -------------------------------- ### Start CI run Source: https://docs.rubyonjets.com/docs/ci/getting-started Commands to manually trigger a CI run, optionally specifying a branch. ```bash jets ci:start ``` ```bash jets ci:start --branch feature1 ``` -------------------------------- ### CloudFront Alias Example Source: https://docs.rubyonjets.com/docs/uploads/cloudfront Example of the conventional CloudFront alias generated by Jets. ```text demo-dev-uploads.example.com ``` -------------------------------- ### Initialize WAF Configuration Source: https://docs.rubyonjets.com/reference/jets-waf-init Run this command to create the initial WAF configuration file. ```bash jets waf:init ``` -------------------------------- ### Initialize project with MySQL database Source: https://docs.rubyonjets.com/docs/learn/hanami/new-project Generates a project structure configured for the MySQL adapter. ```bash ❯ hanami new demo Created demo/ -> Within demo/ Created .gitignore Created .env Created README.md Created Gemfile Created Rakefile Created Procfile.dev Created config.ru Created bin/dev Created config/app.rb Created config/settings.rb Created config/routes.rb Created config/puma.rb Created lib/tasks/.keep Created lib/demo/types.rb Created app/actions/.keep Created app/action.rb Created app/view.rb Created app/views/helpers.rb Created app/templates/layouts/app.html.erb Created package.json Created config/assets.js Created app/assets/js/app.js Created app/assets/css/app.css Created app/assets/images/favicon.ico Created public/404.html Created public/500.html Running Bundler install... Running NPM install... Running Hanami install... ❯ mv demo hanami ❯ cd hanami ``` -------------------------------- ### Route53 DNS Alias Mapping Example Source: https://docs.rubyonjets.com/docs/routing/lambda/cloudfront/route53 Shows how multiple domain aliases map to the same CloudFront distribution domain. ```text demo-dev.domain.com => https://d1cfl6s9mcuypm.cloudfront.net name1.domain.com => https://d1cfl6s9mcuypm.cloudfront.net name2.domain.com => https://d1cfl6s9mcuypm.cloudfront.net my.domain.com => https://d1cfl6s9mcuypm.cloudfront.net ``` -------------------------------- ### Example concurrency info output Source: https://docs.rubyonjets.com/reference/jets-concurrency-info Displays the table output showing function-specific reserved concurrency and total account limits. ```text ❯ jets concurrency:info Concurrency for demo-dev +---------------------------+----------+ | Function | Reserved | +---------------------------+----------+ | controller | 25 | | jets-prewarm_event-handle | 2 | | total | 27 | +---------------------------+----------+ Account Limits Concurrent Executions: 1000 Unreserved Concurrent Executions: 730 ``` -------------------------------- ### Initialize Project Directory Source: https://docs.rubyonjets.com/docs/learn/sinatra/new-project Create and enter a new directory for the Sinatra project. ```bash mkdir sinatra cd sinatra ``` -------------------------------- ### Configure DATABASE_URL in .env Source: https://docs.rubyonjets.com/docs/learn/rails/database Example of the conventional SSM mapping syntax within the Jets environment configuration file. ```text # DATABASE_URL=SSM # => SSM:/rails/dev/DATABASE_URL ``` -------------------------------- ### Rails HostAuthorization Error Example Source: https://docs.rubyonjets.com/docs/routing/lambda/cloudfront/host Example of the error log generated by Rails when a host is not authorized. ```text START RequestId: b6614a37-2f42-4cde-87a3-c913a91583a4 Version: $LATEST E, [2024-04-14T03:20:33.825228 #8] ERROR -- : [ActionDispatch::HostAuthorization::DefaultResponseApp] Blocked hosts: demo.dev.boltops.com END RequestId: b6614a37-2f42-4cde-87a3-c913a91583a4 REPORT RequestId: b6614a37-2f42-4cde-87a3-c913a91583a4 Duration: 3.45 ms Billed Duration: 4 ms Memory Size: 1536 MB Max Memory Used: 347 MB ``` -------------------------------- ### Initialize CI settings Source: https://docs.rubyonjets.com/docs/ci/getting-started Run the generator to configure initial CI settings and create necessary configuration files. ```bash jets ci:init ``` -------------------------------- ### Run database migration Source: https://docs.rubyonjets.com/docs/learn/rails/new-project Creates the database and executes pending migrations. ```bash rails db:create db:migrate ``` -------------------------------- ### Legacy Project Name Resolution Example Source: https://docs.rubyonjets.com/docs/env/ssm/legacy Demonstrates how stack names and SSM paths resolve when using a custom project name. ```text stack => demo-v2-dv DATABASE_URL=SSM => /demo/dev/DATABASE_URL ``` -------------------------------- ### Rate Expressions Source: https://docs.rubyonjets.com/docs/events/scheduled Examples of rate-based scheduling expressions. ```text rate(1 minute) rate(5 minutes) rate(1 hour) rate(1 day) ``` -------------------------------- ### Sinatra Application Definition Source: https://docs.rubyonjets.com/docs/config/shim Example of a Sinatra application class. ```ruby class SinatraApp < Sinatra::Base get '/' do "SinatraApp homepage" end end ``` -------------------------------- ### Initialize a Jets project Source: https://docs.rubyonjets.com/docs/learn/events/jets-init Run this command to generate the required configuration files for your project. ```bash jets init ``` -------------------------------- ### Examples Cheatsheet Source: https://docs.rubyonjets.com/reference/jets-curl Common usage patterns for the jets curl command. ```bash jets curl / | jq jets curl /posts | jq jets curl / --cookie cookies.txt | jq jets curl / --cookie "cookie1=value1; cookie2=value2" jets curl / --cookie-jar cookies.txt | jq jets curl / -H Host:example.com jets curl / -X POST -d "foo=bar" jets curl foobar.lambda-url.us-west-2.on.aws/ jets curl / --verbose | jq jets curl / --verbose --trim | jq ``` -------------------------------- ### Configure Rackup File Source: https://docs.rubyonjets.com/docs/learn/rack/new-project Create the config.ru file to load the application and run it with the server. ```ruby require "bundler/setup" require_relative "app" run App ``` -------------------------------- ### Monitor Delete Request Logs Source: https://docs.rubyonjets.com/docs/learn/rails/local-testing Example output when deleting a post. ```text Started DELETE "/posts/3" for 127.0.0.1 at 2023-10-28 14:44:20 +0000 Processing PostsController#destroy Parameters: {"id":"3"} Completed Status Code 200 in 0.015s ``` -------------------------------- ### Jets init command options Source: https://docs.rubyonjets.com/reference/jets-init Available flags for configuring the initialization process, including environment file generation and prompt handling. ```bash [--env], [--no-env], [--skip-env] # Generate config/jets/env/.env example file -f, [--force] # Bypass overwrite are you sure prompt for existing files -y, [--yes], [--no-yes], [--skip-yes] # Skip are you sure prompt ``` -------------------------------- ### Project initialization output Source: https://docs.rubyonjets.com/docs/learn/rails/new-project Shows the file structure created by the rails new command and subsequent directory navigation. ```bash ❯ rails new demo --database mysql create create README.md create Rakefile create .ruby-version create config.ru create .gitignore create .gitattributes create Gemfile run git init from "." create app ... ❯ mv demo rails ❯ cd rails ``` -------------------------------- ### Get Environment Variable Source: https://docs.rubyonjets.com/docs/env/cli Retrieves the value of a specific environment variable. ```bash ❯ jets env:get NAME1 value1 ``` -------------------------------- ### Viewing Deployment Logs Source: https://docs.rubyonjets.com/docs/learn/events/deploy Example output showing the progress of a remote deployment, including CloudFormation stack updates and CodeBuild logs. ```text 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 ``` -------------------------------- ### Perform an in-place deployment Source: https://docs.rubyonjets.com/docs/more/extras/upgrading Standard procedure for updating dependencies and deploying the application in place. ```bash cd demo # your project bundle update jets deploy # in place deploy ``` -------------------------------- ### Initialize and Deploy with Jets Source: https://docs.rubyonjets.com/docs Run these commands in your terminal to initialize the Jets configuration and deploy the application. ```bash jets init jets deploy ``` -------------------------------- ### Cookie Payload Example Source: https://docs.rubyonjets.com/docs/debug/event-payloads Payload structure demonstrating how to include cookies in a request. ```json { "version": "2.0", "routeKey": "$default", "rawPath": "/posts", "rawQueryString": "foo=bar", "cookies": [ "yummy1=value1", "yummy2=value2" ], "headers": { "host": "dummy.lambda-url.us-west-2.on.aws", "x-forwarded-proto": "https", "x-forwarded-port": "443" } } ``` -------------------------------- ### Define Docker Base Image Source: https://docs.rubyonjets.com/docs/config/node-version Example of a Dockerfile base image declaration. ```dockerfile FROM ruby:3.2.3-slim as base ``` -------------------------------- ### jets env:get Source: https://docs.rubyonjets.com/reference/jets-env-get Retrieves environment variables for a specified Lambda function. ```APIDOC ## jets env:get ### Description Get environment variables for a specific Lambda function. ### Usage `jets env:get NAME` ### Options - **-n, [--function=FUNCTION]** - Optional - Lambda Function name (Default: controller) ``` -------------------------------- ### jets concurrency:get Source: https://docs.rubyonjets.com/reference/jets-concurrency-get Retrieves the concurrency settings for a specified Lambda function. ```APIDOC ## jets concurrency:get ### Description Get the concurrency configuration for a specific Lambda function. ### Usage `jets concurrency:get` ### Options - **-n, [--function=FUNCTION]** (string) - Optional - Lambda Function name. Default: controller ``` -------------------------------- ### Generate a new Hanami project Source: https://docs.rubyonjets.com/docs/learn/hanami/new-project Initializes a new project directory with the specified name. ```bash hanami new demo ``` -------------------------------- ### Inferred Shim Configuration Source: https://docs.rubyonjets.com/docs/config/shim Configuration block for an inferred Rack application setup. ```ruby Jets.shim.configure do |config| config.boot_path = "app.rb" config.rack_app = App end ``` -------------------------------- ### Advanced Basic Auth Configuration Examples Source: https://docs.rubyonjets.com/docs/routing/lambda/cloudfront/basic-auth Demonstrates various ways to define credentials, including individual username/password pairs, shared SSM values, and hard-coded credentials. ```ruby Jets.deploy.configure do config.lambda.url.cloudfront.function.basic_auth.enable = true config.lambda.url.cloudfront.function.basic_auth.credentials = "SSM" # /demo/dev/BASIC_AUTH_CREDENTIALS # More examples # Conventional SSM name: one user # config.lambda.url.cloudfront.function.basic_auth.username = "SSM" # /demo/dev/BASIC_AUTH_USERNAME # config.lambda.url.cloudfront.function.basic_auth.password = "SSM" # /demo/dev/BASIC_AUTH_PASSWORD # Override to use a shared values for the dev env # config.lambda.url.cloudfront.function.basic_auth.username = "SSM:/#{ssm_env}/BASIC_AUTH_USERNAME" # config.lambda.url.cloudfront.function.basic_auth.password = "SSM:/#{ssm_env}/BASIC_AUTH_PASSWORD" # Conventional: supports multile users # config.lambda.url.cloudfront.function.basic_auth.credentials = "SSM" # /demo/dev/BASIC_AUTH_CREDENTIALS # Override to use a shared values for the dev credentials # config.lambda.url.cloudfront.function.basic_auth.credentials = "SSM:/#{ssm_env}/BASIC_AUTH_CREDENTIALS" # Hard-coded values also supported. Though not encouraged. # config.lambda.url.cloudfront.function.basic_auth.credentials = ["user:pass", "user2:pass2"] # config.lambda.url.cloudfront.function.basic_auth.credentials = {user: "pass", user2: "pass2"} # config.lambda.url.cloudfront.function.basic_auth.credentials = "user:pass" end ``` -------------------------------- ### Example output of jets delete Source: https://docs.rubyonjets.com/reference/jets-delete Shows the terminal output during the stack deletion process. ```bash $ jets delete Deleting project... Are you sure you want to want to delete the 'demo-dev' project? (y/N) y Emptying s3 bucket demo-dev-s3bucket-89jrrj60c7bj Deleting demo-dev... 05:14:09AM DELETE_IN_PROGRESS AWS::CloudFormation::Stack demo-dev User Initiated ... 05:14:23AM DELETE_IN_PROGRESS AWS::CloudFormation::Stack PostsController 05:15:31AM DELETE_COMPLETE AWS::S3::Bucket S3Bucket Stack demo-dev deleted. Time took for deletion: 1m 27s. Project demo-dev deleted! $ ``` -------------------------------- ### Configure Environment-Specific VPC Source: https://docs.rubyonjets.com/docs/config/vpc Demonstrates using separate configuration files for development and production environments. ```ruby Jets.deploy.configure do config.lambda.function.vpc_config = { SecurityGroupIds: ["sg-dev1"], SubnetIds: ["subnet-dev1", "subnet-dev2"], } end ``` ```ruby Jets.deploy.configure do config.lambda.function.vpc_config = { SecurityGroupIds: ["sg-prod1"], SubnetIds: ["subnet-prod1", "subnet-prod2"], } end ``` -------------------------------- ### Define RAILS_ENV long names Source: https://docs.rubyonjets.com/docs/rails/env-vs Examples of long environment names used by Rails. ```bash RAILS_ENV=development RAILS_ENV=production ``` -------------------------------- ### Monitor Index Request Logs Source: https://docs.rubyonjets.com/docs/learn/rails/local-testing Example output when accessing the index route in a browser. ```text Started GET "/posts" for 127.0.0.1 at 2023-10-28 14:09:35 +0000 Processing PostsController#index Completed Status Code 200 in 0.015s Started GET "/posts" for 127.0.0.1 at 2023-10-28 14:09:36 +0000 ``` -------------------------------- ### jets ci:start Options Source: https://docs.rubyonjets.com/reference/jets-ci-start Available flags for configuring the CI build process, including skipping prompts and overriding build specifications. ```bash -y, [--yes], [--no-yes], [--skip-yes] # Skip are you sure prompt [--buildspec-override=BUILDSPEC_OVERRIDE] # Path to buildspec override file -b, [--branch=BRANCH] # git branch -e, [--env-vars=one two three] # env var overrides. IE: KEY1=VALUE1 KEY2=VALUE2 ``` -------------------------------- ### Direct SSM mapping example Source: https://docs.rubyonjets.com/docs/env/ssm/unique-envs Mapping behavior when SSM unique environments are disabled. ```text JETS_ENV=dev => SSM:/demo/dev/DATABASE_URL JETS_ENV=prod => SSM:/demo/prod/DATABASE_URL JETS_ENV=sbx => SSM:/demo/sbx/DATABASE_URL JETS_ENV=uat => SSM:/demo/uat/DATABASE_URL ``` -------------------------------- ### Autoload convention SSM values Source: https://docs.rubyonjets.com/docs/env/ssm/unique-envs Example SSM values used for autoloading conventions. ```text SSM:/demo/dev/DATABASE_URL SSM:/demo/sbx/DATABASE_URL ``` -------------------------------- ### View Simplified Jets Dockerfile Structure Source: https://docs.rubyonjets.com/docs/docker/dockerfile/managed A multi-stage Dockerfile example demonstrating how Jets separates build dependencies from the final deployment image. ```dockerfile FROM ruby:3.2.3-slim as base # ... FROM base as build RUN apt-get update && apt-get install -y build-essential RUN bundle install # ... FROM base as deployment RUN apt-get update && apt-get install -y curl COPY --from=build /usr/local/bundle /usr/local/bundle # ... ENTRYPOINT [ "aws_lambda_ric" ] CMD [ "handlers/controller.lambda_handler" ] ``` -------------------------------- ### Install Jets Gem Source: https://docs.rubyonjets.com/docs/learn/hanami/jets-init Add the required gem to your Gemfile to enable Jets functionality. ```ruby gem "jets", ">= 6.0" ``` -------------------------------- ### Use CDN Helper in View Source: https://docs.rubyonjets.com/docs/uploads/cloudfront Example of using the image helper within a Rails view. ```erb <%= image_tag(@photo.image.variant(resize_to_limit: [300, 300])) %> ``` -------------------------------- ### Deploying a Jets Project Source: https://docs.rubyonjets.com/docs/learn/events/deploy Initiate the deployment process to AWS Lambda. The command prompts for confirmation before proceeding with the stack update. ```bash ❯ jets deploy ``` ```bash ❯ jets deploy Will deploy events-dev Are you sure? (y/N) y ``` -------------------------------- ### Define JETS_ENV short names Source: https://docs.rubyonjets.com/docs/rails/env-vs Examples of short environment names used by Jets 6 and above. ```bash JETS_ENV=dev JETS_ENV=prod ``` -------------------------------- ### Enable Jets Job Resources Source: https://docs.rubyonjets.com/docs/jobs/enable Configure the deployment settings to create the SQS queue and Lambda worker. ```ruby Jets.deploy.configure do config.job.enable = true end ``` -------------------------------- ### Kinesis Event Payload Structure Source: https://docs.rubyonjets.com/docs/events/kinesis Example of the raw event structure received by the Lambda function. ```json { "Records": [ { "kinesis": { "kinesisSchemaVersion": "1.0", "partitionKey": "1", "sequenceNumber": "49593016666855735301798073856083438124424404568371101698", "data": "aGVsbG8gd29ybGQ=", "approximateArrivalTimestamp": 1550289189.474 }, "eventSource": "aws:kinesis", "eventVersion": "1.0", "eventID": "shardId-000000000000:49593016666855735301798073856083438124424404568371101698", "eventName": "aws:kinesis:record", "invokeIdentityArn": "arn:aws:iam::112233445566:role/demo-dev-DataEvent-OUD26QSQSWKN-DataEventFileIamRole-CM2L7G0KZVY", "awsRegion": "us-west-2", "eventSourceARN": "arn:aws:kinesis:us-west-2:112233445566:stream/my-stream" } ] } ``` -------------------------------- ### jets init Source: https://docs.rubyonjets.com/reference/jets-init Initializes a new Jets project. This command sets up the necessary directory structure and configuration files. ```APIDOC ## jets init ### Description Initializes a new project for Jets. ### Usage `jets init [options]` ### Options - **--env**, **--no-env**, **--skip-env** - Generate config/jets/env/.env example file - **-f**, **--force** - Bypass overwrite prompt for existing files - **-y**, **--yes**, **--no-yes**, **--skip-yes** - Skip confirmation prompt ```