Node.js AWS Elastic Beanstalk上的Socket.io服务器未运行
我对AWS生态系统完全陌生。我有一个NodeJS项目,只有socket.io服务器(没有express)。我正在尝试将它部署到Elastic Beanstalk上,因为有人提到它可以为我们处理所有设置 我还看到过一些文章,其中提到需要在根文件夹中有一个.ebextensions文件夹,并使用container_命令来更改代理头,如下所示Node.js AWS Elastic Beanstalk上的Socket.io服务器未运行,node.js,amazon-web-services,websocket,socket.io,amazon-elastic-beanstalk,Node.js,Amazon Web Services,Websocket,Socket.io,Amazon Elastic Beanstalk,我对AWS生态系统完全陌生。我有一个NodeJS项目,只有socket.io服务器(没有express)。我正在尝试将它部署到Elastic Beanstalk上,因为有人提到它可以为我们处理所有设置 我还看到过一些文章,其中提到需要在根文件夹中有一个.ebextensions文件夹,并使用container_命令来更改代理头,如下所示 container_commands: enable_websockets: command: | sed -i '/\s*proxy_
container_commands:
enable_websockets:
command: |
sed -i '/\s*proxy_set_header\s*Connection/c \
proxy_set_header Upgrade $http_upgrade;\
proxy_set_header Connection "upgrade";\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
但是我在.ebextensions中添加了上述文件&然后创建了一个基本的Elastic Beanstalk应用程序,然后它就不工作了:
步骤:
Application deployment failed at 2020-09-20T07:17:01Z with exit status 1 and error: Engine execution has encountered an error.
当我下载所有日志时,我会看到以下内容
在cfn-init-cmd.log中
Command enable_websockets
sed: can't read /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf: No such file or directory
Exited with error code 2
在cfn-init.log中
2020-09-20 07:17:01,716 [ERROR] Command enable_websockets (sed -i '/\s*proxy_set_header\s*Connection/c \
proxy_set_header Upgrade $http_upgrade;\
proxy_set_header Connection "upgrade";\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf) failed
2020-09-20 07:17:01,717 [ERROR] Error encountered during build of postbuild_0_my_app: Command enable_websockets failed
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
changes['commands'] = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command enable_websockets failed
2020-09-20 07:17:01,719 [ERROR] -----------------------BUILD FAILED!------------------------
2020-09-20 07:17:01,719 [ERROR] Unhandled exception during build: Command enable_websockets failed
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 171, in <module>
worklog.build(metadata, configSets)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
Contractor(metadata).build(configSets, self)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
self.run_config(config, worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
changes['commands'] = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command enable_websockets failed
2020-09-20 07:17:01716[错误]命令启用WebSocket(sed-i'/\s*代理集\u头\s*连接/c\
代理设置头升级$http\U升级\
代理设置头连接“升级”\
“/tmp/deployment/config/#etc#nginx#conf.d#00#elastic#beanstalk_proxy.conf)失败
2020-09-20 07:17:01717[错误]生成后期应用程序时遇到错误:命令启用\u websockets失败
回溯(最近一次呼叫最后一次):
文件“/usr/lib/python2.7/site packages/cfnbootstrap/construction.py”,第542行,在运行配置中
CloudFormationCarpenter(配置,self.\u auth\u config).build(工作日志)
文件“/usr/lib/python2.7/site packages/cfnbootstrap/construction.py”,第260行,内部版本
更改['commands']=CommandTool().apply(self.\u config.commands)
文件“/usr/lib/python2.7/site packages/cfnbootstrap/command_tool.py”,第117行,在apply中
raise ToolError(u)命令%s失败“%name”
工具错误:命令enable_websockets失败
2020-09-20 07:17:01719[错误]--------------------------构建失败------------------------
2020-09-20 07:17:01719[错误]生成期间未处理的异常:命令enable_websockets失败
回溯(最近一次呼叫最后一次):
文件“/opt/aws/bin/cfn init”,第171行,在
worklog.build(元数据、配置集)
文件“/usr/lib/python2.7/site packages/cfnbootstrap/construction.py”,第129行,内部版本
承包商(元数据).构建(配置集,自身)
文件“/usr/lib/python2.7/site packages/cfnbootstrap/construction.py”,第530行,内部版本
self.run\u配置(配置,工作日志)
文件“/usr/lib/python2.7/site packages/cfnbootstrap/construction.py”,第542行,在运行配置中
CloudFormationCarpenter(配置,self.\u auth\u config).build(工作日志)
文件“/usr/lib/python2.7/site packages/cfnbootstrap/construction.py”,第260行,内部版本
更改['commands']=CommandTool().apply(self.\u config.commands)
文件“/usr/lib/python2.7/site packages/cfnbootstrap/command_tool.py”,第117行,在apply中
raise ToolError(u)命令%s失败“%name”
工具错误:命令enable_websockets失败
有人能简单明了地解释一下我到底需要做什么才能让它运行吗