I have deployed 2 Ubuntu servers on Azure. First, I have installed the Parse Server and the second, I installed MongoDB. (I have also put a ready db there)
Everything works fine! Both Parse Server and MongoDB server. They also communicate well. The thing is, when I try to connect to my dashboard - http://IP:4040/dashboard - it throws the error Server not reachable: unable to connect to server.
Here's what I have on my index.js:
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var ParseDashboard = require('parse-dashboard');
var allowInsecureHTTP = true;
var path = require('path');
var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;
if (!databaseUri) {
console.log('DATABASE_URI not specified, falling back to localhost.');
}
//process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://IP:27017/db',
cloud: './cloud/main.js',
appId: process.env.APP_ID || 'xxx',
masterKey: process.env.MASTER_KEY || 'xxx', //Add your master key here. Keep it secret!
fileKey: 'xxx',
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
// Enable email verification
verifyUserEmails: false,
// The public URL of your app.
// This will appear in the link that is used to verify email addresses and reset passwords.
// Set the mount path as it is in serverURL
publicServerURL: 'http://localhost:1337/parse',
});
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
// javascriptKey, restAPIKey, dotNetKey, clientKey
var app = express();
// Serve static assets from the /public folder
app.use('/public', express.static(path.join(__dirname, '/public')));
// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
res.status(200).send('Make sure to star the parse-server repo on GitHub!');
});
// There will be a test page available on the /test path of your server url
// Remove this before launching your app
app.get('/test', function(req, res) {
res.sendFile(path.join(__dirname, '/public/test.html'));
});
var port = process.env.PORT || 1337;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});
// Set up parse dashboard
var config = {
"allowInsecureHTTP": true,
"apps": [
{
"serverURL": "http://localhost:1337/parse",
"appId": "xxx",
"masterKey": "xxx",
"appName": "name",
"production": true
}
],
"users": [
{
"user":"username",
"pass":"pass"
}
]
};
var dashboard = new ParseDashboard(config, config.allowInsecureHTTP);
var dashApp = express();
// make the Parse Dashboard available at /dashboard
dashApp.use('/dashboard', dashboard);
// Parse Server plays nicely with the rest of your web routes
dashApp.get('/', function(req, res) {
res.status(200).send('Parse Dashboard App');
});
var httpServerDash = require('http').createServer(dashApp);
httpServerDash.listen(4040, function() {
console.log('dashboard-server running on port 4040.');
});
// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);
And this is my package.json:
{
"name": "parse-server-example",
"version": "1.4.0",
"description": "An example Parse API server using the parse-server module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-server-example"
},
"license": "MIT",
"dependencies": {
"express": "~4.11.x",
"kerberos": "~0.0.x",
"parse": "~1.8.0",
"parse-server": "~2.6.3",
"parse-dashboard": "~1.1.0"
},
"scripts": {
"start": "node index.js"
},
"engines": {
"node": ">=4.3"
}
}
I also have opened the ports needed from Azure dashboard. Any ideas on what's wrong? I've searched and searched, but without luck.
If you are able to see this "Server not reachable: unable to connect to server" inside your dashboard console its mean . your dashboard is not able to communicate to DB.
@agwl-saurabh But parse server communicates with the db! Since the db is on a remote server, do I need to configure anything on the dashboard?
I just changed my serverURL inside the dashboard config, from http://localhost:1337/parse to http://ip:1337/parse and it worked! Why is that?
Parse have three layers. 1st dashboard second parse server third mongo. so parse dashboard needs parse server URL AppID,masterKey to show you the data of your app. its does not show data directly from mongo
Yeah but why wasn't it working with localhost?
what is this query..?? i think you are not able to explain properly. localhost means you are running on local machine. if your server are on some ip you need ip its very simple.
I'm running with 3 docker containers (using docker compose with a file similar to this)
For the Parse Dashboard, I pass in a config file where it specifies the serverURL. If I use the IP Address of the Parse Server container (http://X.X.X.3:1337/parse) or the service name (http://parse:1337/parse), Parse Dashboard doesn't seem to work. If I change the serverURL to http://localhost:1337, all seems fine. Maybe I'm missing something here or don't quite understand it, but I would have figured that using the IP address of the Parse Server container would have worked.
Any thoughts on this?
I'm having a similar problem, I've launched Parse Server via heroku using the "parse button" and tried to launch the dashboard as well as a separate app but I get the same error 'Server not reachable: unable to connect to server'. Has there been any further progress on this issue
@Samigos now? why?
@thomasMinshull the serverURL should be the public server URL of your parse-server. This issue arises when parse-dashboad is unable to communicate with parse-server, which is either when
The dashboard is a web app, therefore it runs in your browser. Specifying localhost in the serveruRL configuration means the machine your web browser is currently running on.
This is easily solved by checking your configuration, ensuring your parse-server is publicly accessible.
Usually, you should use the same parameters as your iOS / Android clients for the serverURL.
Most helpful comment
I just changed my serverURL inside the dashboard config, from
http://localhost:1337/parsetohttp://ip:1337/parseand it worked! Why is that?