部署节点弹性 beantalk 应用程序时出错

Gro*_*ler 0 amazon-web-services node.js amazon-elastic-beanstalk

部署我的新弹性 beanstalkNode.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.  
Run Code Online (Sandbox Code Playgroud)

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

日志中的错误:

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)'
Run Code Online (Sandbox Code Playgroud)

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

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
Run Code Online (Sandbox Code Playgroud)

命令执行错误[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.
Run Code Online (Sandbox Code Playgroud)

我的 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"
    }
}
Run Code Online (Sandbox Code Playgroud)

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

在此处输入图片说明

Gro*_*ler 5

Elastic BeanstalkNodeCommand从软件配置中删除,取而代之的是Procfile.

来自EB 节点部署的更新 AWS 文档

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

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

web: node server.js
Run Code Online (Sandbox Code Playgroud)

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