AWS 503服务暂时不可用

时间:2018-03-10 07:51:37

标签: node.js amazon-web-services http-status-code-503

我的前端连接到我的服务器哪个主机在AWS中,从昨天起我得到503 Service Temporarily Unavailable错误。

在Chrome控制台中,我有2个错误:

1:

http://myServerendpoint.com/getData 503 (Service Temporarily Unavailable)

2:

Failed to load http://myServerendpoint.com/getData : No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://myFrontEndPoint.com' is therefore not allowed access. The response had HTTP status code 503.

我已经将cors应用到服务器(它的nodejs):

app.use(cors({
   allowedOrigin: ["*"],
   credentials: true
}))

直到昨天才开始工作。但从昨天开始我不断得到这个错误并且没有任何线索。在aws日志中我得到了这个:

container_linux.go:247: starting container process caused “exec: \“/usr/bin/node\“: stat /usr/bin/node: no such file or directory”

知道出了什么问题吗?

更新:

路径错误我将其更改为更正/ usr / bin / node但现在我获得了权限被拒绝错误:

container_linux.go:247: starting container process caused "exec: \"/usr/bin/node\": permission denied"

我的码头文件:

FROM node:6-onbuild

RUN apt-get update && \
  apt-get -y install sudo

RUN mkdir -p /usr/bin/node
RUN chmod -R +x /usr/bin/node
RUN sudo chown -R $USER: /usr/bin/node
WORKDIR /usr/bin/node

COPY package.json /usr/bin/node
RUN npm install
COPY . /usr/bin/node

ENV PORT 80
EXPOSE ${PORT}

CMD [ "npm","run", "start" ]

新更新:

即使在使用buildkite构建之后,duckerfile配置运行良好:

Removing intermediate container eac44b8f2a3f
Step 3/12 : RUN mkdir -p /usr/bin/node
 ---> Running in 9ac2ac7f960e
 ---> 970134252f9d
Removing intermediate container 9ac2ac7f960e
Step 4/12 : RUN chmod -R +x /usr/bin/node
 ---> Running in 8c54b0e3d813
 ---> 5ca0fe8180f6
Removing intermediate container 8c54b0e3d813
...
...
...
Successfully built 7f189f7e38cc
Successfully tagged 239820024964.dkr.ecr.ap......

所以问题不是在构建之前,它在构建之后,当我们发送http请求时,我们得到了此权限被拒绝!

1 个答案:

答案 0 :(得分:0)

我们发现问题,如果有人需要,在我的情况下,我们的ecs任务EntryPoint有一个不同的节点路径,太多我们的docker节点路径位于:/ usr / local / bin / node但我们的ecs任务entrypoint设置为/ usr / bin / node