# ビルド失敗、MaxMind 地理情報データベースのダウンロードができません

**URL:** https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855
**Category:** Self-hosting
**Tags:** maxmind
**Created:** [2019 年 9 月 30 日午後 1:07 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855 "2019-09-30T13:07:44Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![KGrzeg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kgrzeg/32/157356_2.png) [@KGrzeg](https://meta.discourse.org/u/KGrzeg)
#### Post date: [2019 年 9 月 30 日午後 1:07 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/1 "2019-09-30T13:07:44Z")

</div>

こんにちは！  
2 日前に、[この手順](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) に従って、新しい DigitalOcean マシンに Discourse をインストールし、すべて正常に動作していました。  
昨日、新しい DigitalOcean マシン（Ubuntu 18.03、1GB）で再度アプリのインストールを試みました。VPS は同じ構成ですが、今回は動作しませんでした。

`./discourse-setup` を実行し、質問に回答して待機していると、ターミナルが以下の行でフリーズしました。  
`#<Thread:0x00005621595f3360@/var/www/discourse/lib/tasks/assets.rake:215 run> terminated with exception (report_on_exception is true):`  
ターミナルを解放できる唯一の方法は、SSH 接続を切断して再接続することでした。

Linux についての知識は初歩的なものしかありません。  
`apt-get` でシステムを更新しても、違いはありませんでした。  
インストーラーが `assets:precompile` タスクでフリーズしていることがわかりました。例外は `/var/www/discourse/lib/tasks/assets.rake:227:in rescue in block (2 levels) in <top (required)>': undefined local variable or method'name' for main:Object (NameError)` から発生しています。  
セットアップ中にバイナリデータがコンソールに出力されるため、フリーズが発生します。さらに詳しく調べると、エラー 403 が発生していることはわかりましたが、対象の URL は特定できませんでした。

何かヒントはありませんか？

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [2019 年 9 月 30 日午後 7:32 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/2 "2019-09-30T19:32:13Z")

</div>

RAM/CPUの観点から、どのプランを利用されていましたか？

---

<div class="post-metadata">

### Author: ![KGrzeg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kgrzeg/32/157356_2.png) [@KGrzeg](https://meta.discourse.org/u/KGrzeg)
#### Post date: [2019 年 9 月 30 日午後 9:29 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/3 "2019-09-30T21:29:26Z")

</div>

- RAM 1GB
- 共有 vCPU 2.3GHz × 1
- ROM SSD 25GB

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2019 年 9 月 30 日午後 9:58 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/4 "2019-09-30T21:58:38Z")

</div>

フルバックトレースをここに提示していただけますか？また、カスタムプラグインは使用していますか？

---

<div class="post-metadata">

### Author: ![KGrzeg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kgrzeg/32/157356_2.png) [@KGrzeg](https://meta.discourse.org/u/KGrzeg)
#### Post date: [2019 年 9 月 30 日午後 10:41 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/5 "2019-09-30T22:41:55Z")

</div>

screen でセットアップを実行し、記録しました。その後、`xdd` でログを開き、2 つのバイナリデータチャンクを `<BINARY_DATA>` に置換しました。

```
#<Thread:0x000055c07c7e8cf8@/var/www/discourse/lib/tasks/assets.rake:215 run> terminated with exception (report_on_exceptionis true):
/var/www/discourse/lib/tasks/assets.rake:227:in `rescue in block (2 levels) in <top (required)>':undefined local variable or method`name' for main:Object (NameError)
from /var/www/discourse/lib/tasks/assets.rake:216:in `block (2 levels) in <top (required)>'
/var/www/discourse/lib/file_helper.rb:55:in `block in download':
403 Error:<BINARY_DATA> (OpenURI::HTTPError) <BINARY_DATA>
from /var/www/discourse/lib/final_destination.rb:400:in `block (3 levels) in safe_get'
from /var/www/discourse/lib/final_destination.rb:399:in `catch'
from /var/www/discourse/lib/final_destination.rb:399:in `block (2 levels) in safe_get'
from /usr/local/lib/ruby/2.6.0/net/http.rb:1518:in `block in transport_request'
from /usr/local/lib/ruby/2.6.0/net/http/response.rb:165:in `reading_body'
from /usr/local/lib/ruby/2.6.0/net/http.rb:1517:in `transport_request'
from /usr/local/lib/ruby/2.6.0/net/http.rb:1479:in `request'
from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-1.0.2/lib/patches/net_patches.rb:9:in `block in request_with_mini_profiler'
from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-1.0.2/lib/mini_profiler/profiling_methods.rb:39:in `step'
from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-1.0.2/lib/patches/net_patches.rb:8:in `request_with_mini_profiler'
from /var/www/discourse/lib/final_destination.rb:371:in `block in safe_get'
from /var/www/discourse/lib/final_destination.rb:415:in `block in safe_session'
from /usr/local/lib/ruby/2.6.0/net/http.rb:920:in `start'
from /usr/local/lib/ruby/2.6.0/net/http.rb:605:in `start'
from /var/www/discourse/lib/final_destination.rb:412:in `safe_session'
from /var/www/discourse/lib/final_destination.rb:363:in `safe_get'
from /var/www/discourse/lib/final_destination.rb:129:in `get'
from /var/www/discourse/lib/file_helper.rb:47:in `download'
from /var/www/discourse/lib/discourse_ip_info.rb:30:in `mmdb_download'
from /var/www/discourse/lib/tasks/assets.rake:218:in `block (3 levels) in <top (required)>'
from /var/www/discourse/lib/tasks/assets.rake:217:in `each'
from /var/www/discourse/lib/tasks/assets.rake:217:in `block (2 levels) in <top (required)>'

```

インストーラーはその後、いくつかのタスクを問題なく実行しました。プロセスの最後には以下が表示されます:

```
FAILED--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake assets:precompile'
failed with return #<Process::Status: pid 384 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'..exec
failed with the params {"cd"=>"$home", "hook"=>"assets_precompile",
"cmd"=>["su discourse -c 'bundle exec rake assets:precompile'"]}
f534324ceedf6b1a8a5cc89f38e1c12c2418fb69c71f93f21c0dd2f5ef51483d
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one
./discourse-doctor may help diagnose the problem.

```

コマンド `./discourse-doctor` は役に立ちません。Doctor はアプリが実行されていないことを検知し、再構築を試みますが、これもフリーズします。  
**プラグインは一切インストールしていません** 。このマシンでこのアプリを一度も実行したことがないためです ☹

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2019 年 9 月 30 日午後 10:52 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/6 "2019-09-30T22:52:30Z")

</div>

> [@KGrzeg](#):
>
> /var/www/discourse/lib/tasks/assets.rake:216:in `block (2 levels) in <top (required)>' /var/www/discourse/lib/file_helper.rb:55:in `block in download’: 403 エラー

あなたの IP アドレスは MaxMind DB のダウンロードからブロックされています。

app.yml ファイルを編集し、env キーの下に `DISCOURSE_REFRESH_MAXMIND_DB_DURING_PRECOMPILE_DAYS: 365` を追加してから、再ビルドを試してください。

---

<div class="post-metadata">

### Author: ![KGrzeg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kgrzeg/32/157356_2.png) [@KGrzeg](https://meta.discourse.org/u/KGrzeg)
#### Post date: [2019 年 9 月 30 日午後 11:16 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/7 "2019-09-30T23:16:29Z")

</div>

問題ありません！ 💥🔥🎉  
本当にありがとうございます！この行は app.yml に残す必要がありますか、それとも初回正常な呼び出し後に削除してもよいですか？

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2019 年 9 月 30 日午後 11:22 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/8 "2019-09-30T23:22:40Z")

</div>

サーバーが新しいデータベースをダウンロードできないため、削除するとすぐに再度失敗します。

365 に設定しておくことは、私たちが年に 2 回リリースする新しいベースイメージが公開された際に更新されることを意味します。

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019 年 10 月 1 日午前 5:19 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/9 "2019-10-01T05:19:44Z")

</div>

ここは確かにもっと良いエラーメッセージにするべきですね。あのエラーは全く意味が分かりません。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2019 年 10 月 31 日午前 5:25 UTC](https://meta.discourse.org/t/build-failure-unable-to-download-the-maxmind-geolocation-database/129855/10 "2019-10-31T05:25:47Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
