init.dスクリプトでUWSGIを起動すると、終了コード1で終了し、「失敗」と表示されますが、プロセスは正常に実行されます。

init.dスクリプトでUWSGIを起動すると、終了コード1で終了し、「失敗」と表示されますが、プロセスは正常に実行されます。

これが重複としてマークされる前に私は読んだ。この問題;しかし、追加してもlogfile2何も変わりません。


私は現在、UWSGIを使用してPythonスタックを実行するdockerコンテナを作成しています。これを行うには、uwsgiのデフォルトのDebianインストールをスクリプトとして使用init.dしますpip

ところで、サービスを開始するたびにスクリプトを起動できないというエラーが出力されますが、サーバ()に要求をしたり、次を使ってプロセスがlocalhost:5000実行中かどうかを確認しようとするとps aux | grep -i uwsgi

私が意味するものの例:

root@f16b3268a956:~# /etc/init.d/uwsgi start
[FAIL] Starting app server(s): uwsgi -> ! failed!

しかし、実行中のプロセスを見ると

root@f16b3268a956:~# ps aux | grep -i uwsgi
user       984  0.1  2.8 235284 57876 ?        S    14:15   0:00 /usr/local/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/portal.ini --daemonize /var/log/uwsgi/app/portal.log
user      1009  0.0  2.7 253204 57040 ?        S    14:15   0:00 /usr/local/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/portal.ini --daemonize /var/log/uwsgi/app/portal.log
root      1146  0.0  0.0  12860   976 pts/0    S+   14:24   0:00 grep -i uwsgi

私のuwsgi設定内容:

[uwsgi]
http-socket = localhost:5000
http-websockets = true
chmod-socket=775
chdir = /home/user/
master = true
binary-path = /usr/local/bin/uwsgi
virtualenv = /home/user/portal
module = portal.server:app
uid = user
gid = user
processes = 1
gevent = 1000
logfile2 = /tmp/test.pid
logto = /var/log/uwsgi/app/portal.log

ログファイルを見ても奇妙なものは表示されません。

root@f16b3268a956:~# cat /var/log/uwsgi/app/portal.log
Thu Oct 25 14:29:48 2018 - *** Starting uWSGI 2.0.17.1 (64bit) on [Thu Oct 25 14:29:48 2018] ***
Thu Oct 25 14:29:48 2018 - compiled with version: 6.3.0 20170516 on 25 October 2018 13:26:09
Thu Oct 25 14:29:48 2018 - os: Linux-4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018
Thu Oct 25 14:29:48 2018 - nodename: f16b3268a956
Thu Oct 25 14:29:48 2018 - machine: x86_64
Thu Oct 25 14:29:48 2018 - clock source: unix
Thu Oct 25 14:29:48 2018 - pcre jit disabled
Thu Oct 25 14:29:48 2018 - detected number of CPU cores: 4
Thu Oct 25 14:29:48 2018 - current working directory: /
Thu Oct 25 14:29:48 2018 - writing pidfile to /run/uwsgi/app/portal/pid
Thu Oct 25 14:29:48 2018 - detected binary path: /usr/local/bin/uwsgi
Thu Oct 25 14:29:48 2018 - setgid() to 1000
Thu Oct 25 14:29:48 2018 - setuid() to 1000
Thu Oct 25 14:29:48 2018 - chdir() to /home/user/
Thu Oct 25 14:29:48 2018 - writing pidfile to /tmp/test.pid
Thu Oct 25 14:29:48 2018 - your memory page size is 4096 bytes
Thu Oct 25 14:29:48 2018 - detected max file descriptor number: 1048576
Thu Oct 25 14:29:48 2018 - - async cores set to 1000 - fd table size: 1048576
Thu Oct 25 14:29:48 2018 - lock engine: pthread robust mutexes
Thu Oct 25 14:29:48 2018 - thunder lock: disabled (you can enable it with --thunder-lock)
Thu Oct 25 14:29:48 2018 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/portal/socket fd 3
Thu Oct 25 14:29:48 2018 - uwsgi socket 1 bound to TCP address localhost:5000 fd 5
Thu Oct 25 14:29:48 2018 - Python version: 3.6.6 (default, Sep  5 2018, 03:40:52)  [GCC 6.3.0 20170516]
Thu Oct 25 14:29:48 2018 - Set PythonHome to /home/user/portal
Thu Oct 25 14:29:48 2018 - Python main interpreter initialized at 0x563332cd13a0
Thu Oct 25 14:29:48 2018 - python threads support enabled
Thu Oct 25 14:29:48 2018 - your server socket listen backlog is limited to 100 connections
Thu Oct 25 14:29:48 2018 - your mercy for graceful operations on workers is 60 seconds
Thu Oct 25 14:29:48 2018 - mapped 21036928 bytes (20543 KB) for 1000 cores
Thu Oct 25 14:29:48 2018 - *** Operational MODE: async ***
Thu Oct 25 14:29:49 2018 - WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x563332cd13a0 pid: 1814 (default app)
Thu Oct 25 14:29:49 2018 - *** uWSGI is running in multiple interpreter mode ***
Thu Oct 25 14:29:49 2018 - spawned uWSGI master process (pid: 1814)
Thu Oct 25 14:29:49 2018 - spawned uWSGI worker 1 (pid: 1839, cores: 1000)
Thu Oct 25 14:29:49 2018 - *** running gevent loop engine [addr:0x5633314d0fd0] ***

この問題を解決する方法を知っている人はいますか?

ベストアンサー1

結局私のイメージに基づいてこの問題を解決しました。Next Docker イメージinit.dプロセスの代わりにSupervisordを使用します(systemctlなし)。

おすすめ記事