Deploy monorepo in single app on Heroku

  • Modifié il y à1 an 
  • Temps de lecture :1Minute

description : NodeJS App Web and Worker process type


Requirements:

assume that your have a monorepo folder tree like this:

root(monorepo)--webapp
----app.js
----package.json
--workerapp
----app.js
----package.json

In your monorepo root create .buildpacks file

webapp=https://github.com/heroku/heroku-buildpack-nodejs.git
workerapp=https://github.com/heroku/heroku-buildpack-nodejs.git

Add a Procfile

In root folder.

web: cd webapp && npm start
worker: cd workerapp && npm start

Create an app  on heroku and set up git in your monorepo folder

Add Buildpack config in your  settings

https://github.com/negativetwelve/heroku-buildpack-subdir

Git push heroku master

Scale your web et worker

heroku ps:scale web=1 worker=1

Laisser un commentaire