# Discourse in a closed intranet

**URL:** <https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449>\
**Category:** Self-hosting\
**Created:** [April 12, 2016, 1:47pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449 "2016-04-12T13:47:14Z")\
**Posts on this page:** 20\
**Page:** 1

## AI-generated summary

In a discussion titled "Discourse in a closed intranet" under the Self-hosting category, [carbo](/t/-/42449/1) seeks to deploy Discourse without internet access, facing issues during bootstrapping and nginx configuration due to dependencies on external resources like github.com and avatars.discourse.org. [zogstrip](/t/-/42449/2) confirms that official Docker installs require internet, suggesting manual installation for offline use. [mpalmer](/t/-/42449/6) recommends mirroring GitHub and DockerHub locally, which [carbo](/t/-/42449/7) successfully implements. A key issue arises with nginx failing to start offline due to a proxy_pass directive pointing to avatars.discourse.org; [carbo](/t/-/42449/13) resolves this by redirecting it to localhost. [fefrei](/t/-/42449/10) suggests disabling external avatars via site settings, though [carbo](/t/-/42449/13) finds it insufficient. [carbo](/t/-/42449/9) also reports a bug: restarting Discourse during internet outages breaks the site until connectivity returns. Later, [nishai](/t/-/42449/14) seeks guidance, and [carbo](/t/-/42449/17) advises setting up a local Git server to host Discourse repos and modifying install scripts — a more sustainable approach than copying Docker images or volumes. [nishai](/t/-/42449/18) struggles with gem bundle installs, and [Falco](/t/-/42449/22) suggests using a proxy, though [nishai](/t/-/42449/23) lacks that option. [pfaffman](/t/-/42449/24) and [mpalmer](/t/-/42449/25) note that bootstrapping offline should ideally be simpler. The thread highlights the lack of official offline documentation and the need for manual workarounds, with community members sharing hard-won solutions for intranet deployments.

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [April 12, 2016, 1:47pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/1 "2016-04-12T13:47:14Z")

</div>

I have been trying to get Discourse running in a closed Intranet. Unfortunately it seems a bit of a futile endeavor. I have got it working in my Lab which does have internet access. But when I move my VM over to my intranet I need to make changes to the app.yml requiring a rebuild. When I do it tries to access github, to pull pups and then fails to bootstrap. Anyway to get Discourse as an offline installer?

I really like Discourse and I would really like to get it to run in my environment. I really don’t want to have to resort to phpBB instead 😬

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [April 12, 2016, 1:56pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/2 "2016-04-12T13:56:52Z")

</div>

Running Discourse in production using our recommended docker install **requires** internet access. If you want to do an offline install, you will have to install it manually.

---

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [April 12, 2016, 2:02pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/3 "2016-04-12T14:02:57Z")

</div>

There doesn’t seem to be any official documentation as to how to do this. Guess I’m on my own? Any hints of some good references to get started, if that is the case? Thanks

Ok, this seems like the starting point I was looking for [https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md](https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md)

---

<div class="post-metadata">

**Author:** ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)\
**Post date:** [April 12, 2016, 4:03pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/4 "2016-04-12T16:03:11Z")

</div>

Just as an aside, you should really consider allowing outbound Internet access from your internal servers, if you can. It’s highly useful for installing the OS updates, NTP time synchronization, etc. that you need to run a secure web server. (Unless you have these resources already mirrored on your local network.)

---

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [April 12, 2016, 4:12pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/5 "2016-04-12T16:12:45Z")

</div>

I wish I could but it is unfortunately it’s a company requirement. They use a GPS based NTP, and mirrored local only repositories. It is a pain… But can’t get around it.

---

<div class="post-metadata">

**Author:** ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)\
**Post date:** [April 12, 2016, 9:42pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/6 "2016-04-12T21:42:07Z")

</div>

Just hack up the installer scripts to point to your local mirror of github and dockerhub rather than [github.com](http://github.com) and [hub.docker.com](http://hub.docker.com).

---

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [April 15, 2016, 2:05pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/7 "2016-04-15T14:05:29Z")

</div>

Okay, was able to get it installing, thanks @mpalmer that was a better solution. Working fine on my test environment (which has internet access). Having an issues with discourse.conf in the docker container in the offline environment. Seems to want to access [avatars.discourse.org](http://avatars.discourse.org), getting errors on line 220 of the that config file. Not sure if this is the reason nginx is not answering http requests in my offline docker container. But this is the only error showing in the error.log file. After further analysis the nginx service is not running in the intranet container, but it is working fine in the lab machine with the hacked install script.

---

<div class="post-metadata">

**Author:** ![sebastianh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sebastianh/32/40415_2.png) [@sebastianh](https://meta.discourse.org/u/sebastianh)\
**Post date:** [April 15, 2016, 2:08pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/8 "2016-04-15T14:08:02Z")

</div>

A good documentation for this would be a huge win. I think a lot of companies might be interested in Discourse if it was easily able to run in an intranet environment. I’d be highly interested in finding out more

---

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [April 15, 2016, 3:19pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/9 "2016-04-15T15:19:35Z")

</div>

Did some more testing. I seem to have found what may be a bug. It seems that if you have an intranet discourse site, even though it might have internet access, will no longer work if two factors come into play:

1. Your internet access is down (for whatever reason)
2. You decide to restart your discourse container during the same period.

If so, you will have a non working discourse site until your internet comes back. This does not seem reasonable, what if it last a few days?

---

<div class="post-metadata">

**Author:** ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)\
**Post date:** [April 15, 2016, 3:47pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/10 "2016-04-15T15:47:28Z")

</div>

> [@carbo](#):
>
> Seems to want to access [avatars.discourse.org](http://avatars.discourse.org), getting errors on line 220 of the that config file.

That’s [a central service for performance reasons](https://meta.discourse.org/t/optimizing-letter-avatar-rendering/33082), uncheck `external system avatars enabled` in site settings to fall back to the old, non-centralized system.

---

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [April 15, 2016, 4:45pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/11 "2016-04-15T16:45:12Z")

</div>

@fefrei any way to disable that in a file or is it stored in the database?

---

<div class="post-metadata">

**Author:** ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)\
**Post date:** [April 15, 2016, 5:33pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/12 "2016-04-15T17:33:02Z")

</div>

Site settings are stored in the database.

---

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [April 15, 2016, 7:03pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/13 "2016-04-15T19:03:48Z")

</div>

This actually did not fix the problem. Inserted the setting in the database and it was still failing. Everything was pointing to an issue with nginx. `nginx -t` fails if the container cannot access the internet. Changed the discourse.conf file at line 220.

from:

`proxy_pass https://avatars.discourse.org/;`

to:

`proxy_pass https://localhost/;`

ran `nginx -t` and it passed

then `sudo service nginx start` it started fine.

Intranet site is now up. Gonna test and see if I still have any issues. Thanks for everyones help.

[https://meta.discourse.org/t/restarting-container-when-internet-is-down-causes-discourse-to-fail/42615?u=carbo](https://meta.discourse.org/t/restarting-container-when-internet-is-down-causes-discourse-to-fail/42615)

---

<div class="post-metadata">

**Author:** ![nishai](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@nishai](https://meta.discourse.org/u/nishai)\
**Post date:** [February 28, 2017, 3:33am UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/14 "2017-02-28T03:33:26Z")

</div>

Hi Carbo,

I am trying to accomplish the same thing. Do you still have any notes from your success or any resources that you used? DId you have to crawl every discoursexxx.git file and replace references to outside resources?

---

<div class="post-metadata">

**Author:** ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)\
**Post date:** [February 28, 2017, 4:45am UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/15 "2017-02-28T04:45:54Z")

</div>

What have you tried so far, and in what way did it not work?

---

<div class="post-metadata">

**Author:** ![nishai](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@nishai](https://meta.discourse.org/u/nishai)\
**Post date:** [February 28, 2017, 4:51am UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/16 "2017-02-28T04:51:32Z")

</div>

I have tried building discourse with docker in an open environment. Running “docker save” of that image and copying it to a closed environment. I then installed docker in the closed environment and ran “docker load” of that image. and "docker commit --change “ENV” to change the Discourse hostname/database/ and other relevant environmental variables to reflect the settings in the closed environment. I think took the updated image and created a new container from it. I ran “docker start new\_container” but it only runs for a few minutes and crashes. It trying to contact [github.com](http://github.com) for the pups.git repo. I then went into the container, changed /pups/.git/config to point towards a local git clone and everything SEEMS to be working but attempts to query the host gets “connection refused” I don’t see anything in the log file. SInce I’m in a closed environment I can’t rebuild the app.

Do I need to copy the /var/discourse and /var/lib/docker directories over to the new server as well along with a copy of the [docker.io/discourse/discourse](http://docker.io/discourse/discourse) image?

---

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [February 28, 2017, 1:54pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/17 "2017-02-28T13:54:27Z")

</div>

> [@nishai](#):
>
> I am trying to accomplish the same thing. Do you still have any notes from your success or any resources that you used? DId you have to crawl every discoursexxx.git file and replace references to outside resources?

I installed a local git server in the intranet and cloned the repositories on the git server and then modified the install scripts to point to the local git server. This is the best solution I found, and it allows you to rebuild the app if you need to make config changes.

> [@nishai](#):
>
> Do I need to copy the /var/discourse and /var/lib/docker directories over to the new server as well along with a copy of the [docker.io/discourse/discourse](http://docker.io/discourse/discourse) image?

Saving and load the created docker container will not work as you intend. Since all the data is on volumes which are mapped to the container. So you would need to copy all those volumes which will complicate your install immensely. I suggest the local git server. The other option I used before, was to create a VM on a XenServer on my internet environment and configured it completely on that side and then export it. Then import it in my intranet environment. In order to upgrade versions, I would back up the site through the Discourse backup tool. Recreate the VM with the new version of Discourse. Then export, import and restore the backup… Was also a bit messy… Again the git option seems the best.

---

<div class="post-metadata">

**Author:** ![nishai](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@nishai](https://meta.discourse.org/u/nishai)\
**Post date:** [February 28, 2017, 1:57pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/18 "2017-02-28T13:57:10Z")

</div>

It’s good to know I’m on the right path. That’s exactly what I’m trying to do now. I’m basically crawling through all of the install and Dockerfiles in each file/directory under /var/discourse. It’s tedious since the install pulls from multiple sources, not just github

---

<div class="post-metadata">

**Author:** ![nishai](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@nishai](https://meta.discourse.org/u/nishai)\
**Post date:** [February 28, 2017, 3:28pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/19 "2017-02-28T15:28:57Z")

</div>

Did you pull down discourse/discourse:1.3.10 from [docker.io](http://docker.io) and then “docker save” it to be loaded on your closed intranet?

---

<div class="post-metadata">

**Author:** ![carbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carbo/32/54170_2.png) [@carbo](https://meta.discourse.org/u/carbo)\
**Post date:** [February 28, 2017, 4:37pm UTC](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449/20 "2017-02-28T16:37:45Z")

</div>

Been a while… Now that you mention it. I actually revamped the DockerFile and maintain my own, I have a local Ubuntu Repo server. I had to modify the `launcher` to point to my version. Yes, you will need to pull down discourse/discourse:1.3.10 to your server, if you don’t build and maintain your own version. I really need to document all of this 😁

[Next page](https://meta.discourse.org/t/discourse-in-a-closed-intranet/42449.md?page=2)
