ucdd2-sp15 / announcements

Issues as the course mailing list for announcements
1 stars 1 forks source link

Heroku #12

Open SympleSynz opened 9 years ago

SympleSynz commented 9 years ago

I could use anybody's help on deploying to Heroku. I can run everything fine on the localhost, and when I push to heroku, the build log says everything is building find. With the help of my team leader, I have tried different approaches to getting the app up and running, but to no success.
I deleted node_modules and pushed to heroku and I get the same error: "Application Error: An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details."

Any help would be very appreciated.

BrianNewsom commented 9 years ago

Hey Erik,

Will you go to the directory you type "git push Heroku master" into and type "Heroku logs" then post the output here?

Brian On Feb 15, 2015 2:29 PM, "Erik Eakins" notifications@github.com wrote:

I could use anybody's help on deploying to Heroku. I can run everything fine on the localhost, and when I push to heroku, the build log says everything is building find. With the help of my team leader, I have tried different approaches to getting the app up and running, but to no success.

I deleted node_modules and pushed to heroku and I get the same error: "Application Error: An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details."

Any help would be very appreciated.

— Reply to this email directly or view it on GitHub.

SympleSynz commented 9 years ago

Hey Brian, The build log is long since I'm been trying to deploy many many times. But this is the most recent deploy log: 2015-02-15T22:05:40.700357+00:00 heroku[api]: Deploy ad7f858 by erik.eakins@colorado.edu 2015-02-15T22:05:40.700410+00:00 heroku[api]: Release v11 created by erik.eakins@colorado.edu 2015-02-15T22:05:40.836710+00:00 heroku[web.1]: State changed from crashed to starting 2015-02-15T22:05:42.588583+00:00 heroku[web.1]: Starting process with command node mongo.js 2015-02-15T22:05:44.499429+00:00 app[web.1]: App listening at http://0.0.0.0:3000 2015-02-15T22:06:43.036743+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 2015-02-15T22:06:43.036743+00:00 heroku[web.1]: Stopping process with SIGKILL 2015-02-15T22:06:43.794275+00:00 heroku[web.1]: State changed from starting to crashed 2015-02-15T22:06:43.795471+00:00 heroku[web.1]: State changed from crashed to starting 2015-02-15T22:06:43.779582+00:00 heroku[web.1]: Process exited with status 137 2015-02-15T22:06:45.636007+00:00 heroku[web.1]: Starting process with command node mongo.js 2015-02-15T22:06:47.286202+00:00 app[web.1]: App listening at http://0.0.0.0:3000

jakehockey10 commented 9 years ago

Can you post your Procfile and mongo.js contents?

SympleSynz commented 9 years ago

Procfile: web: mongo.js mongo.js: var express = require('express') var app = express()

// dburl to a mongodb server hosted in the cloud (i.e., mongolab) var dburl = 'mongodb://github:1234@ds041871.mongolab.com:41871/github'

// get db var db = require('monk')(dburl)

// set the database app.db = db

// use jade as the view engine app.set('view engine', 'jade');

// set where the static contents are (e.g., css, js) app.use(express.static(__dirname + '/public'));

app.get('/', function(req, res) { res.render('index.jade') })

require('./mongo/issuesList')(app) require('./mongo/issuesView')(app) require('./mongo/pullsList')(app) require('./mongo/pullsView')(app)

app.set('port', (process.env.Port || 3000))

var server = app.listen(app.get('port'), function() {

var host = server.address().address
var port = server.address().port

console.log('App listening at http://%s:%s', host, port)

})

develra commented 9 years ago

Heya - this is your issue.

at the moment in your mongo.js file you have something like -

server = app.listen(3000) - but heroku doesn't want to use port 3000, it wants to use a port it defines, so you you should switch it to something like

app.set('port', (process.env.PORT || 3000))

var server = app.listen(process.env.PORT || app.get('port'), function() {

var host = server.address().address
var port = server.address().port

console.log('whatever') });

(one of the process.env.PORT's is unneeded, but I didn't feel like checking with one)

develra commented 9 years ago

try adding the process.env.port || app.get('port') to your app.listen

SympleSynz commented 9 years ago

Thank you, I'm trying it now

SympleSynz commented 9 years ago

Oh thank god, that was the issue. Thank you so much for the help

develra commented 9 years ago

No problem - I ran it to the issue a few weeks ago.

jakehockey10 commented 9 years ago

YAY!