【问题标题】:Errors deploying node elastic beanstalk application部署节点弹性 beanstalk 应用程序时出错
【发布时间】:2020-10-18 04:45:35
【问题描述】:

在部署我的新弹性 beanstalk Node.js 12 running on 64bit Amazon Linux 2/5.2.2 应用程序时,运行 $ eb deploy myapp-staging-env 后出现错误:

2020-10-17 19:57:56    INFO    Environment update is starting.      
2020-10-17 19:58:22    INFO    Deploying new version to instance(s).
2020-10-17 19:58:49    ERROR   Instance deployment failed. For details, see 'eb-engine.log'.
2020-10-17 19:58:49    ERROR   [Instance: i-034b2f1000000] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
2020-10-17 19:58:49    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-10-17 19:58:49    ERROR   Unsuccessful command execution on instance id(s) 'i-034b2f1d46f466259'. Aborting the operation.
2020-10-17 19:58:50    ERROR   Failed to deploy application.  

我真的不知道从哪里开始。

日志中的错误:

Web.stdout.log:我该去哪里修复这个错误?

----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Oct 17 17:31:43 ip-172-31-47-6 web: Server running at http://127.0.0.1:8080/
...
Oct 17 19:58:50 ip-172-31-47-6 web: /bin/sh: -c: line 0: syntax error near unexpected token `('
Oct 17 19:58:50 ip-172-31-47-6 web: /bin/sh: -c: line 0: `node app.js%!(EXTRA string=server.js)'

引擎执行遇到错误:这是什么意思?

2020/10/17 19:58:49.360716 [INFO] Executing cleanup logic
2020/10/17 19:58:49.360804 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1602964729,"severity":"ERROR"}]}]}
2020/10/17 19:58:49.360984 [INFO] Platform Engine finished execution on command: app-deploy

命令[app-deploy] 执行错误:我该去哪里解决这个问题?

2020/10/17 19:58:49.339070 [INFO] Running command /bin/sh -c systemctl start web.service
2020/10/17 19:58:49.360702 [ERROR] An error occurred during execution of command [app-deploy] - [FlipApplication]. Stop running the command. Error: Register application failed because the registration of proc web failed: 
startProcess Failure: starting process "web" failed: Command /bin/sh -c systemctl start web.service failed with error exit status 1. Stderr:Job for web.service failed because the control process exited with error code. See "systemctl status web.service" and "journalctl -xe" for details.

我的 package.json:

{
    "name": "api",
    "version": "0.0.0",
    "private": true,
    "engines": {
        "node" : "12.18.0"
    },
    "scripts": {
        "initialize": "knex migrate:latest && knex seed:run",
        "reset": "node_modules/.bin/knex migrate:rollback && node_modules/.bin/knex migrate:latest && node_modules/.bin/knex seed:run",
        "initialize-prod": "node_modules/.bin/knex migrate:latest --env production && node_modules/.bin/knex seed:run --env production",
        "reset-prod": "node_modules/.bin/knex migrate:rollback --env production && node_modules/.bin/knex migrate:latest --env production && node_modules/.bin/knex seed:run --env production",
        "start": "node -v && node server.js",
        "server": "node -v && nodemon server.js",
        "server-debug": "nodemon --inspect=0.0.0.0 server.js",
        "test": "mocha"
    },
    "dependencies": {
        "@google-cloud/speech": "^3.5.4",
        "@google-cloud/translate": "^5.1.4",
        "body-parser": "^1.18.3",
        "bookshelf": "^0.13.3",
        "cookie-parser": "~1.4.3",
        "cors": "^2.8.4",
        "debug": "~2.6.9",
        "dotenv": "^7.0.0",
        "ejs": "~2.5.7",
        "event-stream": "^3.3.5",
        "express": "~4.16.0",
        "fs": "0.0.1-security",
        "fs-path": "0.0.24",
        "knex": "^0.20.8",
        "lodash": "^4.17.15",
        "mailgun-js": "^0.22.0",
        "moment": "^2.22.2",
        "morgan": "^1.9.1",
        "nock": "^10.0.6",
        "node-gyp": "^7.1.2",
        "passport": "^0.4.0",
        "passport-cookie": "^1.0.6",
        "pg": "^7.5.0",
        "request": "^2.88.0",
        "request-promise": "^4.2.2",
        "swagger-jsdoc": "^4.0.0",
        "swagger-ui-express": "^4.1.4"
    },
    "devDependencies": {
        "chai": "^4.2.0",
        "mocha": "^6.2.0",
        "nodemon": "^1.18.4"
    }
}

此外,对于我(去年)启动的先前节点应用程序,我能够修改 gzip compression 并指定节点命令,但此选项不再可用:

【问题讨论】:

    标签: node.js amazon-web-services amazon-elastic-beanstalk


    【解决方案1】:

    Elastic Beanstalk 从软件配置中删除了NodeCommand,取而代之的是Procfile

    来自updated AWS docs on EB Node Deployment

    您可以将 Procfile 添加到源包中以指定命令 启动您的应用程序,如以下示例所示。这个 功能替换了旧版 NodeCommand 选项 aws:elasticbeanstalk:container:nodejs 命名空间。

    Procfile 被添加到应用程序根目录并包含您的应用程序运行脚本,例如:

    web: node server.js
    

    我重新部署并解决了部署错误(不确定上面的 Web.stdout.logapp-deploy 错误)。

    【讨论】:

      猜你喜欢
      • 2015-06-28
      • 2014-12-29
      • 2020-12-11
      • 2017-03-04
      • 2018-01-04
      • 2016-04-09
      • 1970-01-01
      • 2016-05-15
      • 2014-04-08
      相关资源
      最近更新 更多