GithubHelp home page GithubHelp logo

carlosfunk / heroku-buildpack-angular-spa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from madeintandem/heroku-buildpack-angular-spa

0.0 1.0 0.0 221 KB

Buildpack for Heroku with Angular and Nginx

License: MIT License

Shell 65.77% Ruby 2.37% HTML 31.85%

heroku-buildpack-angular-spa's Introduction

Heroku Buildpack for Angular Applications

This buildpack will work out-of-the-box with Angular applications. It installs node, nginx and generates a production build with Gulp.

Thanks to our own Tony Coconate for his work on a custom buildpack for Ember CLI, which this is heavily entirely based on.

Usage

Creating a new Heroku instance from an Angular application's parent directory:

$ heroku create --buildpack https://github.com/devmynd/heroku-buildpack-angular-spa.git

$ git push heroku master
...
-----> Heroku receiving push
-----> Fetching custom buildpack
...

Configuration

Variables

You can set a few different environment variables to turn on features in this buildpack.

Nginx Workers

Set the number of workers for Nginx (Default: 4):

heroku config:set NGINX_WORKERS=4

API Proxy

Set an API proxy URL:

heroku config:set API_URL=http://api.example.com/

Set your API's prefix path (Default: /api/):

heroku config:set API_PREFIX_PATH=/api/

Note that the trailing slashes are important. For more information about API proxies and avoiding CORS, read this.

Authentication

Have a staging server? Want to protect it with authentication? When BASIC_AUTH_USER and BASIC_AUTH_PASSWORD are set basic authentication will be activated:

heroku config:set BASIC_AUTH_USER=EXAMPLE_USER
heroku config:set BASIC_AUTH_PASSWORD=EXAMPLE_PASSWORD

Be sure to use https when you set this up for added security.

Force HTTPS

For most Ember applications that make any kind of authenticated requests (sending an auth token with a request for example), HTTPS should be used. Enable this feature in nginx by setting FORCE_HTTPS.

heroku config:set FORCE_HTTPS=true

Custom

Need to make a custom nginx configuration change? No problem. In your Angular application, add a config/nginx.conf.erb file. You can copy the existing configuration file in this repo and make your changes to it.

Caching

The Angular buildpack caches your npm and bower dependencies be default. This is similar to the Heroku Buildpack for Node.js. This makes typical deployments much faster.

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

heroku-buildpack-angular-spa's People

Contributors

aevin1387 avatar spra85 avatar

Watchers

Carl 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.