carlb
(Carl)
2020 年 6 月 3 日午前 7:12
1
こんにちは、
Web フロントエンドからアップグレードした後、サイトへのアクセスができなくなりました。何も変更せず、アップグレードボタンをクリックしただけです!エラーメッセージは Redis への接続問題を示唆しています。かなり検索しましたが、まだ役立つ情報は見つかりませんでした。production.log は空です。Ubuntu を Digital Ocean で実行しており、18 ヶ月間問題なく動作していました。6 ヶ月前にディスク容量が不足した際、正常に容量を増設した以外はエラーはありませんでした。
ディスク容量は問題ありません:
Filesystem Size Used Avail Use% Mounted on
overlay 49G 25G 24G 52% /
tmpfs 64M 0 64M 0% /dev
tmpfs 1001M 0 1001M 0% /sys/fs/cgroup
shm 512M 8.0K 512M 1% /dev/shm
/dev/vda1 49G 25G 24G 52% /shared
tmpfs 1001M 0 1001M 0% /proc/acpi
tmpfs 1001M 0 1001M 0% /proc/scsi
tmpfs 1001M 0 1001M 0% /sys/firmware
unicorn.stdout.log には以下が表示されます:
> 2020-06-03T06:29:28.352Z pid=715 tid=osk2fuo0n ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)
> 2020-06-03T06:29:28.353Z pid=715 tid=osk2fszrb ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)
> 2020-06-03T06:29:28.354Z pid=715 tid=osk2fsjw3 ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)
> 2020-06-03T06:29:28.354Z pid=715 tid=osk2ftlhz ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)
> 2020-06-03T06:29:28.355Z pid=715 tid=osk2ftr43 ERROR: Error fetching job: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)
> Starting up 1 supervised sidekiqs
> Loading Sidekiq in process id 725
まず、アプリを手動で再構築してみました。
その後、apt upgrade docker を実行し、reboot コマンドでサーバーを再起動、さらに ./launcher rebuild app で再構築を試みました。
redis-cli ping を実行すると PONG 応答が返ってきます。
ss -t
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 0 104.248.166.162:ssh 5.81.114.19:56270
ESTAB 0 0 104.248.166.162:ssh 5.81.114.19:56211
ps -axf で確認すると、プロセスは実行中です。
PID TTY STAT TIME COMMAND
2378 pts/1 Ss 0:00 /bin/bash --login
2849 pts/1 R+ 0:00 \_ ps -axf
1 pts/0 Ss+ 0:00 /bin/bash /sbin/boot
627 pts/0 S+ 0:00 /usr/bin/runsvdir -P /etc/service
628 ? Ss 0:00 \_ runsv rsyslog
641 ? Sl 0:00 | \_ rsyslogd -n
629 ? Ss 0:00 \_ runsv cron
640 ? S 0:00 | \_ cron -f
630 ? Ss 0:00 \_ runsv unicorn
639 ? S 0:00 | \_ /bin/bash config/unicorn_launcher -E producti
665 ? Sl 0:09 | \_ unicorn master -E production -c config/un
725 ? SNl 0:12 | | \_ sidekiq 6.0.7 discourse [0 of 5 busy]
750 ? Sl 0:20 | | \_ unicorn worker[0] -E production -c co
758 ? Sl 0:17 | | \_ unicorn worker[1] -E production -c co
2848 ? S 0:00 | \_ sleep 1
631 ? Ss 0:00 \_ runsv postgres
635 ? S 0:00 | \_ svlogd /var/log/postgres
636 ? S 0:00 | \_ /usr/lib/postgresql/12/bin/postmaster -D /etc
659 ? Ss 0:00 | \_ postgres: 12/main: checkpointer
660 ? Ss 0:00 | \_ postgres: 12/main: background writer
661 ? Ss 0:00 | \_ postgres: 12/main: walwriter
662 ? Ss 0:00 | \_ postgres: 12/main: autovacuum launcher
663 ? Ss 0:00 | \_ postgres: 12/main: stats collector
664 ? Ss 0:00 | \_ postgres: 12/main: logical replication la
691 ? Ss 0:00 | \_ postgres: 12/main: discourse discourse [l
1848 ? Ss 0:00 | \_ postgres: 12/main: discourse discourse [l
2633 ? Ss 0:00 | \_ postgres: 12/main: discourse discourse [l
2675 ? Ss 0:00 | \_ postgres: 12/main: discourse discourse [l
2840 ? Ss 0:00 | \_ postgres: 12/main: discourse discourse [l
632 ? Ss 0:00 \_ runsv nginx
634 ? S 0:00 | \_ nginx: master process /usr/sbin/nginx
654 ? S 0:02 | \_ nginx: worker process
655 ? S 0:00 | \_ nginx: cache manager process
633 ? Ss 0:00 \_ runsv redis
637 ? S 0:00 \_ svlogd /var/log/redis
638 ? Sl 0:05 \_ /usr/bin/redis-server *:6379
何かアイデアはありませんか?私は専門家ではなく、この問題を解決する方法を見つけるのに本当に苦労しています。見落としている単純なことはないでしょうか?他に確認すべき場所はありませんか?
ありがとう
sam
(Sam Saffron)
2020 年 6 月 3 日午前 7:20
3
あ、なるほど。再起動して、ありそうな対策はすべて試されたんですね……
コンテナの設定(パスワードは除く)を貼り付けていただけますか?Redis のテンプレートが混ざっていませんか?
docker logs app に気になる出力はありましたか?
コンテナ内で localhost が解決していますか?
carlb
(Carl)
2020 年 6 月 3 日午前 7:32
4
こんにちは、サムさん。私の知識不足をお許しください。
おっしゃる「app.yml」ファイルのことでしょうか?
docker ログとはどのログを指すのでしょうか?私は「./launcher logs app」と実行しました。
run-parts: executing /etc/runit/1.d/00-ensure-links
run-parts: executing /etc/runit/1.d/00-fix-var-logs
run-parts: executing /etc/runit/1.d/anacron
run-parts: executing /etc/runit/1.d/cleanup-pids
Cleaning stale PID files
run-parts: executing /etc/runit/1.d/copy-env
run-parts: executing /etc/runit/1.d/letsencrypt
[Wed 03 Jun 2020 06:34:47 AM UTC] Domains not changed.
[Wed 03 Jun 2020 06:34:47 AM UTC] Skip, Next renewal time is: Wed Jul 1 00:35:12 UTC 2020
[Wed 03 Jun 2020 06:34:47 AM UTC] Add '--force' to force to renew.
[Wed 03 Jun 2020 06:34:47 AM UTC] Installing key to:/shared/ssl/forum.tritalk.co.uk.key
[Wed 03 Jun 2020 06:34:47 AM UTC] Installing full chain to:/shared/ssl/forum.tritalk.co.uk.cer
[Wed 03 Jun 2020 06:34:47 AM UTC] Run reload cmd: sv reload nginx
warning: nginx: unable to open supervise/ok: file does not exist
[Wed 03 Jun 2020 06:34:47 AM UTC] Reload error for :
[Wed 03 Jun 2020 06:34:48 AM UTC] Domains not changed.
[Wed 03 Jun 2020 06:34:48 AM UTC] Skip, Next renewal time is: Thu Jul 9 00:35:12 UTC 2020
[Wed 03 Jun 2020 06:34:48 AM UTC] Add '--force' to force to renew.
[Wed 03 Jun 2020 06:34:48 AM UTC] Installing key to:/shared/ssl/forum.tritalk.co.uk_ecc.key
[Wed 03 Jun 2020 06:34:48 AM UTC] Installing full chain to:/shared/ssl/forum.tritalk.co.uk_ecc.cer
[Wed 03 Jun 2020 06:34:48 AM UTC] Run reload cmd: sv reload nginx
warning: nginx: unable to open supervise/ok: file does not exist
[Wed 03 Jun 2020 06:34:48 AM UTC] Reload error for :
Started runsvdir, PID is 627
ok: run: redis: (pid 638) 0s
ok: run: postgres: (pid 636) 0s
chgrp: invalid group: 'syslog'
rsyslogd: imklog: cannot open kernel log (/proc/kmsg): Operation not permitted.
rsyslogd: activation of module imklog failed [v8.1901.0 try https://www.rsyslog.com/e/2145 ]
supervisor pid: 639 unicorn pid: 665
コンテナ内でコマンドを試しましたが、これが意図したものかどうか確信が持てません。
tritalk@TriTalk-Discourse:/var/discourse$ sudo ./launcher enter app
root@TriTalk-Discourse-app:/var/www/discourse# curl http://localhost:8080
curl: (7) Failed to connect to localhost port 8080: Connection refused
carlb:
app.yml ファイルのことですか?
はい、app.yml ですが、パスワードや機密情報は削除してください。
sam
(Sam Saffron)
2020 年 6 月 3 日午前 8:11
7
これは問題です。どのバージョンの Docker を実行していますか?docker info の出力は何ですか?
carlb
(Carl)
2020 年 6 月 3 日午前 8:15
8
その通りです!データベースが見つからないようです。サイトを開くと、見出しだけの画面が表示されます。
docker info :-
Client:
Debug Mode: false
Server:
Containers: 2
Running: 1
Paused: 0
Stopped: 1
Images: 6
Server Version: 19.03.11
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-179-generic
Operating System: Ubuntu 16.04.6 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.953GiB
Name: TriTalk-Discourse
ID: SYIS:XPWU:W2SP:NYNA:GFP7:DNVK:E7JF:553N:EGWF:OR7M:TV2E:A6ZX
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
carlb
(Carl)
2020 年 6 月 3 日午前 8:26
11
セーフモードを使用し、プラグインを無効化せずにアクセスするとエラーが発生しました。アップグレード後、何らかのプラグインに問題があるようです。yml ファイルから該当プラグインをコメントアウトし、アプリを再構築するとすべて正常に動作します。問題の原因は discourse-affiliate または discourse-adplugin のどちらかです。後で詳しく調査しますが、少なくともサイトは再び稼働しています。ご支援ありがとうございました。メモ:今後、事前チェックにはセーフモードを使用しよう!
プラグインの領域の形式が正しくないようです。それが原因かもしれませんね。
実際には以下のようにする必要があります:
cmd:
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/discourse-adplugin.git
- git clone https://github.com/discourse/discourse-affiliate.git
(mkdir -p plugins を削除してください)
これでプラグインに関する問題が解決するはずです。
carlb
(Carl)
2020 年 6 月 3 日午前 9:06
13
ありがとう、バヌ。試してみます。今日まで問題なく動いていたのに不思議ですね。最新の Docker リリースで何かが強化されたのかもしれません。
もしかしたら間違っているかもしれません。これまで yml ファイルでそのパラメータを使ったことがありませんが、今まで問題なく動作しています。
neounix
(Dark Matter)
2020 年 6 月 3 日午前 9:59
15
carlb さん、こんにちは。
参考までに申し上げますと、Redis は主にバックグラウンドジョブ(およびその相棒であるジョブスケジューラの Sidekiq)に使用されています。個人的な見解ですが、開発環境では、これらの「バックグラウンドジョブ」を実行したくないため、Redis や Sidekiq を実行せずに Discourse を起動することがよくあります。
したがって、Redis が実行されていなくても、Discourse フォーラムはコアフォーラム、トピック、ユーザー、投稿などを正常に表示するはずです。私がこの点を付け加えたのは、あなたがトピックのタイトルを
アップグレード後の Redis エラー
とし、その後、Redis とは直接関係のない多くの基本的な問題が示されたフォーラムのスクリーンショットを親切に提供されたからです。
carlb
(Carl)
2020 年 6 月 3 日午前 10:16
16
ご説明いただきありがとうございます。これらすべてがどのように連携しているのかについては、普段は特に問題なく動作するため、深く掘り下げる必要がなかったこともあり、あまり詳しくありません。そのため、この説明は今後の参考になります。私が発見したエラーはすべてRedisへの接続失敗について言及していたため、これが根本原因なのではないかと推測していました。また、基本的な問題を解決するためにいつも試すような対処法も、今回は何も機能しませんでした。