abernier / mosaico-backend

Ready to go backend for Mosaico editor
https://mosaicobackend-prod.herokuapp.com
GNU General Public License v3.0
13 stars 13 forks source link

Database connection error when running "npm run dev" #54

Open yudhk opened 5 years ago

yudhk commented 5 years ago

so everything was fine until the database connection I'am using postgresql 11.2 os : debian 9 is there any file that I have to change?

[05:27:36] Finished 'launchBrowserSync' after 247 ms [05:27:36] Starting 'watchFiles'... [05:27:36] Finished 'watchFiles' after 44 ms [05:27:36] Finished 'dev' after 16 s [IMAGES] config.images.cache true [EMAIL] transport mailing – SUCCESS [REDIS] connection – SUCCESS [DATABASE] connection – ERROR [SERVER] gracefully closing server… waiting 1 to close issue at server init Error: [DATABASE] connection – ERROR at config.setup.then (/home/yudha/builder/server/index.js:630:30) at [SERVER] exiting process [05:27:38] [nodemon] clean exit - waiting for changes before restart DATABASE] connection – ERROR

Hiswe commented 5 years ago

You need to check the server configuration if your DB doesn't match the default.

https://github.com/goodenough/mosaico-backend/blob/master/README.md#configuration

yudhk commented 5 years ago

sorry but I'am a newbie and I really want to install this app on my server, I see the configuration file and it is look like this

onst config = rc('backend', { debug: false, forcessl: false, host: 'localhost:3000', database: 'postgres://localhost:5432/mosaico-backend', redis: 'redis://localhost:6379', emailTransport: { host: 'localhost', port: 1025, },

is that mean that I have to create database and named it "mosaico-backend" and what the user and passwd are should be? because I haven't touch anything with the db configuration on my server I just installed the postgresql and go into the next step, but it says database connection error

yudhk commented 5 years ago

so now I trying to install this on my ubuntu server and following the instruction to install this cool app, but I still got the same error "database connection error" could you tell me what is wrong with that, and I'm sure it is not because of my postgresql/database configuration since I don't do any configuration there, or maybe there is files that I have to configured?

Hiswe commented 5 years ago

@yudhk For the DB you should have a mosaico-backend DB. You have also to know on which port your DB is listening.

If it doesn't match the default configuration, you should create & edit a .backendrc (see the example file) No need to change config.js

yudhk commented 5 years ago

I have created mosaico-backend DB and it already running on port 5432 by default and I still got the same result, I have do anything to make this works from firewall, configuring the database testing it, but nothing works so far, maybe it sounds silly but what about the username and password for the database mosaico-backend? Or it already automatically generated when I run the npm run dev?

Dapatkan Outlook untuk Androidhttps://aka.ms/ghei36


From: Hiswe notifications@github.com Sent: Thursday, March 28, 2019 1:55:10 AM To: goodenough/mosaico-backend Cc: yudhk; Mention Subject: Re: [goodenough/mosaico-backend] Database connection error when running "npm run dev" (#54)

@yudhkhttps://github.com/yudhk For the DB you should have a mosaico-backend DB. You have also to know on which port your DB is listening.

If it doesn't match the default configuration, you should create & edit a .backendrc (see the example file) No need to change config.js

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/goodenough/mosaico-backend/issues/54#issuecomment-477303072, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aunn_24djS5U--qqBRxvzT0APkepN2BEks5va76NgaJpZM4cGG2q.

Hiswe commented 5 years ago

username & password have nothing to do with Node. You should try to connect to your DB with a client and test your credentials there. If you can make a connection, you will just have to report your config in the backend configuration

yudhk commented 5 years ago

I have tried it, connect to the database with credentials and it's working fine, I don't know what I have to do next because I still got the same error, since it's just vps for testing purpose if you want to take a look on my vps server and maybe you can find what is wrong with that here are the auth : 144.202.116.161 name : root password Vs5)8vX.RgX)Zhmc I'll keep the server at least for 24 hour I put the mosaico file on /home/yudha/...

Hiswe commented 5 years ago

DB url should be in format

postgres://db-user:db-password@db-url:db-port/db-name

bradleytaftsmith commented 3 years ago

I was able to solve very similar issue by adding user 'root' to my database roles, and providing adequate permissions with the specified database.

Specifying a username that DID have access using the format above in the .backendrc-example file did not solve my issue.

Sorted it by looking at db logs