# Install discourse with internet access only via proxy

**URL:** <https://meta.discourse.org/t/install-discourse-with-internet-access-only-via-proxy/66396>\
**Category:** Self-hosting\
**Created:** [2017 年 7 月 18 日午後 3:56 UTC](https://meta.discourse.org/t/install-discourse-with-internet-access-only-via-proxy/66396 "2017-07-18T15:56:03Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jimbob](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@jimbob](https://meta.discourse.org/u/jimbob)\
**Post date:** [2017 年 7 月 18 日午後 3:56 UTC](https://meta.discourse.org/t/install-discourse-with-internet-access-only-via-proxy/66396/1 "2017-07-18T15:56:03Z")

</div>

Hi All,

(Note that I have deliberately broken all domain names by inserting whitespace because they are getting detected as links, and as a noob I cannot post \>2 links in a post)

I am trying to install discourse on a redhat VM at my work.  
I have the following constraints:

- Host has no direct access to internet. Access is only via http/https proxy
- Host cannot resolve external DNS names (this is handled via the proxy)

yum, git, docker on the host are all configured to use the proxy.

I have discovered that I can pass the installer docker arguments, but these do not seem to get used in all locations.  
I hope that someone on the forum can give me a pointer to progress?

I have observed that the installed needs to be able to connect to github .com and to rubygems .org.  
Based on this I am using the following command to bootstrap with static host mappings for github and rubygems, and passing https proxy env variable:

```
./launcher bootstrap app --docker-args "--add-host github.com:192.30.253.113 --add-host rubygems.org:151.101.2.2 --add-host myproxy:10.10.10.10 -e HTTPS_PROXY=https://myproxy:8080"

```

The problem is that only github can be contacted. The installer cannot reach rubygems, and I get a failures like this:

```
Fetching source index from https://rubygems.org/
Need to query more than 500 gems. Downloading full index instead...
HTTP GET https://rubygems.org/quick/Marshal.4.8/libv8-5.7.492.65.1-x86_64-linux.gemspec.rz
Errno::EHOSTUNREACH: Failed to open TCP connection to rubygems.org:443 (No route to host - connect(2) for "rubygems.org" port 443)
/usr/local/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'
...
...
...    
Network error while fetching
https://rubygems.org/quick/Marshal.4.8/libv8-5.7.492.65.1-x86_64-linux.gemspec.rz
(Failed to open TCP connection to rubygems.org:443 (No route to host -
connect(2) for "rubygems.org" port 443))

I, [2017-07-18T15:24:15.899372 #13] INFO -- : Terminating async processes
I, [2017-07-18T15:24:15.899452 #13] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid: 42
I, [2017-07-18T15:24:15.899557 #13] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 155
2017-07-18 15:24:15 UTC [42-2] LOG: received fast shutdown request
2017-07-18 15:24:15 UTC [42-3] LOG: aborting any active transactions
2017-07-18 15:24:15 UTC [49-2] LOG: autovacuum launcher shutting down
155:signal-handler (1500391455) Received SIGTERM scheduling shutdown...
2017-07-18 15:24:15 UTC [46-1] LOG: shutting down
155:M 18 Jul 15:24:15.905 # User requested shutdown...
155:M 18 Jul 15:24:15.905 * Saving the final RDB snapshot before exiting.
155:M 18 Jul 15:24:15.908 * DB saved on disk
155:M 18 Jul 15:24:15.908 # Redis is now ready to exit, bye bye...
2017-07-18 15:24:15 UTC [46-2] LOG: database system is shut down

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --deployment --verbose --without test --without development' failed with return #<Process::Status: pid 277 exit 17>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
6e41afbf21a5aa0eb0e98e620801f06ae8bffb69f64c3c059475c00f66f17261
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one

```

Seems that whatever is connecting to rubygems is not respecting the https proxy environment variable passed to docker, hence I am getting the:  
Errno::EHOSTUNREACH: Failed to open TCP connection to rubygems .org:443 (No route to host - connect(2) for “rubygems .org” port 443)

Any ideas how I can progress this?

BTW for anyone considering installing behind a proxy, think long and hard - it’s gruelling ☹

---

_[View the full topic](https://meta.discourse.org/t/install-discourse-with-internet-access-only-via-proxy/66396)._
