Ember -> Heroku

After you’ve created a Ember-Cli app, create a Procfile, it will tell Heroku what to do when your application starts.

“Procfile is a mechanism for declaring what commands are run by your application’s dynos on the Heroku platform.”

touch Procfile

In Procfile.

web: ember serve --port $PORT --live-reload=false

In package.json make sure you have something like the following.

Note: the Ember team is depreciating Bower moving forward but Heroku is happy with it for the moment. This will install dependencies.

"scripts": {
    "start": "ember server",
    "build": "ember build",
    "test": "ember test",
    "postinstall": "./node_modules/bower/bin/bower install"
  },

Change the package.json node “devDependencies” to “dependencies” or change the Heroku config to use the Dev Dependencies with the following line.

heroku config:set NPM_CONFIG_PRODUCTION=false

If you are using external resources, in config/environment.js, do something like the following to get things running and then strip it back.

Note: use relative protocols to avoid mixed content issues.

“mixed content was loaded over HTTPS, but requested an insecure script”

Caution! This is for a TEST application that uses external javascript, fonts, images and stylesheets.

ENV.contentSecurityPolicy = {

    'default-src': "'self'",
    'script-src': "'self' http://localhost:4200 'unsafe-eval' * 'unsafe-inline' *",
    'font-src': "'self' 'unsafe-eval' * 'unsafe-inline' *",
    'connect-src': "'self'",
    'img-src': "'self' 'unsafe-eval' * 'unsafe-inline' *",
    'style-src': "'self' 'unsafe-eval' * 'unsafe-inline' *",
    'media-src': "'self'"
  }

Leave a Reply

Your email address will not be published. Required fields are marked *