Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services AWS Beanstalk上带有docker和SQS的Sinatra应用程序_Amazon Web Services_Sinatra_Docker_Amazon Sqs - Fatal编程技术网

Amazon web services AWS Beanstalk上带有docker和SQS的Sinatra应用程序

Amazon web services AWS Beanstalk上带有docker和SQS的Sinatra应用程序,amazon-web-services,sinatra,docker,amazon-sqs,Amazon Web Services,Sinatra,Docker,Amazon Sqs,我已经构建了一个简单的sinatra应用程序,用于侦听本地主机上的POST请求(接收来自AWS SQS的消息),并配置了dockerfile,以便于部署 西纳特拉: set :environment, 'staging' set :bind, 'localhost' set :port, '80' before do request.body.rewind @request_payload = JSON.parse request.body.read end post '/' do

我已经构建了一个简单的sinatra应用程序,用于侦听本地主机上的POST请求(接收来自AWS SQS的消息),并配置了dockerfile,以便于部署

西纳特拉:

set :environment, 'staging'
set :bind, 'localhost'
set :port, '80'

before do
  request.body.rewind
  @request_payload = JSON.parse request.body.read
end

post '/' do
  # do stuff with payload
end
Dockerfile:

#https://dockerfile.github.io/#/ruby
FROM dockerfile/ruby

# Install dependencies
RUN apt-get update
RUN apt-get install postgresql-common postgresql-9.3 libpq-dev -y

# Copy the Gemfile and Gemfile.lock into the image to cache bundle install
# Temporarily set the working directory to where they are
WORKDIR /tmp 
ADD ./Gemfile Gemfile
ADD ./Gemfile.lock Gemfile.lock
RUN bundle install 

# Copy code into the image
ADD . /code
WORKDIR /code

# Open port 80
EXPOSE 80

# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Default runtime command
CMD /code/launcher.rb
但我在日志文件中发现了以下错误:

-------------------------------------
/var/log/nginx/error.log
-------------------------------------
2014/07/11 20:54:33 [error] 9023#0: *11 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: , request: "POST / HTTP/1.1", upstream: "http://127.0.0.1:12569/", host: "localhost"

-------------------------------------
/var/log/docker
-------------------------------------
2014/07/11 20:54:33 Can't forward traffic to backend tcp/172.17.0.8:80: dial tcp 172.17.0.8:80: connection refused

-------------------------------------
/var/log/aws-sqsd/default.log
-------------------------------------
2014-07-11T21:19:35Z http-err: d35bffd4-5c0b-4979-b046-5b42c7a990c0 (6) 502 - 0.023

-------------------------------------
/var/log/nginx/access.log
-------------------------------------
127.0.0.1 - - [11/Jul/2014:21:19:35 +0000] "POST / HTTP/1.1" 502 172 "-" "aws-sqsd/1.1"

-------------------------------------
/var/log/docker-ps.log
-------------------------------------
'docker ps' ran at Fri Jul 11 21:11:52 UTC 2014: 
CONTAINER ID        IMAGE                              COMMAND                CREATED              STATUS              PORTS                     NAMES
f3d8a8a3ffb6        aws_beanstalk/current-app:latest   /bin/sh -c /code/bui   About a minute ago   Up About a minute   0.0.0.0:12529->80/tcp   backstabbing_pare   

有什么想法吗?我想这和港口有关。我与其他人尝试过,但没有成功…

冲突的原因是
set:bind,'localhost'
指令。 由于POST请求来自docker容器外部,sinatra拒绝了连接