Using Habitat in offline environment


Is it possible to setup Habitate on server with no Internet access.
As documentation says:

The hab command-line interface (CLI) tool downloads its other components when it needs them, so setup for Habitat is centered on where you want the hab CLI installed and getting it integrated into your shell.

My goal is to run my packages on that server.

Does anybody mantain this forum?)

Hey @losaciertos,

If you are talking about when you are ready to deploy your app onto the host, then yes you can run everything without access to the internet as long as you do the following:

  1. download, sneaker net it to the machine and then install the habitat binary.
  2. take advantage of hab pkg export tar <pkg_name> which will be a tarball that you can use to untar and it will reconstruct the /hab directory so that you will be able to just run hab start <pkg_name>

No internet necessary during the deployment.

Building however, you’ll probably have an easier time when you have access to the public Depot or your private Depot. Otherwise, you’ll be rebuilding every single dependency you need all the time.

Hope that helps.

We are also thinking about having a standalone system to run custom haproxy. In our case we can’t use the public hab depot, and we can’t use public github either. As a prod environment, running depot in insecure mode is not even considered.

So we’re thinking about having a build and export in a build environment, and set up a deployment mechanism around deploying the whole enchilada and restart services. Packer seems like being a good choice.

Thank you very much!
Will try to do so soon.
As I understand, resulting tarball will contain all dependencies too (downloaded from Depot)?

Can you explain here?

Yes. The Tarbell will contain all the dependencies your app needs.

As for building, when your app depends on other habitat packages, it checks to see if the pkg is already installed locally otherwise it will attempt to reach out to your Depot to get this dependency.

One thing to note is that in one studio session, every time you build a plan, it installs itself into the /hab/pkg dir.

So if all you had were plans and no access to a Depot, you would be building your dependency every time to get your app built.

So in the end, get access to a Depot. But no access to depot is required when deploying to your hosts.

Thank you very much for detailed explanation!

I need some time to practice in using Habitat this way.
So maybe there will be new questions)

@julian7 if you are going to use packer to get what I am assuming your host image, you might be interested in using any of these cookbooks:

@bdangit that’s awesome! I believe I have to do something about the configurability of hab-depot, and then we’ll have the ultimate github enterprise + internal habitat depot + internal chef server combo to support the whole pipeline.

1 Like