Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy parse dashboard to heroku

I have deployed the parse server on heroku (https://github.com/ParsePlatform/parse-server) but can't find anything to deploy the parse dashboard on heroku. Any reference is appreciated!!

like image 925
user360 Avatar asked Mar 20 '16 22:03

user360


People also ask

How do I deploy files to Heroku?

To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.

Can we deploy API on Heroku?

Deploying API Platform applications on Heroku is straightforward and you will learn how to do it in this tutorial. Note: this tutorial works perfectly well with API Platform but also with any Symfony application based on the Symfony Standard Edition. If you don't already have one, create an account on Heroku.


2 Answers

You shouldn't have to clone the parse-dashboard repository. Here is a better way using parse-dashboard as a node module.

  1. Create a new node app:

    mkdir my-parse-dashboard
    cd my-parse-dashboard
    npm init
    

    Fill out the details it asks for.

  2. Create a git repository:

    git init
    

    Additionally you can push this git repository to a remote server (e.g. Bitbucket). Note this repository should be private since it will contain your master key.

  3. Install the parse-dashboard package:

    npm install parse-dashboard --save
    
  4. Create an index.js file with the following line:

    require('parse-dashboard/Parse-Dashboard/index.js');
    
  5. Create a parse-dashboard-config.json file which looks like this:

    {
      "apps": [
        {
          "serverURL": "your parse server url",
          "appId": "your app Id",
          "masterKey": "your master key",
          "appName": "My Parse App"
        }
      ],
      "users": [
        {
          "user":"username",
          "pass":"password"
        }
      ]
    }
    
  6. Update your package.json file and add this section (or modify it if it already exists):

      "scripts": {
        "start": "node ./index.js --config ./parse-dashboard-config.json --allowInsecureHTTP=1"
      }
    

    Note: The allowInsecureHTTP flag seems to be required on Heroku. Thanks to @nsarafa for this.

  7. Commit all your changes and merge them into master.
  8. Create a new Heroku app: heroku apps:create my-parse-dashboard
  9. Run git push heroku master to deploy your app to Heroku.

Remember to generate a strong password as your dashboard is accessible to anyone on the internet. And make the dashboard only accessible through SSL else your password will be sent in clear text. Read this tutorial on how to force all traffic over SSL on Heroku with Cloudflare for your domain.

like image 179
Kostub Deshmukh Avatar answered Oct 27 '22 19:10

Kostub Deshmukh


I just managed to get this working. Here are the steps I took.

  1. Clone parse-dashboard to your local machine.
  2. Run npm install inside that directory.
  3. Update package.json and change the "start" script to:

    "start": "node ./Parse-Dashboard/index.js --config ./Parse-Dashboard     /parse-dashboard-config.json --allowInsecureHTTP=1" 
    

    (Thanks to nsarafa's answer above for that).

  4. Edit your .gitignore file and remove the following three lines:

    bundles/Parse-Dashboard/public/bundles/Parse-Dashboard/parsedashboard-config.json
    
  5. Edit your config file in Parse-Dashboard/parse-dashboard-config.json, making sure URLs and keys are correct. Here is an example :

    {
    "apps": [
      {
        "serverURL": "https://dhowung-fjird-52012.herokuapp.com/parse",
        "appId": "myAppId",
        "masterKey": "myMasterKey",
        "appName": "dhowung-fjird-40722"
      }
     ],
    "users": [
      {
       "user":"myUserName",
       "pass":"Str0ng_?Passw0rd"
      }
     ]
    }
    
  6. Remove the cache from your heroku parse server app :

     heroku config:set NODE_MODULES_CACHE=false --app yourHerokuParseServerApp 
    

    if we follow the example above

     yourHerokuParseServerApp = dhowung-fjird-40722 
    

    (Again, thanks to nsarafa).

  7. Add, commit and push your changes.

  8. Deploy to Heroku again using their CLI or the dashboard.

Step 4 was the key for me because I wasn't committing my config file, and it took me a while to realise.

Also, as stated above, make sure you have user logins and passwords in your config file, following the parse-dashboard docs:

PS: on your heroku parse server make sure your SERVER_URL looks like this https://yourHerokuParseServerAppName.herokuapp.com/parse

like image 40
Adam Colvin Avatar answered Oct 27 '22 19:10

Adam Colvin