Connecting Meteor External DB with ssh

hello people :smile: !

I’ve a droplet on DO in which there is a MONGODB instance. I can connect through the “ssh user@ip” command in OSX using the terminal, but if i want to connect it with Meteor(local) i need to do port forwarding with “ssh -L port:localhost:portserver user@ip -f -N” and use launch Meteor with --port. To access the MONGODB i removed the password so you can access only with the ssh and enabled a firewall as suggested on the DO guide.
My question is: Is there a way to connect Meteor(local) with MONGODB without using the ssh tunneling each time? Or make it run the command before the meteor starting?This app is going to be on the phone(Android) for personal use so it won’t go on production.
Second question: Is the ssh tunneling + port forwarding slower than connecting with user@password to MONGODB?
Third question: I’m going to use the ssh also for another mongoDB that will go in production, is it better to use user@password and connect using MONGO_URL var?

Thanks for the help! :slightly_smiling:

Have a look into DDP.connect(). It allows you to connect to a remote MongoDB instance (if its also running through Meteor, which i understand is a big if).

Unfortunately I’ve no experience in trying to SSH tunnel a remote mongo server into Meteor, sorry!