...
 
Commits (2)
......@@ -5,7 +5,9 @@ LABEL maintainer="valery.tschopp@switch.ch"
RUN gem install sinatra shotgun haml aws-sdk
RUN mkdir /app
COPY s3uploader.rb /app/
COPY /views /app/
COPY /public /app/
COPY /s3uploader.rb /app/
EXPOSE 8080
ENTRYPOINT ["shotgun", "--host", "0.0.0.0", "--port", "8080", "/app/s3uploader.rb"]
......@@ -4,22 +4,17 @@ require 'aws-sdk'
S3_BUCKET_NAME = ENV['S3_BUCKET_NAME']
S3_ENDPOINT = ENV['S3_ENDPOINT']
# DEBUG
#XXX
AWS_ACCESS_KEY_ID = ENV['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = ENV['AWS_SECRET_ACCESS_KEY']
puts "S3_BUCKET_NAME: #{S3_BUCKET_NAME}"
puts "S3_ENDPOINT: #{S3_ENDPOINT}"
puts "AWS_ACCESS_KEY_ID: #{AWS_ACCESS_KEY_ID}"
puts "AWS_SECRET_ACCESS_KEY: #{AWS_SECRET_ACCESS_KEY}"
# try logger
logger.info "S3_BUCKET_NAME: #{S3_BUCKET_NAME}"
logger.info "S3_ENDPOINT: #{S3_ENDPOINT}"
s3 = Aws::S3::Client.new(region: 'us-east-1', endpoint: S3_ENDPOINT, force_path_style: true, ssl_verify_peer: false)
s3 = Aws::S3::Client.new(region: 'us-east-1', endpoint: S3_ENDPOINT, force_path_style: true, ssl_verify_peer: true)
signer = Aws::S3::Presigner.new({client: s3})
get "/" do
#XXX: try logger
logger.info "S3_BUCKET_NAME: #{S3_BUCKET_NAME}"
logger.info "S3_ENDPOINT: #{S3_ENDPOINT}"
if is_s3_connection_working(s3)
haml :index
else
......