Skip to content

Commit

Permalink
Improve elasticbeanstalk debugging
Browse files Browse the repository at this point in the history
Don't print a line for every file, which may blow out if a node_modules
or similar is included.

Add logging around zip file size.

Add logging around S3 upload / EB version registration
  • Loading branch information
alexjurkiewicz committed Mar 4, 2020
1 parent 6cf0f29 commit 1fd7e42
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/dpl/providers/elasticbeanstalk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,29 @@ def zip_exists?

def create_zip
::Zip::File.open(zip_file, ::Zip::File::CREATE) do |zip|
n_files = 0
files.each do |path|
debug :zip_add, path
n_files++
zip.add(path.sub(cwd, ''), path)
end
debug "Zip contains #{n_files} files"
size = File.size(zip_file)
warn "Zip file is empty." if size == 0
# https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-versions.html
warn "Zip file may be too large." if size > 524288000
debug "Zip file size: #{size.to_f / 2**10}kb"
end
end

def upload
debug "upload zipfile:#{zip_file} bucket path: #{bucket_path}"
@object = bucket.object(bucket_path)
object.put(body: File.open(zip_file))
sleep 5 # s3 eventual consistency
end

def create_version
debug "create_version app:#{app}, label:#{label}, bucket:#{bucket.name}, key:#{object.key}"
@version = eb.create_application_version(
application_name: app,
version_label: label,
Expand Down

0 comments on commit 1fd7e42

Please sign in to comment.