Giter VIP home page Giter VIP logo

heroku-buildpack-ruby-monorepo's Introduction

heroku-buildpack-ruby-monorepo

This is a Heroku Buildpack for Ruby, Rack, and Rails apps which are not in top-level of the repository. It relies on unchanged Heroku Buildpack for Ruby under the hood.

Synopsis

Let's say you have following repository structure:

.
├── ecommerce
│   ├── crm
│   ├── ordering
│   ├── payments
│   ├── pricing
│   └── product_catalog
└── rails_application
    ├── Gemfile
    ├── Gemfile.lock
    ├── Rakefile
    ├── app
    ├── bin
    ├── config
    ├── config.ru
    ├── db
    ├── lib
    ├── log
    ├── public
    ├── test
    ├── tmp
    └── vendor

There's a Rails application under rails_application/. There's also ecommerce/ — a bunch of components this app relies on, but not the other way round.

Now, you want to promote rails_application/ to Heroku dyno:

  • pushing subdirectory via git subtree push --prefix rails_application heroku master would cut you off from the component dependencies

  • same issue with other popular monorepo buildpacks, which only promote chosen subdirectory to root

  • packaging and distributing components as gems introduces burden when introducing changes and releasing them, quickly defeating benefits of the monorepo

  • collapsing everything into a single, top-level package/bundle just for the deployment simply makes production debugging much worse

Luckily with this buildpack, there's no need for compromises!

Tell it where your application lives via APP_DIR variable and it will do the rest:

  • preserve exactly the same directory structure on Heroky dyno

  • execute stock, up-to-date Ruby buildpack at the application root

  • ensure $PATH and $GEM_PATH are aware of given application root

  • copy Procfile from application root to top-level directory, making necessary path changes so that Heroku recognizes avaiable process types and can instantly run web

So what do you have to do to use it?

Set it as your only buildpack first:

heroku buildpacks:set https://github.com/arkency/heroku-buildpack-ruby-monorepo

Let it know, where the application is:

heroku config:set APP_DIR=rails_application

Known limitations

After all it is not a very sophisticated Heroku buildpack.

heroku-buildpack-ruby-monorepo's People

Contributors

mostlyobvious avatar tomaszwro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

heroku-buildpack-ruby-monorepo's Issues

PNPM Support

Heroku now supports PNPM - this buildpack should too. PNPM is great with monorepos.

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.