# http://guides.codepath.com/android/Configuring-a-Parse-Server
# Click on the Deploy button to create a Parse App
# set up App Name and use that for APP_ID and SERVER_URL, which is http://FAKE_APP_ID.herokuapp.com/parse
# MASTER_KEY is a secret key
curl -X POST \
-H "X-Parse-Application-Id: FAKE_APP_ID" \
-H "Content-Type: application/json" \
-d '{}' \
https://FAKE_APP_ID.herokuapp.com/parse/functions/hello
curl -X POST -H "X-Parse-Application-Id: FAKE_APP_ID" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
https://FAKE_APP_ID.herokuapp.com/parse/classes/GameScore
curl -X GET -H "X-Parse-Application-Id: FAKE_APP_ID" \
-H "Content-Type: application/json" \
https://FAKE_APP_ID.herokuapp.com/parse/classes/GameScore
curl -X GET -H "X-Parse-Application-Id: FAKE_APP_ID" \
-H "X-Parse-Master-Key: FAKE_MASTER_KEY" \
https://FAKE_APP_ID.herokuapp.com/parse/classes/GameScore
# get MONGODB_URI from https://dashboard.heroku.com/apps/FAKE_APP_ID/settings
mongo MONGODB_URI
sudo ln -s /usr/bin/nodejs /usr/bin/node
node -v
# make sure it is >= 4.3
# if not >= 4.3, try this
sudo apt update
sudo apt upgrade
sudo apt install node
# if still not >= 4.3, try this
# https://github.com/nodesource/distributions#debinstall
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
# make sure it is >= 4.3
npm install -g parse-dashboard
parse-dashboard --appId FAKE_APP_ID --masterKey FAKE_MASTER_KEY --serverURL "https://FAKE_APP_ID.herokuapp.com/parse"
# https://www.codementor.io/nodejs/tutorial/deploy-parse-dashboard-on-heroku
mkdir my-parse-dashboard
cd my-parse-dashboard
# initialize git or clone this repository
git init
npm init
npm install --save parse-dashboard
# modify parse-dashboard-config.json
git add package.json Procfile parse-dashboard-config.json
git commit -m "My First Commit"
heroku login
heroku create
git push heroku master
heroku ps:scale web=1
heroku open
# use http instead of https
# https needs https://letsencrypt.org/ or https://startssl.com/
http://xxx-brushlands-xxx.herokuapp.com/
Parse Dashboard is a standalone dashboard for managing your Parse apps. You can use it to manage your Parse Server apps and your apps that are running on Parse.com.
- Getting Started
- Local Installation
- Running as Express Middleware
- Deploying Parse Dashboard
- Contributing
Node.js version >= 4.3 is required to run the dashboard. You also need to be using Parse Server version 2.1.4 or higher.
Install the dashboard from npm
.
npm install -g parse-dashboard
You can launch the dashboard for an app with a single command by supplying an app ID, master key, URL, and name like this:
parse-dashboard --appId yourAppId --masterKey yourMasterKey --serverURL "https://example.com/parse" --appName optionalName
You may set the host, port and mount path by supplying the --host
, --port
and --mountPath
options to parse-dashboard. You can use anything you want as the app name, or leave it out in which case the app ID will be used.
After starting the dashboard, you can visit http://localhost:4040 in your browser:
You can also start the dashboard from the command line with a config file. To do this, create a new file called parse-dashboard-config.json
inside your local Parse Dashboard directory hierarchy. The file should match the following format:
{
"apps": [
{
"serverURL": "http://localhost:1337/parse",
"appId": "myAppId",
"masterKey": "myMasterKey",
"appName": "MyApp"
}
]
}
You can then start the dashboard using parse-dashboard --config parse-dashboard-config.json
.
This only works when starting the app using the
parse-dashboard
command
There are also two methods you can use to configure the dashboard using environment variables.
Provide the entire JSON configuration in PARSE_DASHBOARD_CONFIG
and it will be parsed just like the config file.
You can also define each configuration option individually.
HOST: "0.0.0.0"
PORT: "4040"
MOUNT_PATH: "/"
PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: undefined // Or "1" to allow http
PARSE_DASHBOARD_SERVER_URL: "http://localhost:1337/parse"
PARSE_DASHBOARD_MASTER_KEY: "myMasterKey"
PARSE_DASHBOARD_APP_ID: "myAppId"
PARSE_DASHBOARD_APP_NAME: "MyApp"
PARSE_DASHBOARD_USER_ID: "user1"
PARSE_DASHBOARD_USER_PASSWORD: "pass"
PARSE_DASHBOARD_SSL_KEY: "sslKey"
PARSE_DASHBOARD_SSL_CERT: "sslCert"
PARSE_DASHBOARD_CONFIG: undefined // Only for reference, it must not exist
Managing multiple apps from the same dashboard is also possible. Simply add additional entries into the parse-dashboard-config.json
file's "apps"
array.
You can manage self-hosted Parse Server apps, and apps that are hosted on Parse.com from the same dashboard. In your config file, you will need to add the restKey
and javascriptKey
as well as the other paramaters, which you can find on dashboard.parse.com
. Set the serverURL to http://api.parse.com/1
:
{
"apps": [
{
"serverURL": "https://api.parse.com/1", // Hosted on Parse.com
"appId": "myAppId",
"masterKey": "myMasterKey",
"javascriptKey": "myJavascriptKey",
"restKey": "myRestKey",
"appName": "My Parse.Com App",
"production": true
},
{
"serverURL": "http://localhost:1337/parse", // Self-hosted Parse Server
"appId": "myAppId",
"masterKey": "myMasterKey",
"appName": "My Parse Server App"
}
]
}
Parse Dashboard supports adding an optional icon for each app, so you can identify them easier in the list. To do so, you must use the configuration file, define an iconsFolder
in it, and define the iconName
parameter for each app (including the extension). The path of the iconsFolder
is relative to the configuration file. If you have installed ParseDashboard globally you need to use the full path as value for the iconsFolder
. To visualize what it means, in the following example icons
is a directory located under the same directory as the configuration file:
{
"apps": [
{
"serverURL": "http://localhost:1337/parse",
"appId": "myAppId",
"masterKey": "myMasterKey",
"appName": "My Parse Server App",
"iconName": "MyAppIcon.png",
}
],
"iconsFolder": "icons"
}
You can set appNameForURL
in the config file for each app to control the url of your app within the dashboard. This can make it easier to use bookmarks or share links on your dashboard.
To change the app to production, simply set production
to true
in your config file. The default value is false if not specified.
Instead of starting Parse Dashboard with the CLI, you can also run it as an express middleware.
var express = require('express');
var ParseDashboard = require('parse-dashboard');
var dashboard = new ParseDashboard({
"apps": [
{
"serverURL": "http://localhost:1337/parse",
"appId": "myAppId",
"masterKey": "myMasterKey",
"appName": "MyApp"
}
]
});
var app = express();
// make the Parse Dashboard available at /dashboard
app.use('/dashboard', dashboard);
var httpServer = require('http').createServer(app);
httpServer.listen(4040);
If you want to run both Parse Server and Parse Dashboard on the same server/port, you can run them both as express middleware:
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var ParseDashboard = require('parse-dashboard');
var allowInsecureHTTP = false
var api = new ParseServer({
// Parse Server settings
});
var dashboard = new ParseDashboard({
// Parse Dashboard settings
}, allowInsecureHTTP);
var app = express();
// make the Parse Server available at /parse
app.use('/parse', api);
// make the Parse Dashboard available at /dashboard
app.use('/dashboard', dashboard);
var httpServer = require('http').createServer(app);
httpServer.listen(4040);
Make sure the server URLs for your apps can be accessed by your browser. If you are deploying the dashboard, then localhost
urls will not work.
In order to securely deploy the dashboard without leaking your apps master key, you will need to use HTTPS and Basic Authentication.
The deployed dashboard detects if you are using a secure connection. If you are deploying the dashboard behind a load balancer or proxy that does early SSL termination, then the app won't be able to detect that the connection is secure. In this case, you can start the dashboard with the --allowInsecureHTTP=1
option. You will then be responsible for ensureing that your proxy or load balancer only allows HTTPS.
You can configure your dashboard for Basic Authentication by adding usernames and passwords your parse-dashboard-config.json
configuration file:
{
"apps": [{"...": "..."}],
"users": [
{
"user":"user1",
"pass":"pass"
},
{
"user":"user2",
"pass":"pass"
}
]
}
You can store the password in either plain text
or bcrypt
formats. You can encrypt the password using any online bcrypt tool e.g. https://www.bcrypt-generator.com.
If you have configured your dashboard to manage multiple applications, you can restrict the management of apps based on user identity.
To do so, update your parse-dashboard-config.json
configuration file to match the following format:
{
"apps": [{"...": "..."}],
"users": [
{
"user":"user1",
"pass":"pass1",
"apps": [{"appId": "myAppId1"}, {"appId": "myAppId2"}]
},
{
"user":"user2",
"pass":"pass2",
"apps": [{"appId": "myAppId1"}]
} ]
}
The effect of such a configuration is as follows:
When user1
logs in, he/she will be able to manage myAppId1
and myAppId2
from the dashboard.
When user2
logs in, he/she will only be able to manage myAppId1
from the dashboard.
It is easy to use it with Docker. First build the image:
docker build -t parse-dashboard .
Run the image with your config.json
mounted as a volume
docker run -d -p 8080:4040 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard
By default, the container will start the app at port 4040 inside the container. However, you can run custom command as well (see Deploying in production
for custom setup).
In this example, we want to run the application in production mode at port 80 of the host machine.
docker run -d -p 80:8080 -v host/path/to/config.json:/src/Parse-Dashboard/parse-dashboard-config.json parse-dashboard --port 8080
If you are not familiar with Docker, --port 8080
will be passed in as argument to the entrypoint to form the full command npm start -- --port 8080
. The application will start at port 8080 inside the container and port 8080
will be mounted to port 80
on your host machine.
We really want Parse to be yours, to see it grow and thrive in the open source community. Please see the Contributing to Parse Dashboard guide.