Parse Server is a great platform for managing logins and storing data used by your apps in the cloud.
You can install and use parse server on many different cloud hosting providers, but setting up Parse Server on Heroku is one of the few ways you can try out and use it for free.
Additionally you can also install Parse Dashboard on Heroku for managing and viewing data on your Parse Server using a nice GUI.
Sources:
- https://devcenter.heroku.com/articles/deploying-a-parse-server-to-heroku
- https://www.codementor.io/nodejs/tutorial/deploy-parse-dashboard-on-heroku
Install Parse Server on Heroku (easy)
- Use Heroku’s helpful “deploy to Heroku” link for Parse: https://heroku.com/deploy?template=https://github.com/ParsePlatform/parse-server-example
- Type in a unique app name. You will need this in a bit.
- For config variables, change APP_ID and MASTER_KEY to your own unique values. For SERVER_URL change “yourappname” to whatever you picked for your App Name.
- Click the big Deploy button. A helpful build process will be displayed and your parse server should be ready to go in about 1 minute.
At this point you can start using your Parse Server with its standard SDKs and REST interface.
If you had any issues with the automated deployment, you can also use the manual process in the Heroku devcenter source link above. The only thing you will need to do is make sure you set the Master_Key and App_ID by going to your Config Variables under your Heroku app’s Settings tab, and adding “MASTER_KEY” and “APP_ID” variables.
Install Parse Dashboard on Heroku
- Install Node.js, Git and the Heroku Toolbelt on your machine.
- Run the following commands in your terminal/command line app. You can use whatever options you want for ‘npm init’.
mkdir my-parse-dashboard cd my-parse-dashboard git init npm init npm install --save parse-dashboard
This will create a git repository for the parse-dashboard code and download the required code.
- In my-parse-dashboard directory, create 2 text files (parse-dashboard-config.json and Procfile) to hold configuration data for Parse Dashboard.
{ "apps": [ { "serverURL": "https://parse-server38.herokuapp.com/parse", "appId": "parseServer38", "masterKey": "secretMasterKeySK$%@F09292", "appName": "My Parse Server App" } ], "users": [ { "user":"user1", "pass":"securePass281" } ] }
web: ./node_modules/.bin/parse-dashboard --config ./parse-dashboard-config.json --allowInsecureHTTP
- Commit all files to your git repository.
git add package.json Procfile parse-dashboard-config.json git commit -m "Initial Commit"
- Push repository to Heroku.
heroku login heroku create git push heroku master
- Deploy app in free tier and open it.
heroku ps:scale web=1 heroku open
- Use the username and password from the config file to login to Parse Dashboard.
You should now be able to use a GUI to view and manage your Parse Server.
Notes and Potential Errors
- Parse Dashboard: Application suffered an error. Check Logs.
- Use heroku logs command in terminal to view logs.
- This happened to me due to an error in parse-dashboard-config.json. Make sure all fields match what you configured when setting up Parse Server heroku app and look up syntax for further reference.
- Parse Dashboard: “Server not available” for Parse Server App.
- Occurred when I put in HTTP instead of HTTPS in the serverURL field in parse-dashboard-config.json.
- Use the following commands after making changes in parse-dashboard-config.json.
git add parse-dashboard-config.json git commit -m "updated blah blah" git push heroku master