Discourse installation on Azure not reachable

I created a new Ubuntu 14.04 VM on Microsoft Azure and installed Discourse using the guide here: discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub

The entire installation went perfectly, but the instance is not reachable publicly. I have the A record configured to the public IP given by Azure. I also tried using the IP address directly.

I suspect this has something to do with the Docker IP and the Eth0 IP address, but not sure how to solve it.

# ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:4c:29:e0:92  
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:4cff:fe29:e092/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6144 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21683 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:414603 (414.6 KB)  TX bytes:30771613 (30.7 MB)

eth0      Link encap:Ethernet  HWaddr 00:0d:3a:00:15:21  
          inet addr:10.0.0.4  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20d:3aff:fe00:1521/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1079091 errors:0 dropped:0 overruns:0 frame:0
          TX packets:634212 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1254465906 (1.2 GB)  TX bytes:318586926 (318.5 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:7245 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7245 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:986455 (986.4 KB)  TX bytes:986455 (986.4 KB)

vethcb56e42 Link encap:Ethernet  HWaddr 6a:43:07:bb:63:3f  
          inet6 addr: fe80::6843:7ff:febb:633f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2717 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2896 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:225111 (225.1 KB)  TX bytes:3277314 (3.2 MB)

So essentially I have 3 IPs: the public IP, the eth0 IP on the VPN, and then the docker instance IP. I’m guessing I need to somehow route the public IP:80 port to the docker IP?

Please help. Thank you.

「いいね!」 1

Currently we do not officially support Discourse installation on Microsoft Azure. We recommend using DigitalOcean.

Supporting Discourse installation on Microsoft Azure is on my to-do list and I plan to make a how-to guide for same by the end of January 2016.

Provided Docker installed correctly, I am unclear why the current guide would not work…

Crazy cloud shenanigans likely get in the way – there’s probably some equivalent of AWS’ security groups, or perhaps the networking stack needs an extra kick in the pants.

「いいね!」 3

So I sort of found the problem, but not the cure. As expected it has to do with the port forwarding/mapping/routing issue.

Azure VMs are part of a resource group with a common virtual public IP and a VPN/subnet for individual machines. Then there is a Network Security Group, with which one has to define some NAT rules.

I did setup forwarding for the Docker ports, but to no avail. Now trying to diagnose using Docker documentation. Jeff is right, once Docker works correctly, Discourse will work too.

The Azure classic VM should be better because they allow mapping of specific endpoints (ports). Will try installing in one of those.

Will post my updates. For better or for worse, I’m stuck with Azure at the moment.

「いいね!」 5

Ok. So I discarded the instance of Ubuntu and created a new Ubuntu VM of the classic type. Then I chose a fixed Instance IP address. Then I created two endpoints for TCP/80 and TCP/443 to forward from the public to private network. Also I installed Docker from the instructions for Ubuntu and not the script directly.

I’m not sure which of these steps helped, but now Discourse works on Azure!

Thank you all!

「いいね!」 9

Hi there!

Resetting my discourse installation on azure, I cannot reach it anymore!

It was working before, but by now, it doesn’t! I map the public ports to the vm and inside the vm to the docker installation. It all worked before.

Any idea where to start over? Where to check, what is up and running? Docker is running (according to pgrep).

Any help appreciated!
Bernd

I finally switched to digital ocean, where it works out of the box. The VM classic type seems not to be available anymore at Azure? Tried to setup an instance without success…

Regards,
Bernd

このトピックを再度持ち上げるのは気が引けますが、まだ関連性があります。Discourse としてのインストールは完璧に完了し、すべて問題なさそうですが、ポート 80 と 443 が外部から到達できません。


更新: 基本インストール は、Azure の Ubuntu Server 上でそのまま動作します。

2 回目に私が異なって行ったことは以下の通りです:

  1. VM の作成後、discourse-setup を実行した際、プロセスを中断しませんでした。そのため、すべてが一度に実行されました。

    1 回目はスワップ領域がないことに気づき、discourse-setup スクリプトが不足している場合に設定するものの、一度シェルに戻って確認してしまいました。その後、インストールのプロンプトが 基本ガイド と異なっていたため、もう一度中断してしまいました。

    + 驚いたのは Let’s Encrypt の項目で、通知を受け取るためのメールアドレスを求められることでした。HTTPS を手動で設定する必要があると思っていたのです。実際には、スクリプトが Let’s Encrypt の SSL 証明書を使用して Discourse インスタンスを設定してくれます。<c/br>+ もう一つは SMTP のユーザー名とパスワードの項目です。ここを空欄にできたかどうかは未だ確信が持てませんが、管理用メールアドレスとそのアカウントのパスワードを入力しました。

  2. この meta.discourse のスレッド に従って、スワップ領域を手動で設定しました。

    これが原因だったとは思いませんが、念のため記載します。2 回目は、1 回目と同じ手順で行いましたが、(1) スワップを手動で設定し、(2) discourse-setup を中断せずに実行した点が異なります。

    1 回目のインスタンスを救えた可能性もありますが、Discourse のアーキテクチャはまだ謎が多く、HTTP/HTTPS エンドポイントを再起動する方法も確信が持てません。netstat -tulpn の出力を比較すると、1 回目のインスタンスでは関連するすべてのサービスが適切なポートで実行・リッスンしていることがわかります(例:PostgreSQL は 5432、Redis は 6379 など)。ただし、ポート 80 と 443 のエントリが欠落しており、nginx が実行されていないことを示唆しています:

1 回目(失敗)のインスタンス:

$ sudo -s

# docker ps
CONTAINER ID   IMAGE                 COMMAND        CREATED        STATUS        PORTS                                                                      NAMES
62396a99737c   local_discourse/app   "/sbin/boot"   14 hours ago   Up 14 hours   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   app

# docker exec -it 62396a99737c bash

(docker)# netstat -tulpn
Active Internet connections (only servers)
Proto Local Address  Foreign Address State   PID/Program name
tcp   127.0.0.1:3000 0.0.0.0:*       LISTEN  -
tcp   0.0.0.0:5432   0.0.0.0:*       LISTEN  -
tcp   0.0.0.0:6379   0.0.0.0:*       LISTEN  -
tcp6  :::5432        :::*            LISTEN  -
tcp6  :::6379        :::*            LISTEN  -

2 回目のインスタンス:

(docker)# netstat -tulpn
Active Internet connections (only servers)
Proto Local Address  Foreign Address  State   PID/Program name
tcp   0.0.0.0:6379   0.0.0.0:*        LISTEN  -
tcp   0.0.0.0:80     0.0.0.0:*        LISTEN  2359/nginx: master
tcp   127.0.0.1:3000 0.0.0.0:*        LISTEN  -
tcp   0.0.0.0:5432   0.0.0.0:*        LISTEN  -
tcp   0.0.0.0:443    0.0.0.0:*        LISTEN  2359/nginx: master
tcp6  :::6379        :::*             LISTEN  -
tcp6  :::5432        :::*             LISTEN  -

今後の自分へのメモ:

  1. 1 回目はポート 80 と 443 のリスナーがないことに気づきましたが、127.0.0.1:3000 のソケット(デフォルトの Rails ソケットだと記憶していました)は確認できました。nginx が実行されていないかもしれないという考えは浮かばず、何らかの理由で Docker のポートマッピングが原因だと疑い、netcat を使って基本的なリダイレクトを行いました:

    Docker 内:nc -l -p 80 -c "nc 127.0.0.1 3000"
    VM 内の Docker 外:nc -zv localhost 80 および curl localhost:80(これで Docker に問題がないことが確認できました)

  2. また、Azure のインバウンドポートルール を疑いましたが、nc -zvConnection refused を返し続けるのは、ポートは開いているが、相手側でリスナーが動作していないことを意味すると気づきました。(もしポートがブロックされていれば、nc は単にフリーズするはずです。)

「いいね!」 1

ポート 80 と 443 が受信トラフィックに対して開放されていない場合、discourse-setup は失敗するはずです。

ああ、確かにその通りですね。メール設定に関するいくつかの質問は以前に変更されましたが、ガイドには反映されていません。ほとんどの人がインストールドキュメントではなくプロンプトを読むため、他の人からは苦情は来ていないようです。

なぜそう思ったのですか?インストールプロセスは長年、Let’s Encrypt を自動的に設定しています。

あなたのサイトが機能しているのか、機能していないのかがわかりません。

機能していない場合、おそらく discourse-setup を何度も実行して、letsencrypt.org のレート制限を使い果たしてしまったのでしょう。

「いいね!」 2

discourse-setup と同じようにインストール・クラウドを機能させるための PR です:update INSTALL-cloud for discourse-setup by pfaffman · Pull Request #14065 · discourse/discourse · GitHub

「いいね!」 2

このトピックは3095日後に自動的に閉じられました。新しい返信は許可されていません。