MERN and MongoDB hosting - mongodb

So I possibly have a dumb question about MongoDB hosting. I'm learning the MERN stack and can't figure out how to host my app. Most of the tutorials I've seen use Heroku I believe, but it's just yet another service or thing to learn or manage. I've used Postman to verify the code works. And yes I've googled this, which only confused me more.
I have several Dreamhost domains, but can't find much info on using it to host MongoDB. Is it possible to use my current host or do I HAVE to point the DNS or whatever to another server/service, or just plain move my domain to a different provider?
Also, I've got a client/front-end directory and an api/server directory in my root folder. Is that standard practice, do I need to upload them to different hosts, merge them or what? I cannot for the life of me get the backend to work.
Edit/Update:Thank you for the response! Sorry im just now answering. It was a crazy week. The code itself works. I built a portfolio blog with a login/register system with express/mongodb to store users and posts. ALL my domains are on dreamhost and didn't want to spread out service providers if I could help it. I've built websites with PHP and SQL on there and it was easy. But from what I could find out MongoDB cannot be used on dreamhost servers. I ended up using heroku, which worked, although I haven't been able to point my DNS from my dreamhost domain to it yet. Currently it has a domain name of ***.herokuapp.com and is hosted on heroku. So that's where my problem is now, but still want to figure understand the why and how a little better. How is MongoDB different from SQL other than the relational aspect and why does it need something like heroku as opposed to dreamhost or blue host or godaddy?

So first thing first, you should know that MongoDb is hosted on an OS, now that can be your own system, cloud server or a service provider.
Domain name are nothing but just a pointer to your actual server. So you have to host your MondoDb somewhere, whether that be a service like Mongo Atlas or you have to spin up your own server on digitalocean, AWS, gcp etc.
For that need to see what are you actually doing, can't comment without having a look at your code. If you not comfortable sharing all the code online. You can personally chat with me.

Related

How do I get a certificate from Let's encrypt via Certbot on an AWS ec2 server I am planning on using as an email server?

I am trying to set up an email server on ec2 (mostly just for fun) that won't let me set up a certificate. I am using Let's encrypts Certbot because it was what they recommended. I am also hosting a Google site (I am using Google Domains). Issue: My Google site is using *.mysite.com and www.mysite.com, and I think that this is interfering with my attempts to get a certificate. Any feedback would be helpful.
I have opened many a browser tab looking for this answer. I do not know what to search for. As I said above, any feedback would be helpful.
I do not own the actual mysite.com domain. It is just an example. Just want to avoid any confusion. Thanks!

Connection from google data studio to google cloud sql postgres with SSL

I've created one instance on Google Cloud with PostgreSql and I've connected the data studio with this database adding all the addresses specified in white list specified at link below
[https://support.google.com/datastudio/answer/7288010?hl=en]
With that solution I have to open access to my database to a lot of addresses. And this issue, associated to the fact that SSL is not supported is
a big lack of security.
Is there any different way to use google data studio for reports?
Maybe using CloudSqlProxy and considering google data studio as an external application from the GC environment?
Thanks for cooperation
Michele
I am assuming you are concerned about data being exposed due to the lack of support for SSL. Though that is a valid concern in a lot of cases, for your specific use case, it should not matter:
All the ip addresses that you have to whitelist here are Google Server/infrastructure addresses.
Data Studio as an application runs on Google's servers. So the communication between Google Cloud SQL and Google Data Studio will be entirely within Google's network. Even if it is not SSL, that traffic should not be exposed to outside world.
The connection between any client computer (where report is being viewed) and Data Studio will always be HTTPS.
However, if you still want to have an SSL connection, you can create a Community Connector in Apps Script that uses the JDBC service to connect to databases using SSL.
Try using client.key in both client fields.
The solution posted below helped here,
https://support.google.com/datastudio/thread/8739014?hl=en

Recommended way to connect cloud foundry to mongodb atlas

I've got a spring boot app which is connected to mongodb atlas.
Everything is working locally.
I now want to publish this to pivotal cloud foundry.
Secure connection between PCF and atlas
In mongodb atlas I need to open up the firewall an allow certain ip numbers.
How should I configure mongodb atlas to connect to pcf in the most secure way?
Autoconfigure getting in the way
cloud foundry is overriding my connection urls to point to localhost:27017 instead of my atlas cluster.
What is the recommended way to connect to mongodb atlas?
In mongodb atlas I need to open up the firewall an allow certain ip numbers. How should I configure mongodb atlas to connect to pcf in the most secure way?
White listing IP addresses for applications that run on CF is not particularly effective. The reason it's not effective is that you don't know the IP address from which you'll be connecting, because it depends on where Diego decides to run your application. In other words, it depends on the cell where your application is told to run. To compound matters, that will change when you restart / restage your application.
Because the IP can vary, what you end up needing to do is white list all of your Cells. The problem with this and why it's not effective is that you've ended up white listing every app running on the platform.
What you can do to improve the security a bit is to make use of application security groups. ASG's can be used to limit outgoing traffic. You can also control them at the space level. That means you can configure your default running security group to not allow access to your MongoDb server, but you can allow access for individual spaces by binding an ASG to only those spaces with apps that need to talk to your MongoDb servers.
The downside of this approach is that it requires you to be a platform administrator, which means it will only work if you own your CF installation (not going to work for public providers).
More on ASG's here: https://docs.cloudfoundry.org/adminguide/app-sec-groups.html
For public providers, you can use a proxy. To make this work, you need to have your application configured to talk through a proxy when it attempts to access your Mongodb servers. You control the proxies, which have fixed IPs, so you can white list the proxies to allow access to just your app. If you don't want to run your own proxy servers, there are public proxy providers that you can use.
cloud foundry is overriding my connection urls to point to localhost:27017 instead of my atlas cluster. What is the recommended way to connect to mongodb atlas?
It's possible to disable auto configuration. One way is described in the docs here. If you include the Spring Cloud Connectors dependencies and use them manually, then the auto configuration will not run.
https://docs.cloudfoundry.org/buildpacks/java/spring-service-bindings.html#manual
The other option is to tell the Java build pack not to install the auto configuration. You can do that by setting the following environment variable for your application, either with cf set-env or via a manifest.yml file.
Ex: JBP_CONFIG_SPRING_AUTO_RECONFIGURATION='[enabled: false]'
Be careful if you do this as it will disable everything provided by the auto reconfiguration, which includes setting the "cloud" profile for your app. If you use this option to disable auto reconfiguration, you'll probably also want to set SPRING_PROFILES_ACTIVE='cloud' to manually enable the cloud profile.
I suppose your other option is to simply embrace the auto configuration. It's a little confusing / magical at first, but I've found this article to explain it very well.
https://spring.io/blog/2015/04/27/binding-to-data-services-with-spring-boot-in-cloud-foundry
Hope that helps!

SSL Endpoints on Heroku and MongoLab

I'm using CloudFlare to get free SSL coverage for a domain I own on GoDaddy. That's great and if you haven't checked out those services you might find them handy to use. I do have a question though, I'd like to provide HTTPS/SSL encryption for data transmitted from my MongoLab DB to my Heroku App. Both of these are through Heroku. So,
(1) Do I need additional SSL encryption to protect the sensitive data I'll be transmitting between those two endpoints?
(2) How do I go about acquiring that?
(3) If yes to (1) and no good answer for (2), what's an alternative (nearly free) option to accomplish the same thing. I'm not wed to MongoDB for this project.
Thanks in advance and hope this question helps someone else out as well.
Apparently, Heroku maintains that if you provision a MongoLab DB through them (and not through MongoLab directly) and have your Heroku app in the same AWS region you're fine as no packet sniffing can occur.
Otherwise you can purchase separate SSL encryption.
I've also decided to encrypt the data going into my database as well.

Deploy a Meteor project to my own domain?

I want to deploy my Meteor project to my own domain. In the docs it says:
"You can also deploy to your own domain. Just set up the hostname you want to use as a CNAME to origin.meteor.com, then deploy to that name.
$ meteor deploy www.myapp.com
We provide this as a free service so you can try Meteor. It is also helpful for quickly putting up internal betas, demos, and so on."
Is this what I need to do? What does this even mean? I don't know what a CNAME is or how to set up my hostname.
Over a year late but perhaps relevant for anyone else with this question, since the comments and answer given seem to miss the point - which is not about deploying to your own server but rather configuring meteor.com hosting to use a custom domain.
Meteor.com offer a free service that is intended for demos and internal betas - the very early days in the life of a site.
You can use meteor deloy without configuration if you are deploying to a subdomain on meteor.com -
meteor deploy myGreatHope.meteor.com
However you can also host your app on meteor.com using your own domain but to do that you need to be able to set up an alias which is done through CNAME A records
These are setup on a server that would otherwise host your site - So you will need a host - it could be really cheap one, and it could provide email hosting for you, ask them to create the A records (or look up your control panel help files) so that they resolve to origin.meteor.com and then you have your site, deployed to meteor.com accessible through your domain name.
If you want to deploy Meteor on your own domain, I wrote a tutorial on the subject. If you are running Nginx, it should help you. Otherwise, if you are running Apache, check the second one.
Deploy a Meteor Application on Ubuntu with Nginx.
Deploy a Meteor Application on Ubuntu with Apache.
And of course, you need to understand and configure your DNS. This two tutorials helped me a few months ago.
An Introduction to DNS Terminology, Components, and Concepts
How To Set Up a Host Name with DigitalOcean