How to deploy parse dashboard to heroku

后端 未结 3 900
眼角桃花
眼角桃花 2020-12-14 11:20

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

相关标签:
3条回答
  • 2020-12-14 11:43

    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

    0 讨论(0)
  • 2020-12-14 11:49

    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.

    0 讨论(0)
  • 2020-12-14 11:59
    1. Update brew brew update
    2. Install heroku-cli brew install heroku-toolbelt
    3. Login via command line with your heroku credentials heroku login
    4. Make sure your app is there heroku list and note YOURHEROKUAPPSNAME containing the parse-dashboard deployment
    5. Tell Heroku to ignore the cache from previous deploys heroku config:set NODE_MODULES_CACHE=false --app YOURHEROKUAPPSNAME
    6. Go to your package.json and change start: node ./Parse-Dashboard/index.js to start node./Parse-Dashboard/index.js --config ./Parse-Dashboard/parse-dashboard-config.json --allowInsecureHTTP=1"
    7. Delete your Procfile rm Procfile
    8. Add, commit and merge to your master branch
    9. Run git push heroku master

    The start script inside your package.json overrides whatever you declare inside of the Procfile. This process should enable a clean deploy to Heroku. Please be cautious and generate user logins with strong passwords before performing this deployment per the parse-dashboard documentation.

    0 讨论(0)
提交回复
热议问题