python flask app cannot connect to mLab

Operating System & Version
linux
cPanel & WHM Version
86.0 (build 30)

ntohidi

Member
Nov 14, 2020
5
0
1
kl
cPanel Access Level
Root Administrator
I've got a domain from Godaddy and at the same time I've also got its Cpanel web hosting.
I have a flask app, and I'm using mLab as a database, and here's how I connect to the database in code:

01.png
I could manage to create a new python application on Cpanel:

02.png
when I check my domain, let say mydomain.com, my website is there, but the app couldn't connect to the database.
i checked logs, I've got this error:
Python:
dsxxxxxx.mlab.com:xxxxx: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 5f..., topology_type: Single, servers: [<ServerDescription ('dsxxxxxx.mlab.com', xxxxx) server_type: Unknown, rtt: None, error=AutoReconnect('dsxxxxxx.mlab.com:xxxxx: [Errno 111] Connection refused',)>]>
and one more question, is it possible to have and use MongoDB in Cpanel?
I need to say that I don't have enough knowledge of Cpanel, but I'm trying to deploy my website there. I really hope someone here can help me with this regard :)
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
5,393
693
313
cPanel Access Level
Root Administrator
Hey there! For the connection issue, you may want to try that work with the server's firewall disabled, as there wouldn't be anything on the cPanel side of things that keeps that from connecting properly.

MongoDB is not something that is currently supported by cPanel, and due to the way the product is licensed at this time, we aren't looking to include that in a future release. You can find more details on that here:

 

ntohidi

Member
Nov 14, 2020
5
0
1
kl
cPanel Access Level
Root Administrator
Hey there! For the connection issue, you may want to try that work with the server's firewall disabled, as there wouldn't be anything on the cPanel side of things that keeps that from connecting properly.

MongoDB is not something that is currently supported by cPanel, and due to the way the product is licensed at this time, we aren't looking to include that in a future release. You can find more details on that here:


oh, I see, how can I disable the firewall on the server?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
5,393
693
313
cPanel Access Level
Root Administrator
Do you have root access to the server? If not, that's something you'd need to contact the hosting provider or datacenter to have them help with.

If you have root access and are using CSF tools, we have more details on that here:

 

ntohidi

Member
Nov 14, 2020
5
0
1
kl
cPanel Access Level
Root Administrator
Do you have root access to the server? If not, that's something you'd need to contact the hosting provider or datacenter to have them help with.

If you have root access and are using CSF tools, we have more details on that here:

Yes, I have root access to the server. but CSF is not installed on the server, I need to install it, right?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
5,393
693
313
cPanel Access Level
Root Administrator
There isn't a reason you would need to install CSF, although many people find that it makes managing the firewall on the system easier since it provides an interface in WHM that works with the firewall.

Are you able to reach the mlab.com connection from outside your code? You could try digging that domain from the server, or you could try connecting with a telnet session if the code uses a custom port, just to see if the basic connection is working at all.
 

ntohidi

Member
Nov 14, 2020
5
0
1
kl
cPanel Access Level
Root Administrator
There isn't a reason you would need to install CSF, although many people find that it makes managing the firewall on the system easier since it provides an interface in WHM that works with the firewall.

Are you able to reach the mlab.com connection from outside your code? You could try digging that domain from the server, or you could try connecting with a telnet session if the code uses a custom port, just to see if the basic connection is working at all.
Yes, mlab connection is working.
and I checked again, I don't have root access, and contacted GoDaddy and asked them to give me root access, but they said my hosting plan should be either vps or dedicated. my current plan is delux.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
5,393
693
313
cPanel Access Level
Root Administrator
Without root access there isn't going to be any troubleshooting you can do with the firewall level.

I would expect Firebase to work in a similar fashion where you can connect to it remotely, although Google does provide entire hosting solutions based around Firebase as well.