Git Product home page Git Product logo

heroku-buildpack-ember-builder's Introduction

Heroku Buildpack for executing and deploying Ember CLI apps as part of another app

This buildpack's purpose is to install node and ember-cli to enable deploying ember apps as part of another app. Say you've got a Laravel or a Rails app and you need to deploy the ember build to the public files path. This is the buildpack for you. It doesn't configure any webserver instances, just fetches the necessary dependencies and executes the required ember build commands to deploy your emberapp.

Forked from heroku-buildpack-ember-cli.

Usage

Typically this will be included as an additional buildpack. So configure your heroku app like normally, then add this top the top of the buildpack list.

$ heroku buildpacks:add --app your-app-name --index 1 https://github.com/imipolexg/heroku-buildpack-ember-builder

Configuration

You'll need to set a few environment variables fort his to work.

Ember app root

You'll need to specifiy the relative path of your Emberapp within your git repo. So if your emberapp's package.json is stored in resources/emberapp/package.json do:

$ heroku config:set EMBER_ROOT="resources/emberapp"

Build environment

$ heroku config:set EMBER_ENV=production

Before and After Hooks

Have the buildpack run your own scripts before and after the ember build by creating a hooks/before_hook.sh or hooks/after_hook.sh file in your Ember application root:

$ mkdir -p hooks

For a before build hook edit hooks/before_hook.sh, and for an after build hook, edit hooks/after_hook.sh.

These scripts are sourced by the compile script, not executed, so they don't need the executable bit set. They will 'inherit' all the environment variables set up in the compile script, so read through that if you want to get your bearings.

Force Rebuilds

Sometimes it is necessary to rebuild NPM modules or Bower dependencies from scratch. This can become necessary when updating Ember or EmberCLI midway through a project and cleaning the Bower and NPM caches doesn't always refresh the cache in the Dyno during the next deployment. In those cases, here is a simple and clean way to force a rebuild.

To force a rebuild of NPM modules and Bower dependencies:

heroku config:set REBUILD_ALL=true
git commit -am 'rebuild' --allow-empty
git push heroku master
heroku config:unset REBUILD_ALL

To force a rebuild of just the NPM modules:

heroku config:set REBUILD_NODE_PACKAGES=true
git commit -am 'rebuild' --allow-empty
git push heroku master
heroku config:unset REBUILD_NODE_PACKAGES

To force a rebuild of Bower dependencies:

heroku config:set REBUILD_BOWER_PACKAGES=true
git commit -am 'rebuild' --allow-empty
git push heroku master
heroku config:unset REBUILD_BOWER_PACKAGES

Caching

The Ember CLI buildpack caches your NPM and Bower dependencies by default. This is similar to the Heroku Buildpack for Node.js. This makes typical deployments much faster. Note that dependencies like components/ember#canary will not be updated on each deploy.

To purge the cache and reinstall all dependencies, run:

$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:purge_cache -a APPNAME

Troubleshooting

Clean your project's dependencies:

$ npm cache clear
$ bower cache clean
$ rm -rf node_modules bower_components
$ npm install --no-optional
$ bower install

Be sure to save any Bower or NPM resolutions. Now, let's build your Ember CLI application locally:

$ ember build

Check your git status and see if that process has made any changes to your application's code. Now, try your Heroku deployment again.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Contributors

This buildpack is a fork of heroku-buildpack-ember-cli, which made it quite easy to hack this variation up. Thanks to everyone who worked on that.

heroku-buildpack-ember-builder's People

Contributors

aaronrenner avatar achambers avatar adriaandotcom avatar aortbals avatar beerlington avatar brettchalupa avatar byrnedo avatar csantero avatar gabklein avatar himynameisjonas avatar john-griffin avatar jordpo avatar jrjohnson avatar jzempel avatar kenglxn avatar koriroys avatar kuinak avatar mattmcginnis avatar meltingice avatar quinnlee avatar robguilfoyle avatar sandnap avatar sbl avatar tonycoco avatar wcurtis avatar zacharyhamm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.