angular bitbucket heroku 部署后超出内存配额 [英] Memory quota exceeded after angular bitbucket heroku deployment
问题描述
我正在尝试制作一个 Bitbucket 管道,它将应用程序部署到 Heroku.
I am trying to make a Bitbucket pipeline which will deploy the app to the Heroku.
它已部署,但在 Heroku 上我得到了
It deploys but on Heroku I am getting
2019-04-01T19:47:11.305401+00:00 app[web.1]: [34mℹ[39m [90m「wdm」[39m: Compiled successfully.
2019-04-01T19:47:18.311170+00:00 heroku[web.1]: Process running mem=571M(111.6%)
2019-04-01T19:47:18.311170+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2019-04-01T19:47:40.049088+00:00 heroku[web.1]: Process running mem=558M(109.0%)
2019-04-01T19:47:40.049160+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2019-04-01T19:47:51.213698+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-01T19:47:51.071576+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
这是我的 package.json.该应用程序基本上是一个新的 angular-cli 生成的项目.我对 package.json 进行了一些更改,以便它可以在 Heroku 上运行.
This is my package.json. The app is basically a fresh angular-cli generated project. I made some changes to package.json so it would work on Heroku.
{
"name": "quiz-web",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"heroku-postbuild": "ng build --prod"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.2.11",
"@angular/cdk": "^7.3.6",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/material": "^7.3.6",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"@angular/cli": "~7.3.6",
"@angular-devkit/build-angular": "~0.13.0",
"@angular/compiler-cli": "~7.2.0",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular/language-service": "~7.2.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
},
"engines": {
"node": "10.15.0",
"npm": "6.4.1"
}
}
这是我的管道文件
image: node:10.15.0
clone:
depth: full
pipelines:
default:
- step:
script:
# create a zip file from the heroku app sources
- git archive --format=tar.gz master -o sample-app.tar.gz
- pipe: atlassian/heroku-deploy:0.1.1
variables:
HEROKU_API_KEY: $HEROKU_API_KEY
HEROKU_APP_NAME: $HEROKU_APP_NAME
# here you specify the name of the zip file containing your
# heroku application sources
ZIP_FILE: 'sample-app.tar.gz'
也许我可以在管道中构建 bitbucket,然后推送到 Heroku,但我需要编写每个步骤,所以我更愿意使用 cli,因为这是我的第一个 CI 集成.
Maybe I could just build on the bitbucket in pipeline and then push to Heroku but I would need to do write each steps so I would prefer to use the cli as it's my first CI integration.
推荐答案
根据最佳实践 (https://devcenter.heroku.com/articles/node-best-practices#avoid-garbage) 您可以在 Procfile 中限制节点容器:
According to the Best Practices (https://devcenter.heroku.com/articles/node-best-practices#avoid-garbage) you can limit your node container in your Procfile:
web: node --optimize_for_size --max_old_space_size=460 --gc_interval=100 server.js
这篇关于angular bitbucket heroku 部署后超出内存配额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!