I have a web app which I setup the continuous deployment from github. However I'm planning to add some worker roles to this app and I'm wondering couple of things. I'm using Node.js.
In my mind, I had the design like:
So my questions are?
/web
and /worker
folders in the root which have different app.js
and package.json
files so I have them in the same repo, but their dependencies are managed differently. How can I make this work when deploying to Heroku? Looks like this is entirely possible. All you need to do is have a global package.json
file to manage your dependencies (you can't manage separate dependencies with worker and web role). If the package.json
is not enough to make heroku detect that you're using Node.Js
which was a problem I've faced; add the buildpack of heroku/nodejs
and you should be ok. Whatever buildpack is installed, it will be available on the worker role.
Regarding the different directories, this is what I have now:
/web
/worker
/package.json
/Procfile
And my procfile is:
web: npm start --prefix /web
worker: npm start --prefix /worker
which seemed to fix the startup problem. There isn't any way of setting the #of dynos in the Procfile.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.