代码之家  ›  专栏  ›  技术社区  ›  Emad Dehnavi

AWS 503服务暂时不可用

  •  0
  • Emad Dehnavi  · 技术社区  · 7 年前

    我的前端连接到我的服务器,其中主机在AWS,从昨天起我得到503服务暂时不可用的错误。

    在chrome控制台中,我有两个错误:

    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"
    

    我的docker文件:

    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 回复  |  直到 7 年前
        1
  •  0
  •   Emad Dehnavi    7 年前

    我们发现了问题,以防有人需要,在我的情况下,我们的ecs任务入口点的节点路径不同,基本上我们的docker节点路径位于:/usr/local/bin/node,但我们的ecs任务入口点设置为/usr/bin/node