lamby 2.5.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -46
- data/Gemfile.lock +2 -2
- data/Rakefile +9 -1
- data/bin/_test +1 -0
- data/lib/lamby/handler.rb +14 -1
- data/lib/lamby/rack_alb.rb +4 -1
- data/lib/lamby/rack_http.rb +12 -0
- data/lib/lamby/rack_rest.rb +5 -0
- data/lib/lamby/ssm_parameter_store.rb +1 -1
- data/lib/lamby/templates/alb/_deploy +15 -5
- data/lib/lamby/templates/alb/deploy +4 -0
- data/lib/lamby/templates/http/_deploy +14 -4
- data/lib/lamby/templates/http/deploy +4 -0
- data/lib/lamby/templates/rest/_deploy +14 -4
- data/lib/lamby/templates/rest/deploy +4 -0
- data/lib/lamby/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 680b99fd678aef833c4bdca9cee66b2adcb171f8e0ada61fffec9443f6304c21
         | 
| 4 | 
            +
              data.tar.gz: 41664f4e4e02e4ab88112ad6f5f16ec59901cbd7f58639833a322658afec9443
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7705fcb6bf84b50267a0a51008d0003b506198cbfd72c69d7b1114c97780f52f89793374f10d2a36fb0ec7932243e13ba5e8a29b69ab8d8eaa4d9cbb37f16861
         | 
| 7 | 
            +
              data.tar.gz: 73f4038e54a8a5417cef4586c25497dcad49af932b3359ae3827a115b5d018c42f57a7b39ce8ef43d5da1b6be6251f945e6bf5ee72b2c66d67587d0f11f5c36f
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,51 +1,84 @@ | |
| 1 1 | 
             
            <!-- -*- mode: markdown -*- -->
         | 
| 2 | 
            +
             | 
| 2 3 | 
             
            # Keep A Changelog!
         | 
| 3 4 |  | 
| 4 5 | 
             
            See this http://keepachangelog.com link for information on how we want this documented formatted.
         | 
| 5 6 |  | 
| 7 | 
            +
            ## v2.6.1
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            #### Fixed
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - Support redirects with empty response body.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            #### Added
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            - Tests for enabling Rack::Deflate middleware by passing RACK_DEFLATE_ENABLED env variable.
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ## v2.6.0
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            #### Fixed
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            - Support multiple Set-Cookie headers for all rest types.
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ## v2.5.3
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            #### Fixed
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            - Base64 encode response body if the rack response is gzip or brotli compressed.
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            ## v2.5.2
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            - SSM file always overwrites. Fixes #65.
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            ## v2.5.1
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            #### Fixed
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            - Quoting in describe-subnets #62 Thanks @atwoodjw
         | 
| 38 | 
            +
             | 
| 6 39 | 
             
            ## v2.5.0
         | 
| 7 40 |  | 
| 8 41 | 
             
            #### Changed
         | 
| 9 42 |  | 
| 10 | 
            -
             | 
| 43 | 
            +
            - Install files to favor containers.
         | 
| 11 44 |  | 
| 12 45 | 
             
            ## v2.2.2
         | 
| 13 46 |  | 
| 14 47 | 
             
            #### Changed
         | 
| 15 48 |  | 
| 16 | 
            -
             | 
| 49 | 
            +
            - More ActiveSupport removal. Better ENV.to_h.
         | 
| 17 50 |  | 
| 18 51 | 
             
            ## v2.2.1
         | 
| 19 52 |  | 
| 20 53 | 
             
            #### Changed
         | 
| 21 54 |  | 
| 22 | 
            -
             | 
| 55 | 
            +
            - More ActiveSupport removal from SsmParameterStore.
         | 
| 23 56 |  | 
| 24 57 | 
             
            ## v2.2.0
         | 
| 25 58 |  | 
| 26 59 | 
             
            #### Changed
         | 
| 27 60 |  | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 61 | 
            +
            - Remove dependency on `activesupport` for rack-only applications.
         | 
| 62 | 
            +
            - Remove ActiveSupport artifacts:
         | 
| 30 63 | 
             
              - Replace `strip_heredoc` with `<<~HEREDOC`.
         | 
| 31 64 | 
             
              - Remove instances of `Object#try`, replace with `&.`.
         | 
| 32 65 | 
             
              - Use `Rack::Utils.build_nested_query` in place of `Object#to_query`.
         | 
| 33 66 | 
             
              - Replace `Object#present?` with `to_s.empty?`.
         | 
| 34 67 | 
             
              - Replace `Array.wrap` with `Array[obj].compact.flatten`.
         | 
| 35 | 
            -
             | 
| 68 | 
            +
            - Add a check against the `RAILS_ENV` AND `RACK_ENV` environment
         | 
| 36 69 | 
             
              variables prior to enabling debug mode.
         | 
| 37 70 |  | 
| 38 71 | 
             
            ## v2.1.0
         | 
| 39 72 |  | 
| 40 73 | 
             
            #### Changed
         | 
| 41 74 |  | 
| 42 | 
            -
             | 
| 75 | 
            +
            - Only load the railtie if `Rails` is defined.
         | 
| 43 76 |  | 
| 44 77 | 
             
            ## v2.0.1
         | 
| 45 78 |  | 
| 46 79 | 
             
            #### Changed
         | 
| 47 80 |  | 
| 48 | 
            -
             | 
| 81 | 
            +
            - Remove Rails runtime dep. Only rack is needed.
         | 
| 49 82 |  | 
| 50 83 | 
             
            ## v2.0.0
         | 
| 51 84 |  | 
| @@ -53,120 +86,107 @@ Support for new API Gateway HTTP APIs!!! | |
| 53 86 |  | 
| 54 87 | 
             
            #### Changed
         | 
| 55 88 |  | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 89 | 
            +
            - The `Lamby.handler` must have a `:rack` option. One of `:http`, `:rest`, `:alb`.
         | 
| 90 | 
            +
            - Renamed template generators to match options above.
         | 
| 91 | 
            +
            - The `lamby:install` task now defaults to HTTP API.
         | 
| 92 | 
            +
            - Changed the name of `:api` rack option to `:rest`.
         | 
| 93 | 
            +
            - Removed `export` from Dotenv files. Better Docker compatability.
         | 
| 61 94 |  | 
| 62 95 | 
             
            #### Added
         | 
| 63 96 |  | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 97 | 
            +
            - New rack handler for HTTP API v1 and v2.
         | 
| 98 | 
            +
            - Lots of backfill tests for, ALBs & REST APIs.
         | 
| 67 99 |  | 
| 68 100 | 
             
            ## v1.0.3
         | 
| 69 101 |  | 
| 70 102 | 
             
            #### Changed
         | 
| 71 103 |  | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 104 | 
            +
            - Change shebangs to `#!/usr/bin/env bash`
         | 
| 74 105 |  | 
| 75 106 | 
             
            ## v1.0.2
         | 
| 76 107 |  | 
| 77 108 | 
             
            #### Changed
         | 
| 78 109 |  | 
| 79 | 
            -
             | 
| 110 | 
            +
            - Adds an optional 'overwrite' parameter to #to_env.
         | 
| 80 111 |  | 
| 81 112 | 
             
            ## v1.0.1
         | 
| 82 113 |  | 
| 83 114 | 
             
            #### Changed
         | 
| 84 115 |  | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 116 | 
            +
            - Links in bin/build templates to point to lamby.custominktech.com site.
         | 
| 87 117 |  | 
| 88 118 | 
             
            ## v1.0.0
         | 
| 89 119 |  | 
| 90 120 | 
             
            #### Fixed
         | 
| 91 121 |  | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 122 | 
            +
            - ALB query params & binary responses. Fixes #38.
         | 
| 94 123 |  | 
| 95 124 | 
             
            ## v0.6.0
         | 
| 96 125 |  | 
| 97 126 | 
             
            #### Added
         | 
| 98 127 |  | 
| 99 | 
            -
             | 
| 128 | 
            +
            - APPLICATION LOAD BALANACER SUPPORT!!! The new default. Use `rack: :api` option to handler for API Gateway support.
         | 
| 100 129 |  | 
| 101 130 | 
             
            #### Changed
         | 
| 102 131 |  | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 132 | 
            +
            - Rake task `lamby:install` now defaults to `application_load_balancer`
         | 
| 105 133 |  | 
| 106 134 | 
             
            ## v0.5.1
         | 
| 107 135 |  | 
| 108 136 | 
             
            #### Fixed
         | 
| 109 137 |  | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 138 | 
            +
            - The .gitignore file template. Fix .aws-sam dir.
         | 
| 112 139 |  | 
| 113 140 | 
             
            ## v0.5.0
         | 
| 114 141 |  | 
| 115 142 | 
             
            #### Added
         | 
| 116 143 |  | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 144 | 
            +
            - Template generators for first install. Ex: `./bin/rake -r lamby lamby:install:api_gateway`.
         | 
| 145 | 
            +
            - New `Lamby::SsmParameterStore.get!` helper.
         | 
| 120 146 |  | 
| 121 147 | 
             
            ## v0.4.1
         | 
| 122 148 |  | 
| 123 149 | 
             
            #### Fixed
         | 
| 124 150 |  | 
| 125 | 
            -
             | 
| 126 | 
            -
             | 
| 151 | 
            +
            - Fix type in v0.4.0 fix below.
         | 
| 127 152 |  | 
| 128 153 | 
             
            ## v0.4.0
         | 
| 129 154 |  | 
| 130 155 | 
             
            #### Fixed
         | 
| 131 156 |  | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 157 | 
            +
            - File uploads in #33 using `CONTENT_TYPE` and `CONTENT_LENGTH`.
         | 
| 134 158 |  | 
| 135 159 | 
             
            ## v0.3.2
         | 
| 136 160 |  | 
| 137 161 | 
             
            #### Added
         | 
| 138 162 |  | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 163 | 
            +
            - Pass Request ID for CloudWatch logs. Fixes #30.
         | 
| 141 164 |  | 
| 142 165 | 
             
            ## v0.3.1
         | 
| 143 166 |  | 
| 144 167 | 
             
            #### Changed
         | 
| 145 168 |  | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 169 | 
            +
            - Docs and SAM template tweaks.
         | 
| 148 170 |  | 
| 149 171 | 
             
            ## v0.3.0
         | 
| 150 172 |  | 
| 151 173 | 
             
            #### Added
         | 
| 152 174 |  | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 175 | 
            +
            - Secure configs rake task.
         | 
| 176 | 
            +
            - Project bin setup and tests.
         | 
| 155 177 |  | 
| 156 178 | 
             
            #### Changed
         | 
| 157 179 |  | 
| 158 | 
            -
             | 
| 159 | 
            -
             | 
| 180 | 
            +
            - SAM template tweaks.
         | 
| 160 181 |  | 
| 161 182 | 
             
            ## v0.2.0
         | 
| 162 183 |  | 
| 163 184 | 
             
            #### Changed
         | 
| 164 185 |  | 
| 165 | 
            -
             | 
| 166 | 
            -
             | 
| 186 | 
            +
            - Simple docs and project re-organization.
         | 
| 167 187 |  | 
| 168 188 | 
             
            ## v0.1.0
         | 
| 169 189 |  | 
| 170 190 | 
             
            #### Added
         | 
| 171 191 |  | 
| 172 | 
            -
             | 
| 192 | 
            +
            - New gem and placeholder in rubygems.
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | @@ -10,4 +10,12 @@ Rake::TestTask.new(:test) do |t| | |
| 10 10 | 
             
              t.warning = false
         | 
| 11 11 | 
             
            end
         | 
| 12 12 |  | 
| 13 | 
            -
             | 
| 13 | 
            +
            Rake::TestTask.new(:test_deflate) do |t|
         | 
| 14 | 
            +
              t.libs << "test"
         | 
| 15 | 
            +
              t.libs << "lib"
         | 
| 16 | 
            +
              t.test_files = FileList["test/rack_deflate_test.rb"]
         | 
| 17 | 
            +
              t.verbose = false
         | 
| 18 | 
            +
              t.warning = false
         | 
| 19 | 
            +
            end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            task :default => [:test, :test_deflate]
         | 
    
        data/bin/_test
    CHANGED
    
    
    
        data/lib/lamby/handler.rb
    CHANGED
    
    | @@ -31,15 +31,23 @@ module Lamby | |
| 31 31 | 
             
                  @headers
         | 
| 32 32 | 
             
                end
         | 
| 33 33 |  | 
| 34 | 
            +
                def set_cookies
         | 
| 35 | 
            +
                  return @set_cookies if defined?(@set_cookies)
         | 
| 36 | 
            +
                  @set_cookies = if @headers && @headers['Set-Cookie']
         | 
| 37 | 
            +
                    @headers.delete('Set-Cookie').split("\n")
         | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 34 41 | 
             
                def body
         | 
| 35 42 | 
             
                  @rbody ||= ''.tap do |rbody|
         | 
| 36 | 
            -
                    @body.each { |part| rbody << part }
         | 
| 43 | 
            +
                    @body.each { |part| rbody << part if part }
         | 
| 37 44 | 
             
                  end
         | 
| 38 45 | 
             
                end
         | 
| 39 46 |  | 
| 40 47 | 
             
                def call
         | 
| 41 48 | 
             
                  return self if @called
         | 
| 42 49 | 
             
                  @status, @headers, @body = call_app
         | 
| 50 | 
            +
                  set_cookies
         | 
| 43 51 | 
             
                  @called = true
         | 
| 44 52 | 
             
                  self
         | 
| 45 53 | 
             
                end
         | 
| @@ -47,6 +55,7 @@ module Lamby | |
| 47 55 | 
             
                def base64_encodeable?
         | 
| 48 56 | 
             
                  @headers && (
         | 
| 49 57 | 
             
                    @headers['Content-Transfer-Encoding'] == 'binary' ||
         | 
| 58 | 
            +
                    content_encoding_compressed? ||
         | 
| 50 59 | 
             
                    @headers['X-Lamby-Base64'] == '1'
         | 
| 51 60 | 
             
                  )
         | 
| 52 61 | 
             
                end
         | 
| @@ -80,5 +89,9 @@ module Lamby | |
| 80 89 | 
             
                  end
         | 
| 81 90 | 
             
                end
         | 
| 82 91 |  | 
| 92 | 
            +
                def content_encoding_compressed?
         | 
| 93 | 
            +
                  content_encoding_header = @headers['Content-Encoding'] || ''
         | 
| 94 | 
            +
                  content_encoding_header.split(', ').any? { |h| ['br', 'gzip'].include?(h) }
         | 
| 95 | 
            +
                end
         | 
| 83 96 | 
             
              end
         | 
| 84 97 | 
             
            end
         | 
    
        data/lib/lamby/rack_alb.rb
    CHANGED
    
    | @@ -11,7 +11,10 @@ module Lamby | |
| 11 11 |  | 
| 12 12 | 
             
                def response(handler)
         | 
| 13 13 | 
             
                  hhdrs = handler.headers
         | 
| 14 | 
            -
                   | 
| 14 | 
            +
                  if multi_value?
         | 
| 15 | 
            +
                    multivalue_headers = hhdrs.transform_values { |v| Array[v].compact.flatten }
         | 
| 16 | 
            +
                    multivalue_headers['Set-Cookie'] = handler.set_cookies if handler.set_cookies
         | 
| 17 | 
            +
                  end
         | 
| 15 18 | 
             
                  status_description = "#{handler.status} #{::Rack::Utils::HTTP_STATUS_CODES[handler.status]}"
         | 
| 16 19 | 
             
                  base64_encode = hhdrs['Content-Transfer-Encoding'] == 'binary' || hhdrs['X-Lamby-Base64'] == '1'
         | 
| 17 20 | 
             
                  body = Base64.strict_encode64(handler.body) if base64_encode
         | 
    
        data/lib/lamby/rack_http.rb
    CHANGED
    
    | @@ -6,6 +6,15 @@ module Lamby | |
| 6 6 | 
             
                    { isBase64Encoded: true, body: handler.body64 }
         | 
| 7 7 | 
             
                  else
         | 
| 8 8 | 
             
                    super
         | 
| 9 | 
            +
                  end.tap do |r|
         | 
| 10 | 
            +
                    if cookies = handler.set_cookies
         | 
| 11 | 
            +
                      if payload_version_one?
         | 
| 12 | 
            +
                        r[:multiValueHeaders] ||= {}
         | 
| 13 | 
            +
                        r[:multiValueHeaders]['Set-Cookie'] = cookies
         | 
| 14 | 
            +
                      else
         | 
| 15 | 
            +
                        r[:cookies] = cookies
         | 
| 16 | 
            +
                      end
         | 
| 17 | 
            +
                    end
         | 
| 9 18 | 
             
                  end
         | 
| 10 19 | 
             
                end
         | 
| 11 20 |  | 
| @@ -79,6 +88,9 @@ module Lamby | |
| 79 88 | 
             
                    'HTTP/1.1'
         | 
| 80 89 | 
             
                end
         | 
| 81 90 |  | 
| 91 | 
            +
                def payload_version_one?
         | 
| 92 | 
            +
                  event['version'] == '1.0'
         | 
| 93 | 
            +
                end
         | 
| 82 94 |  | 
| 83 95 | 
             
              end
         | 
| 84 96 | 
             
            end
         | 
    
        data/lib/lamby/rack_rest.rb
    CHANGED
    
    
| @@ -1,14 +1,24 @@ | |
| 1 1 | 
             
            #!/usr/bin/env bash
         | 
| 2 2 | 
             
            set -e
         | 
| 3 3 |  | 
| 4 | 
            +
            export DEPLOYMENT_NAME="myorg/APPNAMEHERE"
         | 
| 4 5 | 
             
            export RAILS_ENV=${RAILS_ENV:="production"}
         | 
| 5 6 | 
             
            export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:=us-east-1}
         | 
| 6 | 
            -
            export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.$ | 
| 7 | 
            +
            export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.${DEPLOYMENT_NAME/\//-}"}
         | 
| 7 8 |  | 
| 8 9 | 
             
            # https://github.com/aws/aws-sam-cli/issues/2447
         | 
| 9 10 | 
             
            export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
         | 
| 10 | 
            -
            export IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com | 
| 11 | 
            +
            export IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/${DEPLOYMENT_NAME}"
         | 
| 11 12 |  | 
| 13 | 
            +
            echo '== Creating ECR repository =='
         | 
| 14 | 
            +
            echo 'You can safely ignore any RepositoryAlreadyExistsException errors...'
         | 
| 15 | 
            +
            aws ecr create-repository \
         | 
| 16 | 
            +
              --repository-name "$DEPLOYMENT_NAME" \
         | 
| 17 | 
            +
              --image-tag-mutability MUTABLE \
         | 
| 18 | 
            +
              --image-scanning-configuration scanOnPush=true \
         | 
| 19 | 
            +
              --region "$AWS_DEFAULT_REGION" || true
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            # Build our application code into a deployment folder
         | 
| 12 22 | 
             
            ./bin/_build
         | 
| 13 23 |  | 
| 14 24 | 
             
            export VPCID=${VPCID:=$(
         | 
| @@ -21,7 +31,7 @@ export VPCID=${VPCID:=$( | |
| 21 31 | 
             
            export SUBNETS=${SUBNETS:=$(
         | 
| 22 32 | 
             
              aws ec2 describe-subnets \
         | 
| 23 33 | 
             
                --output text \
         | 
| 24 | 
            -
                --filters  | 
| 34 | 
            +
                --filters 'Name=state,Values=available' "Name=vpc-id,Values=$VPCID" \
         | 
| 25 35 | 
             
                --query 'Subnets[*].SubnetId' | \
         | 
| 26 36 | 
             
                tr -s '[:blank:]' ','
         | 
| 27 37 | 
             
            )}
         | 
| @@ -37,13 +47,13 @@ sam package \ | |
| 37 47 | 
             
              --output-template-file ./.aws-sam/build/packaged.yaml \
         | 
| 38 48 | 
             
              --image-repository "$IMAGE_REPOSITORY" \
         | 
| 39 49 | 
             
              --s3-bucket "${CLOUDFORMATION_BUCKET}" \
         | 
| 40 | 
            -
              --s3-prefix " | 
| 50 | 
            +
              --s3-prefix "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}"
         | 
| 41 51 |  | 
| 42 52 | 
             
            echo "== SAM deploy..."
         | 
| 43 53 | 
             
            sam deploy \
         | 
| 44 54 | 
             
              --region "$AWS_DEFAULT_REGION" \
         | 
| 45 55 | 
             
              --template-file ./.aws-sam/build/packaged.yaml \
         | 
| 46 | 
            -
              --stack-name " | 
| 56 | 
            +
              --stack-name "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}" \
         | 
| 47 57 | 
             
              --image-repository "$IMAGE_REPOSITORY" \
         | 
| 48 58 | 
             
              --capabilities "CAPABILITY_IAM" \
         | 
| 49 59 | 
             
              --parameter-overrides \
         | 
| @@ -1,14 +1,24 @@ | |
| 1 1 | 
             
            #!/usr/bin/env bash
         | 
| 2 2 | 
             
            set -e
         | 
| 3 3 |  | 
| 4 | 
            +
            export DEPLOYMENT_NAME="myorg/APPNAMEHERE"
         | 
| 4 5 | 
             
            export RAILS_ENV=${RAILS_ENV:="production"}
         | 
| 5 6 | 
             
            export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:=us-east-1}
         | 
| 6 | 
            -
            export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.$ | 
| 7 | 
            +
            export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.${DEPLOYMENT_NAME/\//-}"}
         | 
| 7 8 |  | 
| 8 9 | 
             
            # https://github.com/aws/aws-sam-cli/issues/2447
         | 
| 9 10 | 
             
            export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
         | 
| 10 | 
            -
            export IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com | 
| 11 | 
            +
            export IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/${DEPLOYMENT_NAME}"
         | 
| 11 12 |  | 
| 13 | 
            +
            echo '== Creating ECR repository =='
         | 
| 14 | 
            +
            echo 'You can safely ignore any RepositoryAlreadyExistsException errors...'
         | 
| 15 | 
            +
            aws ecr create-repository \
         | 
| 16 | 
            +
              --repository-name "$DEPLOYMENT_NAME" \
         | 
| 17 | 
            +
              --image-tag-mutability MUTABLE \
         | 
| 18 | 
            +
              --image-scanning-configuration scanOnPush=true \
         | 
| 19 | 
            +
              --region "$AWS_DEFAULT_REGION" || true
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            # Build our application code into a deployment folder
         | 
| 12 22 | 
             
            ./bin/_build
         | 
| 13 23 |  | 
| 14 24 | 
             
            sam build \
         | 
| @@ -22,13 +32,13 @@ sam package \ | |
| 22 32 | 
             
              --output-template-file ./.aws-sam/build/packaged.yaml \
         | 
| 23 33 | 
             
              --image-repository "$IMAGE_REPOSITORY" \
         | 
| 24 34 | 
             
              --s3-bucket "${CLOUDFORMATION_BUCKET}" \
         | 
| 25 | 
            -
              --s3-prefix " | 
| 35 | 
            +
              --s3-prefix "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}"
         | 
| 26 36 |  | 
| 27 37 | 
             
            echo "== SAM deploy..."
         | 
| 28 38 | 
             
            sam deploy \
         | 
| 29 39 | 
             
              --region "$AWS_DEFAULT_REGION" \
         | 
| 30 40 | 
             
              --template-file ./.aws-sam/build/packaged.yaml \
         | 
| 31 | 
            -
              --stack-name " | 
| 41 | 
            +
              --stack-name "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}" \
         | 
| 32 42 | 
             
              --image-repository "$IMAGE_REPOSITORY" \
         | 
| 33 43 | 
             
              --capabilities "CAPABILITY_IAM" \
         | 
| 34 44 | 
             
              --parameter-overrides \
         | 
| @@ -1,14 +1,24 @@ | |
| 1 1 | 
             
            #!/usr/bin/env bash
         | 
| 2 2 | 
             
            set -e
         | 
| 3 3 |  | 
| 4 | 
            +
            export DEPLOYMENT_NAME="myorg/APPNAMEHERE"
         | 
| 4 5 | 
             
            export RAILS_ENV=${RAILS_ENV:="production"}
         | 
| 5 6 | 
             
            export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:=us-east-1}
         | 
| 6 | 
            -
            export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.$ | 
| 7 | 
            +
            export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.${DEPLOYMENT_NAME/\//-}"}
         | 
| 7 8 |  | 
| 8 9 | 
             
            # https://github.com/aws/aws-sam-cli/issues/2447
         | 
| 9 10 | 
             
            export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
         | 
| 10 | 
            -
            export IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com | 
| 11 | 
            +
            export IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/${DEPLOYMENT_NAME}"
         | 
| 11 12 |  | 
| 13 | 
            +
            echo '== Creating ECR repository =='
         | 
| 14 | 
            +
            echo 'You can safely ignore any RepositoryAlreadyExistsException errors...'
         | 
| 15 | 
            +
            aws ecr create-repository \
         | 
| 16 | 
            +
              --repository-name "$DEPLOYMENT_NAME" \
         | 
| 17 | 
            +
              --image-tag-mutability MUTABLE \
         | 
| 18 | 
            +
              --image-scanning-configuration scanOnPush=true \
         | 
| 19 | 
            +
              --region "$AWS_DEFAULT_REGION" || true
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            # Build our application code into a deployment folder
         | 
| 12 22 | 
             
            ./bin/_build
         | 
| 13 23 |  | 
| 14 24 | 
             
            sam build \
         | 
| @@ -22,13 +32,13 @@ sam package \ | |
| 22 32 | 
             
              --output-template-file ./.aws-sam/build/packaged.yaml \
         | 
| 23 33 | 
             
              --image-repository "$IMAGE_REPOSITORY" \
         | 
| 24 34 | 
             
              --s3-bucket "${CLOUDFORMATION_BUCKET}" \
         | 
| 25 | 
            -
              --s3-prefix " | 
| 35 | 
            +
              --s3-prefix "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}"
         | 
| 26 36 |  | 
| 27 37 | 
             
            echo "== SAM deploy..."
         | 
| 28 38 | 
             
            sam deploy \
         | 
| 29 39 | 
             
              --region "$AWS_DEFAULT_REGION" \
         | 
| 30 40 | 
             
              --template-file ./.aws-sam/build/packaged.yaml \
         | 
| 31 | 
            -
              --stack-name " | 
| 41 | 
            +
              --stack-name "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}" \
         | 
| 32 42 | 
             
              --image-repository "$IMAGE_REPOSITORY" \
         | 
| 33 43 | 
             
              --capabilities "CAPABILITY_IAM" \
         | 
| 34 44 | 
             
              --parameter-overrides \
         | 
    
        data/lib/lamby/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: lamby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.6.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ken Collins
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-03-16 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rack
         |