2014-04-25 2 views
3

heroku에서 node.js 앱을 개발 중입니다. 현재 그것은 단일 (무료) dyno에서 실행됩니다.Heroku - 항상 충돌합니다.

갑자기 내 앱이 추락하여 현재 NewRelic 및 Librato addons를 추가 한 후에 앱이 추락합니다. (앱이 해당 추가 기능을 추가 할 때 다시 시작됩니다.) - 앱 중 하나가 발생한 후 처음으로 오류가 발생했습니다. addons가 추가되었습니다. 그래서 두 애드온을 모두 제거했지만 문제는 여전히 남아 있습니다. 내가 무슨 잘못 확인하고 싶어서 나는 내 응용 프로그램 코드를 주석과 웹에서 간단한 예제를 대체 : packages.json에 Procfile

web: node index.js 

엔진

하는 index.js에게

var http = require('http'); 
http.createServer(function (req, res) { 
    res.writeHead(200, {'Content-Type': 'text/plain'}); 
    res.end('Hello World\n'); 
}).listen(process.env.PORT); 
console.log('Server running at http://127.0.0.1:1337/'); 

을 (노드가 설치 한 노드는 0.10.26입니다.

"engines": { 
    "node": "0.10.x" 
}, 

이 코드는 (내각에서 테스트 한) 내 PC에서 작동합니다. 나는 Heroku가 응용 프로그램 충돌에 배포 할 때 - 여기 로그입니다 : 내가 heroku restart하려고 할 때

2014-04-25T09:43:42+00:00 heroku[slug-compiler]: Slug compilation started 
2014-04-25T09:43:47.850609+00:00 heroku[api]: Release v30 created by xxx 
2014-04-25T09:43:47.850538+00:00 heroku[api]: Deploy 562babb by xxx 
2014-04-25T09:43:47+00:00 heroku[slug-compiler]: Slug compilation finished 
2014-04-25T09:43:48.588089+00:00 heroku[web.1]: State changed from crashed to starting 
2014-04-25T09:43:55.655057+00:00 heroku[web.1]: Starting process with command `node index.js` 
2014-04-25T09:43:57.931274+00:00 heroku[web.1]: Process exited with status 8 
2014-04-25T09:43:57.945393+00:00 heroku[web.1]: State changed from starting to crashed 

가 :

2014-04-25T09:44:43.071357+00:00 heroku[web.1]: State changed from crashed to starting 
2014-04-25T09:44:51.834860+00:00 heroku[web.1]: Starting process with command `node index.js` 
2014-04-25T09:44:54.250631+00:00 heroku[web.1]: State changed from starting to crashed 
2014-04-25T09:44:54.235545+00:00 heroku[web.1]: Process exited with status 8 

이 나를 미치게 - 나는 Heroku가 많은 노드 애플리케이션을 배치하는 생산에서 뛰어 다니고 그런 문제가 없었던 것 - whats going on ??? 나는 (내가 및 localY이 V를 사용하고) 다음 앱을 시작하고 작업했지만, 난이 heroku restart을했을 때 다시 추락 0.10.20에 노드 엔진 버전을 변경


...

State changed from up to starting 
2014-04-25T10:10:12.990317+00:00 heroku[web.1]: Stopping all processes with SIGTERM 
2014-04-25T10:10:15.145758+00:00 heroku[web.1]: Process exited with status 143 
2014-04-25T10:10:16.151380+00:00 heroku[web.1]: Starting process with command `node index.js` 
2014-04-25T10:10:18.905637+00:00 heroku[web.1]: Process exited with status 8 
2014-04-25T10:10:18.929730+00:00 heroku[web.1]: State changed from starting to crashed 

두 번째 다시 시작 응용 프로그램 후 up 및 다시 runing 및 다시 세 번째 다시 시작한 후 (항상 충돌/상태 8 종료).

답변

1

문제가 Heroku 자체 일 수 있습니다. 약 1 시간 전에 발생한 인시던트 보고서가 있었지만 문제의 원인을 아직 알 수는 없습니다. https://status.heroku.com/incidents/614

한편 HerokuDashboard를 통해 이전 작업 빌드로 롤백 할 수 있습니다.

+0

롤백 시도하고 문제가 계속 :(미친 먹으 렴 남아 - heroku issue -> +1 heroku 사건에 대한 링크를 가리키는 것으로 보입니다. – user606521

0

잘못된 포트에서 시작하려고합니다. Heroku는 환경 변수에 PORT 변수를 설정하지 않습니다 (heroku config을 실행하면이 변수를 볼 수 있습니다). PORT 변수는 Procfile에서 명시 적으로 사용해야합니다.

당신은 당신의 Procfile이 같은 일을해야합니다

web: node index.js $PORT 

가 그런 말을 당신의하는 index.js 코드를 수정 :

var http = require('http'); 
http.createServer(function (req, res) { 
    res.writeHead(200, {'Content-Type': 'text/plain'}); 
    res.end('Hello World\n'); 
}).listen(process.argv[2]); 
console.log('Server running at http://127.0.0.1:' + process.argv[2]); 
+0

사실이 아닙니다. 사실 heroku는'process.env.PORT' - 이제는 해결 된 heroku 문제 였고 모든 것이 잘 작동합니다. – user606521

+0

$ PORT가 내 문제를 해결해 주셔서 고맙습니다. – TimCodes

관련 문제