polonel / trudesk

:coffee: :seedling: Trudesk is an open-source help desk/ticketing solution.
http://trudesk.io
Other
1.31k stars 437 forks source link

After fresh install with existing database in MongoDB Atlas getaddrinfo ENOTFOUND #400

Closed bportman closed 3 years ago

bportman commented 3 years ago

Is this a BUG REPORT or FEATURE REQUEST?:

What happened:

I set up trudesk using the ubuntu install script and a local mongodb. Then I wanted to move my db to MongoDB Atlas, so I did a mongodump and mongorestore to move my DB there, then terminated my EC2 ubuntu instance and recreated it so I could start from scratch. I ran the installer and put the remote mongodb host, username, password and database name in the installer. Per a previous issue, I put "---" for the port. I was prompted whether this was a new database or an existing one and chose existing. This got it to complete the install successfully and say it was rebooting. However, after reboot, trudesk doesn't start up and the following appears in output.log:

3/16 14:51:34 [1359] - error: Oh no, something went wrong with DB! - failed to connect to server [mymongodbhostname:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mymongodbhostname mymongodbhostname:27017] 3/16 14:51:34 [1359] - error: Oh no, something went wrong with DB! - failed to connect to server [mymongodbhostname:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mymongodbhostname mymongodbhostname:27017] 3/16 14:51:34 [1359] - error: FETAL: failed to connect to server [mymongodbhostname:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mymongodbhostname mymongodbhostname:27017] 3/16 14:51:34 [1359] - warn: Retrying to connect to MongoDB in 10secs... 3/16 14:51:44 [1359] - error: Oh no, something went wrong with DB! - failed to connect to server [mymongodbhostname:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mymongodbhostname mymongodbhostname:27017] 3/16 14:51:44 [1359] - error: Oh no, something went wrong with DB! - failed to connect to server [mymongodbhostname:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mymongodbhostname mymongodbhostname:27017] 3/16 14:51:44 [1359] - error: FETAL: failed to connect to server [mymongodbhostname:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND mymongodbhostname mymongodbhostname:27017] 3/16 14:51:44 [1359] - warn: Retrying to connect to MongoDB in 10secs...

I have the MongoDB Atlas cluster accessible from all IPs and I can connect to it with MongoDB Compass on my local machine. I have all outgoing ports open in AWS for my ubuntu instance, and the Ubuntu ufw firewall is inactive.

What did you expect to happen:

I expected it to be able to connect, but it won't after the install completed.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Could there be a compatibility issue with MongoDB 4.4? My Atlas cluster uses that? Or does it have something to do with the fact that it is a cluster and the Trudesk driver can't connect to a cluster?

Environment:

polonel commented 3 years ago

Trudesk is not able to connect to host mymongodbhostname. Typically a domain/IP address is used in this field. The following error shows that is not able to resolve/connect to mymongodbhostname

failed to connect to server [mymongodbhostname:27017]

bportman commented 3 years ago

@polonel I was not putting "mymongodbhostname" in. I put that in the issue only to obscure my actual hostname or IP address. In any case, I got this working by completely reinstalling, using an internal mongodb instance on my EC2 instance rather than MongoDB Atlas, and keeping regular snapshots to revert in case anything get's messed up.