I have my own home server, where i have nginx configured and some api's and webs there. also set up a mongoDb server there, the thing is I can't connect from vercel or heroku to it, but when I try to connect from different internet connections like in a coffee shop I can connect and work.
this is the error I get
someone can give me a little help? also I don't know why in map is showing my local IP in the URL that I use already configured my public ip.
Related
I just hosted my site on Heroku, but when I visited the site, it shows me "internal server error". But one thing I think may cause this error is I use mongoose's url as
mongoose.uri(mongodb://localhost:2725/user
So, Is it Okey to do this way? Or do I have to use cloud databases?
Or am I going use site's url which given by the Heroku instead of the localhost?
local host address is not valid for deploying your app
you must using cloud database
mongodb gives you free database service(mongodb atlas)
I'm deploying a Node/React app to DigitalOcean Apps(similar to Heroku) and a Database to MongoDB Atlas. DigitalOcean do not provide external fixed IP addresses.
I want to secure the connection between the Server and database. Obviously I can't use the whitelist feature, since my server doesn't have a fixed IP.
My questions are:
Can I allow the database to be accessed from anywhere if I put my app to production?
What can I do to fix this problem? -how can I secure the connection in my server-database setup?
I am a newbee to Google Cloud, however, I setup the project based on Standard App Engine based for my Node.JS application. I downloaded the code from GIT and able to deploy. In my code, it tries to make a Mongo connection to my Replication Server that is hosted at Atlas MongoDB (I guess it's on AWS EC2 instance). I have access control enabled so only server to server with known IPs can connect to my MongoDB.
Obviously I was expecting the connection from my freshly deployed app to fail. So to remediate I want to add the external IP of the instance from Google Cloud (whatever is the Public IP that is seen) to Mongo Network Access. I tried a few IP address I thought are the right ones but it's not working. I see the connection is trying to make to Atlas but it's failing because I am not sure what Public IP address is seen from AppEngine (Docker Instance?)where my app is running.
I tried 0.0.0.0/0 - open to all clients and my app works just fine, however I definitely don't want to open MongoDB access to entire world. If anybody knows more about Google Cloud please help.
Thanks in advance for replying if you have important info to share.
Google App Engine doesn't have an External/Static IP that you can refer. This can be achieved by using a VM on Google Compute Engine that has an External IP with proxy to your App Engine.
Besides that, there is a Feature Request open for this to be checked by Google that you can access here:
Provide static IP for outbound urlfetch requests
Besides that, you can access the documentation Static IP Addresses and App Engine apps, to find out more information on options already available on App Engine.
Please, let me know if the information helped you.
I deployed an express REST API using visual studio azure extension. It only consists of endpoints that serves JSON data. I have a few endpoints that it only serves and error message, those are working just fine, so the express application is working correctly but when I reach to an endpoint that requires to read from MongoDB, in visual studio, inside the streaming logs it prompts this:
Error:
(node:68) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [cluster0-shard-00-02-cia4k.mongodb.net:27017] on first connect [MongoNetworkError: connection 4 to cluster0-shard-00-02-cia4k.mongodb.net:27017 closed
So as you can see it says it having a problem connecting, and I don't know what failed to connect to the server, "connection 4" means in this case.
I'm trying to connect an express application to MongoDB in the cloud. I'm using MongoDB Compass to visualize the data, and it doesn't have a problem connecting. These are the things that I made sure were correct.
Network Access in MongoDB: Azure IP is registered in MongoDB (I found it in the "Custom Domain" tab in azure).
Node.js has the correct Mongo address: mongodb+srv://<MyUsername>:<MyPassword>#cluster0-cia4k.mongodb.net/<DatabaseName>.
I add this as a parameter at the end to the mongo address mongodb+srv://...?authSource=admin.
I'm not trying to access a local MongoDB in the VM in Azure.
I already look at this StackOverflow thread but I couldn't find something that helped me. Most of the problems in that post were locally in their computers.
Please help me.
I've found the solution, So I wasn't wrong about one of the steps that I made but it required an extra setup. Basically the problem was this:
Network Access in MongoDB: Azure IP is registered in MongoDB (I found it in the "Custom Domain" tab in azure).
It turns out that Microsoft Azure has multiple outbound IP Addresses. You can find them under the (Setting > Properties) > Outbound IP addresses. Put them all in MongoDB Atlas and that fixed my issue.
I am now trying to host my Angular, Node, MongoDB app on DigitalOcean. I have succesfully set up the two Droplets, one for Node Backend and one for MongoDB Database. Until now I was using a local link to connect to local database like the following link mongodb://localhost:27017/creditApp .
How do I connect my Node app hosted in Droplet to the MongoDB hosted in another Droplet? The database has admin password set up, also has allowed the IP address from my backend in the ufw list. I assume it needs a config object with admin name, password, ssh key .pub file etc and attach that object while trying to connect it, but I am not quite sure how to do it. How do I get this done?
Any help will be highly appreciated, thanks in advance.