Typical web app example


#1

How should I compose a typical web app? For example, it uses postgresql as database, nginx for frontend web server and unicorn as application server. Should I build separate package for each of these? And another package for app itself?

Or single app package (maybe except database which is separate package) with nginx and unicorn listed as dependencies?

Node.js example is too simple.


#2

You can use existing packages to run things like nginx and postgresql (though these plans are new, and if they don’t do what you need, we could use your help improving them.)

You should have a package for anything that runs as a service. If you want to run multiple services on the same machine, you can use the director: https://www.habitat.sh/docs/run-packages-director/

Let me know if you still have questions or if anything doesn’t make sense. Thanks!


#3

Hi @smith,

Thank you for the information.
I tried the director and was able to launch two services, one my application, one monodb.
But how can we export this entire application as one?


#4

If it’s one container, you could write a Dockerfile that installs hab, then hab install the director, the pkgs you need and setup your config.toml. That will be packaged up as one container.