Reputation: 405
hello I am working on Parse to AWS migration. I had installed MongoDB on EC2-Instance and Bitnami Parse Server on other EC2-Instance. And Migrated some dummy data from parse app to EC2-Instance of MongoDB.
but when I open
> http://ec2-**-***-***-***.compute-1.amazonaws.com/apps
and when i clik on "My Bitnami Parse API" it show a blank page...
this is my server.js file code :
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();
// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
databaseURI: "mongodb://dbuser:Pass@**.***.***.***:27017/dbname",
cloud: "./node_modules/parse-server/lib/cloud-code/Parse.Cloud.js",
appId: *******************************",
masterKey: "***********************************",
fileKey: "***********************************",
serverURL: 'http://ec2-**-***-***-***.compute-1.amazonaws.com:80/parse'
});
// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);
var port = 1337;
app.listen(port, function() {
console.log('parse-server running on port ' + port);
});
//Parse Dashboard
var ParseDashboard = require('parse-dashboard');
var dashboard = new ParseDashboard({
apps: [
{
appName: "My Bitnami Parse API",
appId: "***********************************",
masterKey: "***********************************",
fileKey: "***********************************",
production: true,
serverURL: 'http://ec2-**-***-***-***.compute-1.amazonaws.com:80/parse'
}
]
});
var allowInsecureHTTP = true;
// Serve the Parse Dashboard on the /parsedashboard URL prefix
app.use('/', dashboard);
var portdash = 4040;
app.listen(portdash, function() {
console.log('parse-dashboard running on port ' + portdash);
});
please tell me what I have done wrong that my database is not showing data here.
I already checked my MongoDB database it has the migrated data in it.
Upvotes: 0
Views: 787
Reputation: 3265
What you are perceiving is a Parse Dashboard which is unable to connect to your new MongoDB database. First of all, did you check that, in this line, the MongoDB host specified (Together with the credentials) is correct?
databaseURI: "mongodb://dbuser:Pass@**.***.***.***:27017/dbname"
Second of all, as already specified here, you have to allow connections to mongoDB incoming from your parse machine towards your MongoDB database, which is achieved in AWS through Security Groups.
You can check if those two things are alright via executing this in your parse machine:
/opt/bitnami/mongodb/bin/mongo -udbuser -pPass --host mongoDBHost dbname
where dbuser
, Pass
, dbname
and mongoDBHost
should be changed by the actual values. After executing that, you should get something like:
bitnami@ip-172-31-36-170:~$ mongo -uroot -pXXXX --host 127.0.0.1 --port 27017 bitnami_parse
MongoDB shell version: 3.0.9
connecting to: 127.0.0.1:27017/bitnami_parse
>
If, instead, you got something like:
bitnami@ip-172-31-36-170:~$ mongo -uroot -pXXXX --host 128.0.0.1 --port 27017 bitnami_parse
MongoDB shell version: 3.0.9
connecting to: 128.0.0.1:27017/bitnami_parse
2016-09-19T13:30:28.456+0000 W NETWORK Failed to connect to 128.0.0.1:27017, reason: errno:111 Connection refused
2016-09-19T13:30:28.457+0000 E QUERY Error: couldn't connect to server 128.0.0.1:27017 (128.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:181:14)
at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed
Then, it would mean that the previous steps must be rechecked.
Finally, did you migrate all the data in the default MongoDB database to the new one?
Let me know if none of this worked; it would be quite weird though.
Good luck! :)
PS: Remember that we're running that server.js script with forever
so as to ensure it's being run all the time. If you perform changes to it you must execute sudo /opt/bitnami/ctlscript.sh restart parse
in order to get those changes taken into account. In case issues arise (because of bad formatting... etc), check forever
logs.
Upvotes: 2