sails.js - heroku and sails app | crashes and timeouts -
i have basic sails app , running locally. when deploy heroku, cannot response app , "application error". receive "no data received".
heroku logs
2015-08-30t22:06:50.949475+00:00 heroku[api]: release v22 created me 2015-08-30t22:08:57.324207+00:00 heroku[router]: at=error code=h20 desc="app boo t timeout" method=get path="/" host=www.ninjalist.io request_id=8e21f6eb-1a59-4e 31-9c40-00aab002d0f1 fwd="118.61.238.166" dyno= connect= service= status=503 bytes= 2015-08-30t22:08:52.058851+00:00 heroku[web.1]: state changed starting down 2015-08-30t22:11:55.735176+00:00 heroku[router]: at=error code=h10 desc="app cra shed" method=get path="/" host=ninjalist.herokuapp.com request_id=314047d1-97d8- 40ea-8596-4b21978eb581 fwd="108.61.228.166" dyno= connect= service= status=503 b
heroku logs --source app
2015-08-30t21:40:42.149449+00:00 app[web.1]: > firstapp@0.0.1 start /app 2015-08-30t21:40:42.149452+00:00 app[web.1]: > sails lift --prod 2015-08-30t21:40:42.149453+00:00 app[web.1]: 2015-08-30t21:40:42.149430+00:00 app[web.1]: 2015-08-30t21:40:42.873435+00:00 app[web.1]: ←[90mstarting app...←[39m 2015-08-30t21:40:42.871270+00:00 app[web.1]: 2015-08-30t21:40:42.873742+00:00 app[web.1]: 2015-08-30t21:40:44.441658+00:00 app[web.1]: warning: connect.session() memoryst ore not 2015-08-30t21:40:44.441664+00:00 app[web.1]: designed production environme nt, leak 2015-08-30t21:40:44.441666+00:00 app[web.1]: memory, , not scale past s ingle process. 2015-08-30t21:41:04.326177+00:00 app[web.1]: error: hook `grunt` taking t oo long load. 2015-08-30t21:41:04.326187+00:00 app[web.1]: @ timer.listontimeout (timers. js:119:15) 2015-08-30t21:41:04.326183+00:00 app[web.1]: make sure triggering `ini tialize()` callback, or else set `sails.config.grunt._hooktimeout higher va lue (currently 20000) 2015-08-30t21:41:04.326185+00:00 app[web.1]: @ toolong [as _ontimeout] (/ap p/node_modules/sails/lib/app/private/loadhooks.js:92:21) 2015-08-30t21:41:04.587989+00:00 app[web.1]: 2015-08-30t21:41:04.641592+00:00 app[web.1]: npm err! argv "/app/.heroku/node/bi n/node" "/app/.heroku/node/bin/npm" "start" 2015-08-30t21:41:04.641839+00:00 app[web.1]: npm err! node v0.12.7 2015-08-30t21:41:04.668957+00:00 app[web.1]: npm err! npm v2.11.3 2015-08-30t21:41:04.669159+00:00 app[web.1]: npm err! code elifecycle 2015-08-30t21:41:04.669368+00:00 app[web.1]: npm err! firstapp@0.0.1 start: `sai ls lift --prod` 2015-08-30t21:41:04.669504+00:00 app[web.1]: npm err! exit status 1 2015-08-30t21:41:04.669672+00:00 app[web.1]: npm err! 2015-08-30t21:41:04.669827+00:00 app[web.1]: npm err! failed @ firstapp@0.0 .1 start script 'sails lift --prod'. 2015-08-30t21:41:04.670024+00:00 app[web.1]: npm err! prob lem firstapp package, 2015-08-30t21:41:04.670133+00:00 app[web.1]: npm err! not npm itself. 2015-08-30t21:41:04.670267+00:00 app[web.1]: npm err! tell author fails on system: 2015-08-30t21:41:04.670427+00:00 app[web.1]: npm err! sails lift --prod 2015-08-30t21:41:04.675558+00:00 app[web.1]: npm err! can info via : 2015-08-30t21:41:04.676317+00:00 app[web.1]: npm err! npm owner ls firstapp 2015-08-30t21:41:04.697584+00:00 app[web.1]: 2015-08-30t21:41:04.676320+00:00 app[web.1]: npm err! there additional logging output above. 2015-08-30t21:41:04.701882+00:00 app[web.1]: npm err! /app/npm-debug.log 2015-08-30t21:41:04.640986+00:00 app[web.1]: npm err! linux 3.13.0-61-
procfile:
web: npm start
package.json / scripts:
"scripts": { "debug": "node debug app.js", "start": "sails lift --prod" }
config/env/production:
module.exports = { models: { connection: 'mongodbprod' }, port: 80, log: { level: "silent" } };
any direction appreciated!
you can use specialized buildpack heroku runs grunt tasks on deployment, , turn off grunt in sails production environment. it's bit more work, can become necessary because heroku has own timeout can tripped grunt taking long crunch assets.
we've had success heroku-buildpack-nodejs-grunt. can follow instructions install on heroku app, copy task definition in tasks/register/prod.js
include heroku:production
task, e.g.:
module.exports = function (grunt) { grunt.registertask('prod', [ 'compileassets', 'concat', 'uglify', 'cssmin', 'sails-linker:prodjs', 'sails-linker:prodstyles', 'sails-linker:devtpl', 'sails-linker:prodjsjade', 'sails-linker:prodstylesjade', 'sails-linker:devtpljade' ]); grunt.registertask('heroku:production', [ 'compileassets', 'concat', 'uglify', 'cssmin', 'sails-linker:prodjs', 'sails-linker:prodstyles', 'sails-linker:devtpl', 'sails-linker:prodjsjade', 'sails-linker:prodstylesjade', 'sails-linker:devtpljade' ]); };
then in app.js
file, replace
sails.lift(rc('sails'));
with:
var config = rc('sails'); if (process.env.node_env === 'production') { config.hooks = config.hooks || {}; config.hooks.grunt = false; } // start server sails.lift(config);
Comments
Post a Comment