Giter Club home page Giter Club logo

chicagoboss-on-heroku's Introduction

Running ChicagoBoss (erlang web framework) on Heroku

N.B. This process was an initial attempt and is subject to change :)

To create a new project from scratch:

  1. Create a top level project directory. Add an empty ebin/ directory. (N.B. also create a dummy file to commit to git)

  2. Create a new heroku instance:

    $ git init
    $ heroku create --stack cedar
    $ heroku config:add BUILDPACK_URL=http://github.com/heroku/heroku-buildpack-erlang.git
    
  3. Add ChicagoBoss as git submodule (also repeat for cb_admin if required)

    $ git submodule add https://github.com/evanmiller/ChicagoBoss.git ChicagoBoss
    
  4. Create app

    $ cd ChicagoBoss; make; make app PROJECT=myapp
    
  5. Add Procfile, run.sh from this project - edit project name in run.sh

  6. Edit myapp/init.sh - add the following sections: (running erl with the -sname param causes heroku startup to fail)

    'start-standalone')
           # Start Boss in production mode with no -sname parameter
           echo "starting boss in production mode..."
           START=$(./rebar boss c=start_cmd|grep -v "==>"|perl -pe 's/-sname\s+\S+//')
           $START
           ;;
    
     'start-dev-standalone')
           # Start Boss in development mode
           START_DEV=$(./rebar boss c=start_dev_cmd|grep -v "==>"|perl -pe 's/-sname\s+\S+//')
           $START_DEV
           ;;
    
  7. Edit myapp/boss.config change boss path line to:

    {path, "../ChicagoBoss"},
    

    change port line to:

    {port, {env, "PORT"}},
    

    N.B. above currently requires ChicagoBoss HEAD to work

  8. Deploy!

    $ git add .; git push heroku master
    

A few caveats:

  • This is based on using the heroku supplied erlang buildpack at: https://github.com/heroku/heroku-buildpack-erlang

  • A better solution would be to modify the buildpack to build CB at the compile stage (as opposed to the run stage)

  • As such, the above solution may crash at the first deploy due to the app not starting within 60secs. Run:

    $ heroku logs -t
    

    in a seperate window to keep an eye on the deployment/startup process.

Heroku specific stuff:

$ heroku info

within a project will display info about the current project (app url, git url etc)

chicagoboss-on-heroku's People

Contributors

vorn avatar

Watchers

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