Change the Database Address of an existing Meteor App running on a Ubuntu Cloud Server - mongodb

I have a Meteor App running on a Ubuntu Droplet on Digital Ocean (your basic virtual machine). This app was written by a company that went out of business and left us with nothing.
The database is a MongoDB currently running on IBM Compose. Compose is shutting down in a month and the Database needs to be moved and our App needs to connect to the new database.
I had no issues exporting and creating a MongoDB with all the data on a different server.
I cannot for the life of me figure out where on the live Meteor App server I would change the address of the database connection. There is no simple top level config file where I can change this?? Does anyone out there know where I would do this?
I realize that in the long term I will need to either rewrite or deprecate this aging app, but in the short term the company relies on it and IBM decided to just shut down their Compose service so please help!!

There is mostly the MONGO_URL and MONGO_OPLOG_URL that are configured as environment variable: https://docs.meteor.com/environment-variables.html#MONGO-OPLOG-URL
Now you don't set these within the code but during deployment. If you are running on localhost and want to connect to the external MongoDb you can simply use:
$ MONGO_URL="mongodb://user:password#myserver.com:port" meteor
If you want to deploy the app, you should stick with the docs: https://galaxy-guide.meteor.com/mongodb.html#authentication
If you use MUP then configure the mongo appropriately: https://meteor-up.com/docs.html#mongodb
Edit: If your app was previously deployed using MUP you can try to restore the environment variables from /opt/app-name/config (where app-name is the name of your app) which contains env.list (including all environment variables; thus your MONGO_URL) and start.sh which you can use to recreate the mup.js config.

Related

Is there a method to link an external managed database to a dokku application?

I have been attempting to link a Digital Ocean managed database to an app I am running on one of their droplets, a VPS.
I have attempted creating a service with custom environment variables using the dokku postgres library found here but the DATABASE_URL is still incorrectly set and points to local addresses, not the externally hosted parameters I need set.
Is using --custom-env flag with the parameters gathered from DigitalOcean's control panel a correct way of doing this when creating the service with the following command
dokku postgres:create <service> [--create-flags...]
?
Is connecting to an external database with dokku even possible?
I am able to create local docker containers of postgres instances and link to those from the app without issue. I only have problems when I try to point to the external managed database service.
At this stage I am assuming this is an architectural issue that I am facing and am reassessing where I deploy my apps. Any pointers in the right direction are much appreciated! Thanks for reading.
I know you solved this for yourself, but in case anyone else stumbles on it (neither Dokku or DO makes it clear how to do this), the solution is to set an environment variable in Dokku using the "DATABASE_URL" key.
dokku config:set <app> DATABASE_URL="<your_DO_db_connection_string>"

How can we access Bluemix hosted "Compose for MongoDB" service from "outside"?

Situation:
Have created today a new Compose for MongoDB Service instance in Bluemix
Need:
I have to access this MongoDB DIRECTLY with tools (eg. Mongo Managemant Studio Pro, mongo.exe, etc.) for bulkloading, testing, ad-hoc data fix, etc.
Problem:
I have not found any docs, samples nor a CLEAR statement that
a) gives me some confirmation that THIS is possible
b) gives me COMPLETE information (not just some technical fragments that might have worked year ago) how to do it.
Maybe I am looking to the wrong places or do not know the right people. However I am stuck on this, and before quitting Bluemix MongoDB maybe somebody has a copy/past solution or handson step by step manual.
Any help welcome. Thanks!
Connecting to MongoDB service in Bluemix from an application is possible. For this answer I have used the application "Robo3T" and here are the steps:
Access your MongoDB Service on you Bluemix account. Usually under
"Cloud Foundry Services"
Open section "Manage", from "Connection Settings" copy from "HTTPS" the connection address and port. In this example "sl-eu-lon-2-portal.5.dblayer.com" and "20651"
In Robo3T create a new connection with the connection address from previous step
In tab Authentication configure database name, username and password
. The credentials are found as in step 1
From "Connection Settings" copy the SSL Certificate into a text file and save locally.
In Robo3T Add the certificate to the connection in the "SSL" tab
Test the connection and save the settings
Answer
YES, Bluemix hosted Compose for MongoDB instances can be connected from the mongo Shell and some updated DB Managment tools.
However, you have to make sure, that in case you are running the newest DB versions, that your tools (shell and DB management GUIs) comply with the newest DB features such as encryption etc.
Origin of the Problem
My problem was due to older and therefore incompatible versions of the mongo shell and DB-managment tools running against the newest MongoDB versions with their specialities on encription and multiple servers to be handled in the URI.
At least two DB managment tools are not compatible with the newest DB version and will take their time to get fixed. The problem is, that both will not tell you about this. They just do not not connect. No logs on either side. Period.
So my advise here: look for tool providers who express dedicated compliance with the specific version of your DB.
Advise to the Bluemix Team
It might not take much time to provide some sample connection strings for the most common tools like the mongo shell, MongoBooster, etc. to take the hassle and guesswork out of interpreting the Environment variables and figuring out what is needed for specific connection strings and what is not.
For instance MongoDB Atlas hosting provides for every cluster readymade connection strings for many tools you can just copy/past and done!
Connecting to Atlas took me 5 Minutes. For Bluemix I have lost hours! Not because it is complex, but because the documentation and the generated Info is somehow incomplete and messy - at least for the ones who do not connection strings for their living!

How use posgres or mongo databases in pcf-dev(pivotal cloudfoundry dev)?

dev (replacement of micro cloud foundry) I saw 3 services in marketplace mysql, redis and Rabbit, buy I need use mongo and postgres for my stuff, there is any easy way to add it in this deployment?
PCF Dev does not currently include support for MongoDB or Postgres service instances. It is also not currently possible to install tiles or BOSH releases.
All of these things may be supported eventually, but for now, you can run MongoDB or Postgres on your host system and create a user-provided service instance using the cf CLI.
Here's an example for Postgres: https://docs.tibco.com/pub/bwcf/1.0.0/doc/html/GUID-D7408016-8C7B-4637-BCC5-EDD9D5C52267.html
Note that you must use host.pcfdev.io instead of localhost to refer to the host system (instead of the PCF Dev VM). In the example above, your URL might look like:
url> postgresql://host.pcfdev.io:5432/postgres
(Also note that host.pcfdev.io may actually be host2.pcfdev.io if your system domain is local2.pcfdev.io instead of local.pcfdev.io)
~Stephen Levine, PCF Dev Product Manager

How To Manage Meteor App Running On AWS AMAZON EC2

I've deployed my Meteor App to AWS AMAZON EC2 in order to test my app in that environment including the newly configured domain name redirection etc...
Things did not work out perfectly when I tried to register a new user and when I tried to verify the email of the new user.
Given this scenario, I would like to reset the project or reset the users Collections in the mongodb of that Meteor App. Since I would like to be abel to reuse that email I use for testing.....
In my computer, when I encounter this problem I conveniently enter this command in my project's folder and I get the mongoldb reset:
meteor reset
How do I find where the app is in the EC2 instance the Meteor app is contained in???
After I ssh to the IP address with the paired key, I am allowed access to the instance, but when I do a ls I get nothing and don't know where to start....I was hoping I could just do a meteor reset or find where the mongodb is within that instance and delete the fields or collections I would like to delete.....
How do I achieve this?
How does one manage a Meteor app within this kind of environment such as AWS AMAZON EC2??
Thank you...
You need to refer to the "Accessing the database" section in mup docs.
https://github.com/arunoda/meteor-up#accessing-the-database
When logged to your EC2 instance, simply type mongo appName to access the mongo admin prompt.
Then you can use this command to clear the database in a similar way meteor reset would do :
db.dropDatabase();

(OpenShift) Sharing MongoDB between Apps not possible anymore?

There are articles both here and over at OpenShift itself that suggest I can configure an app with a MongoDB and then set envvars within other apps to access that DB
e.g.
How do you access a MongoDB database from two Openshift apps?
and
https://blog.openshift.com/sharing-database-across-applications/
Problem is that the envvars/hostname for the app DB is either "localhost" or a dotted-quad (129.xxx.xxx.xxx) which clearly won't (and actually doesn't - I tried it) work if used in a connection-string from another app (in the same OpenShift 'domain'
Is this something OpenShift have done to discourage this sort of usage? at least on the 'free' tier?? - or am I missing something/has anyone got this working atm???
p.s. using the actual connection string for the app (e.g. app-domain.rhcloud.com) doesn't work (even from an 'internally hosted' app)
You need to create the application as scalable, then add MongoDB for it to work correctly. MongoDB will then go onto it's own gear, with it's own ip address and port number (remember to use this port number, or nothing will work).
You will never be able to access your mongodb gear from outside of openshift without using the rhc port-forward command (https://developers.openshift.com/en/managing-port-forwarding.html) because of firewall & other security issues.
However, if you use the scaled application approach, you will be able to connect to your mongodb instance from other openshift online hosted applications.