angularjs - Connection refused on heroku using generator-sql-fullstack -


you last chance here. i've build project generator-sql-fullstack package , trying deploy heroku.

unfortunately, can't connect heroku database error r10. i've tried different ways connect postgres through sequelize - none of them worked. main thing make ssl compatible, still doesn't connect (or maybe using wrong)

project runs great locally, app build without errors also.

please, take heroku logs , main files connection. hopefully, able me here. thank you.

$ heroku logs 2016-04-18t21:27:36.994697+00:00 app[web.1]: > node server/app.js 2016-04-18t21:27:36.994705+00:00 app[web.1]:  2016-04-18t21:27:37.784886+00:00 app[web.1]: express server listening on 55648, in production mode 2016-04-18t21:28:34.891786+00:00 heroku[web.1]: error r10 (boot timeout) -> web process failed bind $port within 60 seconds of launch 2016-04-18t21:28:34.891786+00:00 heroku[web.1]: stopping process sigkill 2016-04-18t21:28:35.750471+00:00 heroku[web.1]: process exited status 137 

/server/config/environment/production.js

module.exports = {   database: 'dbname',   username: 'dbusername',   password: 'dbpassword',   sql: {       host: 'dbhost',       port: process.env.port || '5432',       dialect: 'postgres',        dialectoptions: {         ssl: true       }     } }; 

/server/api/index.js

var sequelize = new sequelize(config.database, config.username, config.password, config.sql); 

other that, nothing touched on server side. guess using sequelize incorrectly, followed documentation (to adapt ssl heroku).

please, let me know if want see more configuration files.

thank input!

this:

var sequelize =  new sequelize(process.env.database_url); 

should enough connecting heroku's postgres. can check database_url in heroku dashboard -> yourapp -> settings -> config variables. can take db credentials string, don't need to.

process.env.port not database port, port on should start server(so heroku can internal routing things), like:

server.listen(process.env.port || 5432) 

so config file should like:

module.exports = {  port: process.env.port || 5432,  database: {   uri: process.env.database_url  } }; 

and connecting database with:

var sequelize =  new sequelize(config.database.uri); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -