# Using Habitat in offline environment

**URL:** <https://discourse.chef.io/t/using-habitat-in-offline-environment/19270>\
**Category:** Habitat Help\
**Created:** [August 25, 2016, 9:32am UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270 "2016-08-25T09:32:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![losaciertos](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@losaciertos](https://discourse.chef.io/u/losaciertos)\
**Post date:** [August 25, 2016, 9:32am UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/1 "2016-08-25T09:32:52Z")

</div>

Hi!

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.

---

<div class="post-metadata">

**Author:** ![losaciertos](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@losaciertos](https://discourse.chef.io/u/losaciertos)\
**Post date:** [September 5, 2016, 8:06am UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/2 "2016-09-05T08:06:32Z")

</div>

Does anybody mantain this forum?)

---

<div class="post-metadata">

**Author:** ![bdangit](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bdangit/32/1466_2.png) [@bdangit](https://discourse.chef.io/u/bdangit)\
**Post date:** [September 16, 2016, 3:22pm UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/3 "2016-09-16T15:22:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![julian7](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/julian7/32/1119_2.png) [@julian7](https://discourse.chef.io/u/julian7)\
**Post date:** [September 17, 2016, 7:51am UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/4 "2016-09-17T07:51:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![losaciertos](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@losaciertos](https://discourse.chef.io/u/losaciertos)\
**Post date:** [September 19, 2016, 1:18pm UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/5 "2016-09-19T13:18:42Z")

</div>

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

> [@On another topic](https://discourse.chef.io/t/173/3):
>
> 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.

Can you explain here?

---

<div class="post-metadata">

**Author:** ![bdangit](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bdangit/32/1466_2.png) [@bdangit](https://discourse.chef.io/u/bdangit)\
**Post date:** [September 20, 2016, 8:25am UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/6 "2016-09-20T08:25:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![losaciertos](https://avatars.discourse-cdn.com/v4/letter/l/50afbb/32.png) [@losaciertos](https://discourse.chef.io/u/losaciertos)\
**Post date:** [September 20, 2016, 9:04am UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/7 "2016-09-20T09:04:11Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![bdangit](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bdangit/32/1466_2.png) [@bdangit](https://discourse.chef.io/u/bdangit)\
**Post date:** [September 20, 2016, 1:07pm UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/8 "2016-09-20T13:07:27Z")

</div>

@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:

- [https://github.com/chef-cookbooks/habitat/blob/master/test/fixtures/cookbooks/fake/recipes/package.rb](https://github.com/chef-cookbooks/habitat/blob/master/test/fixtures/cookbooks/fake/recipes/package.rb)
- [https://github.com/bixu/habitat-cookbook](https://github.com/bixu/habitat-cookbook)

---

<div class="post-metadata">

**Author:** ![julian7](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/julian7/32/1119_2.png) [@julian7](https://discourse.chef.io/u/julian7)\
**Post date:** [September 20, 2016, 1:13pm UTC](https://discourse.chef.io/t/using-habitat-in-offline-environment/19270/9 "2016-09-20T13:13:14Z")

</div>

@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.
