修改Gunicorn的测试命令,调试中,未完成

This commit is contained in:
2025-08-29 22:29:38 +08:00
parent c59ba98e8c
commit 0a673cf2bb
9 changed files with 715 additions and 37 deletions

Binary file not shown.

347
app.log
View File

@@ -174,3 +174,350 @@
2025-08-29 21:28:25.808 | INFO | gunicorn_tab:get_password:317 - 从对话框获取密码,长度: 5
2025-08-29 21:28:27.972 | INFO | gunicorn_tab:get_password:313 - 密码为空,弹出密码输入对话框
2025-08-29 21:28:31.580 | INFO | gunicorn_tab:get_password:317 - 从对话框获取密码,长度: 5
2025-08-29 21:36:53.095 | INFO | __main__:<module>:109 - 应用程序启动
2025-08-29 21:36:53.131 | INFO | remote_command_tab:load_git_config:109 - 从配置文件加载git配置: git_url=http://192.168.3.241:3000/xiaji/webstatus, project_path=/home/xiaji/
2025-08-29 21:36:53.132 | INFO | django_tab:load_django_path:116 - 从当前服务器配置加载Django路径: /home/xiaji/
2025-08-29 21:36:53.133 | INFO | django_tab:__init__:22 - Django标签已连接到服务器切换信号
2025-08-29 21:36:53.134 | INFO | gunicorn_tab:load_gunicorn_config:191 - 从当前服务器配置加载Gunicorn配置: remote_directory=/home/xiaji/, project_name=statuspage
2025-08-29 21:36:53.134 | INFO | gunicorn_tab:__init__:50 - Gunicorn标签已连接到服务器切换信号
2025-08-29 21:36:54.962 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 21:36:58.903 | INFO | gunicorn_tab:test_gunicorn:376 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 21:36:58.909 | INFO | gunicorn_tab:test_gunicorn:383 - 创建Gunicorn测试线程
2025-08-29 21:36:58.909 | INFO | threads:__init__:733 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 21:36:58.909 | INFO | gunicorn_tab:test_gunicorn:390 - Gunicorn测试线程已启动
2025-08-29 21:36:59.013 | INFO | threads:run:761 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 21:36:59.014 | INFO | threads:run:775 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 21:36:59.014 | INFO | threads:run:781 - 执行Gunicorn测试命令: cd /home/xiaji/ && timeout 10 gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:37:02.091 | INFO | threads:run:788 - Gunicorn进程检查结果: xiaji 81565 0.0 0.1 5756 1948 ? Ss 21:36 0:00 timeout 10 gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 81566 2.9 1.3 35456 23372 ? S 21:36 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 81567 6.5 2.5 57116 43136 ? S 21:36 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 81572 0.0 0.2 7432 3624 ? Ss 21:37 0:00 bash -c ps aux | grep gunicorn
xiaji 81574 0.0 0.1 6620 2356 ? S 21:37 0:00 grep gunicorn
2025-08-29 21:37:02.137 | INFO | threads:run:796 - Gunicorn测试成功 - 项目: statuspage, 端口: 8000
2025-08-29 21:37:02.138 | INFO | gunicorn_tab:on_test_gunicorn_result:397 - Gunicorn测试成功: Gunicorn测试成功 - 项目: statuspage, 端口: 8000
2025-08-29 21:45:55.296 | INFO | __main__:<module>:109 - 应用程序启动
2025-08-29 21:45:55.335 | INFO | remote_command_tab:load_git_config:109 - 从配置文件加载git配置: git_url=http://192.168.3.241:3000/xiaji/webstatus, project_path=/home/xiaji/
2025-08-29 21:45:55.336 | INFO | django_tab:load_django_path:116 - 从当前服务器配置加载Django路径: /home/xiaji/
2025-08-29 21:45:55.337 | INFO | django_tab:__init__:22 - Django标签已连接到服务器切换信号
2025-08-29 21:45:55.338 | INFO | gunicorn_tab:load_gunicorn_config:191 - 从当前服务器配置加载Gunicorn配置: remote_directory=/home/xiaji/, project_name=statuspage
2025-08-29 21:45:55.338 | INFO | gunicorn_tab:__init__:50 - Gunicorn标签已连接到服务器切换信号
2025-08-29 21:46:06.581 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 21:46:11.901 | INFO | gunicorn_tab:test_gunicorn:376 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 21:46:11.907 | INFO | gunicorn_tab:test_gunicorn:383 - 创建Gunicorn测试线程
2025-08-29 21:46:11.907 | INFO | threads:__init__:782 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 21:46:11.907 | INFO | gunicorn_tab:test_gunicorn:390 - Gunicorn测试线程已启动
2025-08-29 21:46:12.007 | INFO | threads:run:810 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 21:46:12.007 | INFO | threads:run:824 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 21:46:12.007 | INFO | threads:run:830 - 执行Gunicorn测试命令: cd /home/xiaji/ && timeout 10 gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:46:15.091 | INFO | threads:run:837 - Gunicorn进程检查结果: xiaji 82188 0.0 0.1 5756 1948 ? Ss 21:46 0:00 timeout 10 gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82189 2.9 1.3 35456 23348 ? S 21:46 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82190 6.5 2.5 57116 43104 ? S 21:46 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82191 0.0 0.2 7432 3660 ? Ss 21:46 0:00 bash -c ps aux | grep gunicorn
xiaji 82193 0.0 0.1 6620 2380 ? S 21:46 0:00 grep gunicorn
2025-08-29 21:46:15.137 | INFO | threads:run:844 - Gunicorn进程运行正常开始检查端口8000访问情况
2025-08-29 21:46:15.167 | INFO | threads:run:850 - ss命令检查端口8000结果:
2025-08-29 21:46:15.219 | INFO | threads:run:856 - netstat命令检查端口8000结果:
2025-08-29 21:46:15.219 | ERROR | threads:run:894 - Gunicorn进程运行正常但端口8000未处于LISTEN状态
2025-08-29 21:46:15.221 | ERROR | gunicorn_tab:on_test_gunicorn_result:400 - Gunicorn测试失败: Gunicorn进程运行正常但端口8000未处于LISTEN状态
2025-08-29 21:48:51.485 | INFO | __main__:<module>:109 - 应用程序启动
2025-08-29 21:48:51.522 | INFO | remote_command_tab:load_git_config:109 - 从配置文件加载git配置: git_url=http://192.168.3.241:3000/xiaji/webstatus, project_path=/home/xiaji/
2025-08-29 21:48:51.524 | INFO | django_tab:load_django_path:116 - 从当前服务器配置加载Django路径: /home/xiaji/
2025-08-29 21:48:51.524 | INFO | django_tab:__init__:22 - Django标签已连接到服务器切换信号
2025-08-29 21:48:51.526 | INFO | gunicorn_tab:load_gunicorn_config:191 - 从当前服务器配置加载Gunicorn配置: remote_directory=/home/xiaji/, project_name=statuspage
2025-08-29 21:48:51.527 | INFO | gunicorn_tab:__init__:50 - Gunicorn标签已连接到服务器切换信号
2025-08-29 21:48:53.359 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 21:48:55.810 | INFO | gunicorn_tab:test_gunicorn:376 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 21:48:55.816 | INFO | gunicorn_tab:test_gunicorn:383 - 创建Gunicorn测试线程
2025-08-29 21:48:55.816 | INFO | threads:__init__:782 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 21:48:55.816 | INFO | gunicorn_tab:test_gunicorn:390 - Gunicorn测试线程已启动
2025-08-29 21:48:55.914 | INFO | threads:run:810 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 21:48:55.914 | INFO | threads:run:824 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 21:48:55.914 | INFO | threads:run:829 - 检查端口8000是否被其他进程占用
2025-08-29 21:48:55.969 | INFO | threads:run:841 - 端口8000未被占用
2025-08-29 21:48:55.969 | INFO | threads:run:845 - 执行Gunicorn测试命令: cd /home/xiaji/ && timeout 10 gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:48:59.049 | INFO | threads:run:852 - Gunicorn进程检查结果: xiaji 82445 0.0 0.1 5756 1944 ? Ss 21:48 0:00 timeout 10 gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82446 2.9 1.3 35456 23440 ? S 21:48 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82447 6.5 2.5 57116 43164 ? S 21:48 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 1 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82452 0.0 0.2 7432 3564 ? Ss 21:48 0:00 bash -c ps aux | grep gunicorn
xiaji 82454 0.0 0.1 6620 2380 ? S 21:48 0:00 grep gunicorn
2025-08-29 21:48:59.050 | INFO | threads:run:856 - 检测到Gunicorn Worker进程数量: 4
2025-08-29 21:48:59.096 | INFO | threads:run:872 - Gunicorn进程运行正常开始检查端口8000访问情况
2025-08-29 21:48:59.112 | INFO | threads:run:878 - ss命令检查端口8000结果: tcp LISTEN 0 2048 0.0.0.0:8000 0.0.0.0:* users:(("gunicorn",pid=82447,fd=5),("gunicorn",pid=82446,fd=5))
2025-08-29 21:48:59.112 | INFO | threads:run:892 - 端口8000处于LISTEN状态开始本地请求测试
2025-08-29 21:48:59.176 | INFO | threads:run:899 - curl本地请求测试退出状态: 7
2025-08-29 21:48:59.177 | INFO | threads:run:900 - curl本地请求测试输出:
2025-08-29 21:48:59.177 | ERROR | threads:run:918 - Gunicorn进程运行正常但本地请求失败:
2025-08-29 21:48:59.178 | ERROR | gunicorn_tab:on_test_gunicorn_result:400 - Gunicorn测试失败: Gunicorn进程运行正常但本地请求失败:
2025-08-29 21:52:42.996 | INFO | __main__:<module>:109 - 应用程序启动
2025-08-29 21:52:43.035 | INFO | remote_command_tab:load_git_config:109 - 从配置文件加载git配置: git_url=http://192.168.3.241:3000/xiaji/webstatus, project_path=/home/xiaji/
2025-08-29 21:52:43.036 | INFO | django_tab:load_django_path:116 - 从当前服务器配置加载Django路径: /home/xiaji/
2025-08-29 21:52:43.036 | INFO | django_tab:__init__:22 - Django标签已连接到服务器切换信号
2025-08-29 21:52:43.037 | INFO | gunicorn_tab:load_gunicorn_config:191 - 从当前服务器配置加载Gunicorn配置: remote_directory=/home/xiaji/, project_name=statuspage
2025-08-29 21:52:43.038 | INFO | gunicorn_tab:__init__:50 - Gunicorn标签已连接到服务器切换信号
2025-08-29 21:52:45.467 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 21:52:48.446 | INFO | gunicorn_tab:test_gunicorn:376 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 21:52:48.452 | INFO | gunicorn_tab:test_gunicorn:383 - 创建Gunicorn测试线程
2025-08-29 21:52:48.452 | INFO | threads:__init__:782 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 21:52:48.452 | INFO | gunicorn_tab:test_gunicorn:390 - Gunicorn测试线程已启动
2025-08-29 21:52:48.545 | INFO | threads:run:810 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 21:52:48.545 | INFO | threads:run:824 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 21:52:48.545 | INFO | threads:run:829 - 检查端口8000是否被其他进程占用
2025-08-29 21:52:48.601 | INFO | threads:run:841 - 端口8000未被占用
2025-08-29 21:52:48.601 | INFO | threads:run:845 - 执行Gunicorn测试命令: cd /home/xiaji/ && timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:52:51.683 | INFO | threads:run:852 - Gunicorn进程检查结果: xiaji 82777 0.0 0.1 5756 1944 ? Ss 21:52 0:00 timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82778 2.9 1.3 35456 23464 ? S 21:52 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82779 6.5 2.5 57116 43028 ? S 21:52 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82780 6.6 2.5 57116 43216 ? S 21:52 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82781 6.7 2.5 57116 43352 ? S 21:52 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82782 6.6 2.5 57116 43168 ? S 21:52 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 82787 0.0 0.2 7432 3624 ? Ss 21:52 0:00 bash -c ps aux | grep gunicorn
xiaji 82789 0.0 0.1 6620 2380 ? S 21:52 0:00 grep gunicorn
2025-08-29 21:52:51.685 | INFO | threads:run:856 - 检测到Gunicorn Worker进程数量: 7
2025-08-29 21:52:51.686 | WARNING | threads:run:877 - 未检测到Gunicorn主进程
2025-08-29 21:52:51.686 | INFO | threads:run:880 - 检测到6个Gunicorn Worker进程:
2025-08-29 21:52:51.687 | INFO | threads:run:882 - - Worker PID: 82777, 命令: timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:52:51.687 | INFO | threads:run:882 - - Worker PID: 82778, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:52:51.687 | INFO | threads:run:882 - - Worker PID: 82779, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:52:51.688 | INFO | threads:run:882 - - Worker PID: 82780, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:52:51.688 | INFO | threads:run:882 - - Worker PID: 82781, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:52:51.688 | INFO | threads:run:882 - - Worker PID: 82782, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:52:51.688 | ERROR | threads:run:892 - Gunicorn进程结构异常: 未检测到完整的进程结构
2025-08-29 21:52:51.730 | INFO | threads:run:908 - Gunicorn进程运行正常开始检查端口8000访问情况
2025-08-29 21:52:51.748 | INFO | threads:run:914 - ss命令检查端口8000结果: tcp LISTEN 0 2048 0.0.0.0:8000 0.0.0.0:* users:(("gunicorn",pid=82782,fd=5),("gunicorn",pid=82781,fd=5),("gunicorn",pid=82780,fd=5),("gunicorn",pid=82779,fd=5),("gunicorn",pid=82778,fd=5))
2025-08-29 21:52:51.749 | INFO | threads:run:928 - 端口8000处于LISTEN状态开始本地请求测试
2025-08-29 21:52:51.816 | INFO | threads:run:935 - curl本地请求测试退出状态: 7
2025-08-29 21:52:51.816 | INFO | threads:run:936 - curl本地请求测试输出:
2025-08-29 21:52:51.817 | ERROR | threads:run:954 - Gunicorn进程运行正常但本地请求失败:
2025-08-29 21:52:51.817 | ERROR | gunicorn_tab:on_test_gunicorn_result:400 - Gunicorn测试失败: Gunicorn进程运行正常但本地请求失败:
2025-08-29 21:54:54.164 | ERROR | threads:run:212 - 设置时区失败: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
2025-08-29 21:54:54.165 | ERROR | remote_command_tab:on_set_timezone_and_restart_result:227 - 时区设置失败: 设置时区失败: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
2025-08-29 21:54:58.248 | ERROR | threads:run:212 - 设置时区失败: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
2025-08-29 21:54:58.250 | ERROR | remote_command_tab:on_set_timezone_and_restart_result:227 - 时区设置失败: 设置时区失败: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
2025-08-29 21:56:46.766 | INFO | __main__:<module>:109 - 应用程序启动
2025-08-29 21:56:46.805 | INFO | remote_command_tab:load_git_config:109 - 从配置文件加载git配置: git_url=http://192.168.3.241:3000/xiaji/webstatus, project_path=/home/xiaji/
2025-08-29 21:56:46.807 | INFO | django_tab:load_django_path:116 - 从当前服务器配置加载Django路径: /home/xiaji/
2025-08-29 21:56:46.808 | INFO | django_tab:__init__:22 - Django标签已连接到服务器切换信号
2025-08-29 21:56:46.809 | INFO | gunicorn_tab:load_gunicorn_config:191 - 从当前服务器配置加载Gunicorn配置: remote_directory=/home/xiaji/, project_name=statuspage
2025-08-29 21:56:46.809 | INFO | gunicorn_tab:__init__:50 - Gunicorn标签已连接到服务器切换信号
2025-08-29 21:56:50.185 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 21:56:56.545 | INFO | threads:run:220 - 时区设置成功,服务器正在重启
2025-08-29 21:56:56.547 | INFO | remote_command_tab:on_set_timezone_and_restart_result:229 - 时区设置成功: 时区设置成功,服务器正在重启
2025-08-29 21:57:18.743 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 21:57:22.397 | INFO | gunicorn_tab:test_gunicorn:376 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 21:57:22.404 | INFO | gunicorn_tab:test_gunicorn:383 - 创建Gunicorn测试线程
2025-08-29 21:57:22.405 | INFO | threads:__init__:786 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 21:57:22.405 | INFO | gunicorn_tab:test_gunicorn:390 - Gunicorn测试线程已启动
2025-08-29 21:57:22.748 | INFO | threads:run:814 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 21:57:22.748 | INFO | threads:run:828 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 21:57:22.748 | INFO | threads:run:833 - 检查端口8000是否被其他进程占用
2025-08-29 21:57:22.807 | INFO | threads:run:845 - 端口8000未被占用
2025-08-29 21:57:22.807 | INFO | threads:run:849 - 执行Gunicorn测试命令: cd /home/xiaji/ && timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:57:25.886 | INFO | threads:run:856 - Gunicorn进程检查结果: xiaji 1304 0.0 0.1 5756 1948 ? Ss 21:57 0:00 timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1305 2.9 1.3 35456 23456 ? S 21:57 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1306 7.1 2.5 57116 43028 ? S 21:57 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1307 6.9 2.5 57116 43164 ? S 21:57 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1317 6.4 2.5 57116 43128 ? S 21:57 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1318 6.7 2.5 57116 43008 ? S 21:57 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1319 0.0 0.2 7432 3624 ? Ss 21:57 0:00 bash -c ps aux | grep gunicorn
xiaji 1321 0.0 0.1 6620 2356 ? S 21:57 0:00 grep gunicorn
2025-08-29 21:57:25.886 | INFO | threads:run:860 - 检测到Gunicorn Worker进程数量: 7
2025-08-29 21:57:25.886 | WARNING | threads:run:881 - 未检测到Gunicorn主进程
2025-08-29 21:57:25.887 | INFO | threads:run:884 - 检测到6个Gunicorn Worker进程:
2025-08-29 21:57:25.887 | INFO | threads:run:886 - - Worker PID: 1304, 命令: timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:57:25.887 | INFO | threads:run:886 - - Worker PID: 1305, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:57:25.887 | INFO | threads:run:886 - - Worker PID: 1306, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:57:25.887 | INFO | threads:run:886 - - Worker PID: 1307, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:57:25.887 | INFO | threads:run:886 - - Worker PID: 1317, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:57:25.887 | INFO | threads:run:886 - - Worker PID: 1318, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 21:57:25.887 | ERROR | threads:run:896 - Gunicorn进程结构异常: 未检测到完整的进程结构
2025-08-29 21:57:25.930 | INFO | threads:run:912 - Gunicorn进程运行正常开始检查端口8000访问情况
2025-08-29 21:57:25.963 | INFO | threads:run:918 - ss命令检查端口8000结果:
2025-08-29 21:57:26.014 | INFO | threads:run:924 - netstat命令检查端口8000结果:
2025-08-29 21:57:26.015 | ERROR | threads:run:962 - Gunicorn进程运行正常但端口8000未处于LISTEN状态
2025-08-29 21:57:26.016 | ERROR | gunicorn_tab:on_test_gunicorn_result:400 - Gunicorn测试失败: Gunicorn进程运行正常但端口8000未处于LISTEN状态
2025-08-29 21:57:59.725 | INFO | threads:run:220 - 时区设置成功,服务器正在重启
2025-08-29 21:57:59.727 | INFO | remote_command_tab:on_set_timezone_and_restart_result:229 - 时区设置成功: 时区设置成功,服务器正在重启
2025-08-29 21:58:15.356 | INFO | gunicorn_tab:test_gunicorn:376 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 21:58:15.360 | INFO | gunicorn_tab:test_gunicorn:383 - 创建Gunicorn测试线程
2025-08-29 21:58:15.361 | INFO | threads:__init__:786 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 21:58:15.361 | INFO | gunicorn_tab:test_gunicorn:390 - Gunicorn测试线程已启动
2025-08-29 21:58:15.362 | ERROR | threads:run:984 - Gunicorn测试异常: SSH session not active
2025-08-29 21:58:15.366 | ERROR | gunicorn_tab:on_test_gunicorn_result:400 - Gunicorn测试失败: SSH session not active
2025-08-29 21:58:20.132 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 21:58:24.282 | INFO | gunicorn_tab:get_password:314 - 密码为空,弹出密码输入对话框
2025-08-29 21:58:27.627 | WARNING | gunicorn_tab:get_password:323 - 用户取消了密码输入
2025-08-29 22:10:48.195 | INFO | gunicorn_tab:test_gunicorn:376 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 22:10:48.198 | INFO | gunicorn_tab:test_gunicorn:383 - 创建Gunicorn测试线程
2025-08-29 22:10:48.198 | INFO | threads:__init__:786 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 22:10:48.199 | INFO | gunicorn_tab:test_gunicorn:390 - Gunicorn测试线程已启动
2025-08-29 22:10:48.635 | INFO | threads:run:814 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 22:10:48.635 | INFO | threads:run:828 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 22:10:48.636 | INFO | threads:run:833 - 检查端口8000是否被其他进程占用
2025-08-29 22:10:48.695 | INFO | threads:run:845 - 端口8000未被占用
2025-08-29 22:10:48.696 | INFO | threads:run:849 - 执行Gunicorn测试命令: cd /home/xiaji/ && timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:10:51.768 | INFO | threads:run:856 - Gunicorn进程检查结果: xiaji 1922 0.0 0.1 5756 1948 ? Ss 22:10 0:00 timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1923 2.9 1.3 35456 23328 ? S 22:10 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1924 7.2 2.5 57116 42888 ? S 22:10 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1925 7.3 2.5 57116 42980 ? S 22:10 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1926 7.0 2.5 57060 42932 ? S 22:10 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1927 7.2 2.5 57060 42888 ? S 22:10 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 1932 0.0 0.2 7432 3500 ? Ss 22:10 0:00 bash -c ps aux | grep gunicorn
xiaji 1934 0.0 0.1 6620 2272 ? S 22:10 0:00 grep gunicorn
2025-08-29 22:10:51.768 | INFO | threads:run:860 - 检测到Gunicorn Worker进程数量: 7
2025-08-29 22:10:51.769 | WARNING | threads:run:881 - 未检测到Gunicorn主进程
2025-08-29 22:10:51.769 | INFO | threads:run:884 - 检测到6个Gunicorn Worker进程:
2025-08-29 22:10:51.769 | INFO | threads:run:886 - - Worker PID: 1922, 命令: timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:10:51.770 | INFO | threads:run:886 - - Worker PID: 1923, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:10:51.770 | INFO | threads:run:886 - - Worker PID: 1924, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:10:51.770 | INFO | threads:run:886 - - Worker PID: 1925, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:10:51.770 | INFO | threads:run:886 - - Worker PID: 1926, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:10:51.770 | INFO | threads:run:886 - - Worker PID: 1927, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:10:51.770 | ERROR | threads:run:896 - Gunicorn进程结构异常: 未检测到完整的进程结构
2025-08-29 22:10:51.815 | INFO | threads:run:912 - Gunicorn进程运行正常开始检查端口8000访问情况
2025-08-29 22:10:51.851 | INFO | threads:run:918 - ss命令检查端口8000结果:
2025-08-29 22:10:51.902 | INFO | threads:run:924 - netstat命令检查端口8000结果:
2025-08-29 22:10:51.902 | ERROR | threads:run:962 - Gunicorn进程运行正常但端口8000未处于LISTEN状态
2025-08-29 22:10:51.904 | ERROR | gunicorn_tab:on_test_gunicorn_result:400 - Gunicorn测试失败: Gunicorn进程运行正常但端口8000未处于LISTEN状态
2025-08-29 22:13:06.837 | INFO | __main__:<module>:109 - 应用程序启动
2025-08-29 22:13:06.877 | INFO | remote_command_tab:load_git_config:109 - 从配置文件加载git配置: git_url=http://192.168.3.241:3000/xiaji/webstatus, project_path=/home/xiaji/
2025-08-29 22:13:06.878 | INFO | django_tab:load_django_path:116 - 从当前服务器配置加载Django路径: /home/xiaji/
2025-08-29 22:13:06.879 | INFO | django_tab:__init__:22 - Django标签已连接到服务器切换信号
2025-08-29 22:13:06.880 | INFO | gunicorn_tab:load_gunicorn_config:191 - 从当前服务器配置加载Gunicorn配置: remote_directory=/home/xiaji/, project_name=statuspage
2025-08-29 22:13:06.880 | INFO | gunicorn_tab:__init__:50 - Gunicorn标签已连接到服务器切换信号
2025-08-29 22:13:08.565 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 22:13:11.176 | INFO | gunicorn_tab:test_gunicorn:374 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 22:13:11.184 | INFO | gunicorn_tab:test_gunicorn:381 - 创建Gunicorn测试线程
2025-08-29 22:13:11.185 | INFO | threads:__init__:786 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 22:13:11.185 | INFO | gunicorn_tab:test_gunicorn:388 - Gunicorn测试线程已启动
2025-08-29 22:13:11.278 | INFO | threads:run:814 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 22:13:11.278 | INFO | threads:run:828 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 22:13:11.279 | INFO | threads:run:833 - 检查端口8000是否被其他进程占用
2025-08-29 22:13:11.334 | INFO | threads:run:845 - 端口8000未被占用
2025-08-29 22:13:11.334 | INFO | threads:run:849 - 执行Gunicorn测试命令: cd /home/xiaji/ && timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:13:14.409 | INFO | threads:run:856 - Gunicorn进程检查结果: xiaji 2165 0.0 0.1 5756 1948 ? Ss 22:13 0:00 timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 2166 2.9 1.3 35456 23432 ? S 22:13 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 2167 6.5 2.5 57116 43008 ? S 22:13 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 2168 6.5 2.5 57116 43228 ? S 22:13 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 2169 6.6 2.5 57116 43068 ? S 22:13 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 2171 6.5 2.5 57116 43080 ? S 22:13 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 2177 0.0 0.2 7432 3468 ? Ss 22:13 0:00 bash -c ps aux | grep gunicorn
xiaji 2179 0.0 0.1 6620 2360 ? S 22:13 0:00 grep gunicorn
2025-08-29 22:13:14.411 | INFO | threads:run:860 - 检测到Gunicorn Worker进程数量: 7
2025-08-29 22:13:14.411 | WARNING | threads:run:881 - 未检测到Gunicorn主进程
2025-08-29 22:13:14.412 | INFO | threads:run:884 - 检测到6个Gunicorn Worker进程:
2025-08-29 22:13:14.412 | INFO | threads:run:886 - - Worker PID: 2165, 命令: timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:13:14.413 | INFO | threads:run:886 - - Worker PID: 2166, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:13:14.413 | INFO | threads:run:886 - - Worker PID: 2167, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:13:14.414 | INFO | threads:run:886 - - Worker PID: 2168, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:13:14.414 | INFO | threads:run:886 - - Worker PID: 2169, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:13:14.414 | INFO | threads:run:886 - - Worker PID: 2171, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:13:14.415 | ERROR | threads:run:896 - Gunicorn进程结构异常: 未检测到完整的进程结构
2025-08-29 22:13:14.454 | INFO | threads:run:912 - Gunicorn进程运行正常开始检查端口8000访问情况
2025-08-29 22:13:14.473 | INFO | threads:run:918 - ss命令检查端口8000结果: tcp LISTEN 0 2048 0.0.0.0:8000 0.0.0.0:* users:(("gunicorn",pid=2171,fd=5),("gunicorn",pid=2169,fd=5),("gunicorn",pid=2168,fd=5),("gunicorn",pid=2167,fd=5),("gunicorn",pid=2166,fd=5))
2025-08-29 22:13:14.473 | INFO | threads:run:932 - 端口8000处于LISTEN状态开始本地请求测试
2025-08-29 22:13:14.545 | INFO | threads:run:939 - curl本地请求测试退出状态: 7
2025-08-29 22:13:14.546 | INFO | threads:run:940 - curl本地请求测试输出:
2025-08-29 22:13:14.546 | ERROR | threads:run:958 - Gunicorn进程运行正常但本地请求失败:
2025-08-29 22:13:14.548 | ERROR | gunicorn_tab:on_test_gunicorn_result:398 - Gunicorn测试失败: Gunicorn进程运行正常但本地请求失败:
2025-08-29 22:27:39.503 | INFO | __main__:<module>:109 - 应用程序启动
2025-08-29 22:27:39.541 | INFO | remote_command_tab:load_git_config:109 - 从配置文件加载git配置: git_url=http://192.168.3.241:3000/xiaji/webstatus, project_path=/home/xiaji/
2025-08-29 22:27:39.542 | INFO | django_tab:load_django_path:116 - 从当前服务器配置加载Django路径: /home/xiaji/
2025-08-29 22:27:39.542 | INFO | django_tab:__init__:22 - Django标签已连接到服务器切换信号
2025-08-29 22:27:39.544 | INFO | gunicorn_tab:load_gunicorn_config:191 - 从当前服务器配置加载Gunicorn配置: remote_directory=/home/xiaji/, project_name=statuspage
2025-08-29 22:27:39.544 | INFO | gunicorn_tab:__init__:50 - Gunicorn标签已连接到服务器切换信号
2025-08-29 22:27:41.933 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 22:27:43.649 | INFO | gunicorn_tab:test_gunicorn:374 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 22:27:43.657 | INFO | gunicorn_tab:test_gunicorn:381 - 创建Gunicorn测试线程
2025-08-29 22:27:43.658 | INFO | threads:__init__:786 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 22:27:43.658 | INFO | gunicorn_tab:test_gunicorn:388 - Gunicorn测试线程已启动
2025-08-29 22:27:43.753 | INFO | threads:run:814 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 22:27:43.753 | INFO | threads:run:828 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 22:27:43.754 | INFO | threads:run:833 - 检查端口8000是否被其他进程占用
2025-08-29 22:27:43.808 | INFO | threads:run:845 - 端口8000未被占用
2025-08-29 22:27:43.808 | INFO | threads:run:849 - 执行Gunicorn测试命令: cd /home/xiaji/ && timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:27:46.881 | INFO | threads:run:856 - Gunicorn进程检查结果: xiaji 3008 0.0 0.1 5756 1948 ? Ss 22:27 0:00 timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3009 3.3 1.3 35456 23460 ? S 22:27 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3010 6.5 2.5 57116 43036 ? S 22:27 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3011 6.5 2.5 57116 43128 ? S 22:27 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3012 6.7 2.5 57116 43040 ? S 22:27 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3013 6.7 2.5 57116 43132 ? S 22:27 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3014 0.0 0.2 7432 3500 ? Ss 22:27 0:00 bash -c ps aux | grep gunicorn
xiaji 3016 0.0 0.1 6620 2380 ? S 22:27 0:00 grep gunicorn
2025-08-29 22:27:46.882 | INFO | threads:run:860 - 检测到Gunicorn Worker进程数量: 7
2025-08-29 22:27:46.882 | WARNING | threads:run:881 - 未检测到Gunicorn主进程
2025-08-29 22:27:46.882 | INFO | threads:run:884 - 检测到6个Gunicorn Worker进程:
2025-08-29 22:27:46.882 | INFO | threads:run:886 - - Worker PID: 3008, 命令: timeout 10 gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:27:46.882 | INFO | threads:run:886 - - Worker PID: 3009, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:27:46.883 | INFO | threads:run:886 - - Worker PID: 3010, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:27:46.883 | INFO | threads:run:886 - - Worker PID: 3011, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:27:46.883 | INFO | threads:run:886 - - Worker PID: 3012, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:27:46.883 | INFO | threads:run:886 - - Worker PID: 3013, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:27:46.883 | ERROR | threads:run:896 - Gunicorn进程结构异常: 未检测到完整的进程结构
2025-08-29 22:27:46.928 | INFO | threads:run:912 - Gunicorn进程运行正常开始检查端口8000访问情况
2025-08-29 22:27:46.953 | INFO | threads:run:918 - ss命令检查端口8000结果: tcp LISTEN 0 2048 0.0.0.0:8000 0.0.0.0:* users:(("gunicorn",pid=3013,fd=5),("gunicorn",pid=3012,fd=5),("gunicorn",pid=3011,fd=5))
2025-08-29 22:27:46.953 | INFO | threads:run:932 - 端口8000处于LISTEN状态开始本地请求测试
2025-08-29 22:27:47.023 | INFO | threads:run:939 - curl本地请求测试退出状态: 7
2025-08-29 22:27:47.024 | INFO | threads:run:940 - curl本地请求测试输出:
2025-08-29 22:27:47.024 | ERROR | threads:run:958 - Gunicorn进程运行正常但本地请求失败:
2025-08-29 22:27:47.025 | ERROR | gunicorn_tab:on_test_gunicorn_result:398 - Gunicorn测试失败: Gunicorn进程运行正常但本地请求失败:
2025-08-29 22:28:56.102 | INFO | __main__:<module>:109 - 应用程序启动
2025-08-29 22:28:56.142 | INFO | remote_command_tab:load_git_config:109 - 从配置文件加载git配置: git_url=http://192.168.3.241:3000/xiaji/webstatus, project_path=/home/xiaji/
2025-08-29 22:28:56.143 | INFO | django_tab:load_django_path:116 - 从当前服务器配置加载Django路径: /home/xiaji/
2025-08-29 22:28:56.144 | INFO | django_tab:__init__:22 - Django标签已连接到服务器切换信号
2025-08-29 22:28:56.145 | INFO | gunicorn_tab:load_gunicorn_config:191 - 从当前服务器配置加载Gunicorn配置: remote_directory=/home/xiaji/, project_name=statuspage
2025-08-29 22:28:56.145 | INFO | gunicorn_tab:__init__:50 - Gunicorn标签已连接到服务器切换信号
2025-08-29 22:28:58.257 | INFO | threads:run:47 - SSH连接成功: 192.168.3.157
2025-08-29 22:29:01.524 | INFO | gunicorn_tab:test_gunicorn:374 - 开始测试GunicornDjango路径: /home/xiaji/, 端口: 8000
2025-08-29 22:29:01.530 | INFO | gunicorn_tab:test_gunicorn:381 - 创建Gunicorn测试线程
2025-08-29 22:29:01.530 | INFO | threads:__init__:786 - GunicornTestThread初始化 - Django路径: /home/xiaji/, 端口: 8000
2025-08-29 22:29:01.530 | INFO | gunicorn_tab:test_gunicorn:388 - Gunicorn测试线程已启动
2025-08-29 22:29:01.619 | INFO | threads:run:814 - 找到wsgi.py文件: /home/xiaji/statuspage/wsgi.py
2025-08-29 22:29:01.620 | INFO | threads:run:828 - 使用项目名: statuspage, 工作目录: /home/xiaji/
2025-08-29 22:29:01.620 | INFO | threads:run:833 - 检查端口8000是否被其他进程占用
2025-08-29 22:29:01.675 | INFO | threads:run:845 - 端口8000未被占用
2025-08-29 22:29:01.676 | INFO | threads:run:849 - 执行Gunicorn测试命令: cd /home/xiaji/ && gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:29:04.746 | INFO | threads:run:856 - Gunicorn进程检查结果: xiaji 3215 3.3 1.3 35456 23456 ? Ss 22:29 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3217 6.5 2.5 57116 43172 ? S 22:29 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3218 6.7 2.5 57116 42960 ? S 22:29 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3222 6.5 2.5 57116 42972 ? S 22:29 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3223 6.6 2.5 57116 43064 ? S 22:29 0:00 /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
xiaji 3224 0.0 0.2 7432 3484 ? Ss 22:29 0:00 bash -c ps aux | grep gunicorn
xiaji 3226 0.0 0.1 6620 2368 ? S 22:29 0:00 grep gunicorn
2025-08-29 22:29:04.747 | INFO | threads:run:860 - 检测到Gunicorn Worker进程数量: 6
2025-08-29 22:29:04.748 | WARNING | threads:run:881 - 未检测到Gunicorn主进程
2025-08-29 22:29:04.748 | INFO | threads:run:884 - 检测到5个Gunicorn Worker进程:
2025-08-29 22:29:04.749 | INFO | threads:run:886 - - Worker PID: 3215, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:29:04.749 | INFO | threads:run:886 - - Worker PID: 3217, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:29:04.749 | INFO | threads:run:886 - - Worker PID: 3218, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:29:04.750 | INFO | threads:run:886 - - Worker PID: 3222, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:29:04.750 | INFO | threads:run:886 - - Worker PID: 3223, 命令: /usr/bin/python3 /usr/local/bin/gunicorn --workers 4 --bind 0.0.0.0:8000 statuspage.wsgi:application --timeout 5
2025-08-29 22:29:04.750 | ERROR | threads:run:896 - Gunicorn进程结构异常: 未检测到完整的进程结构
2025-08-29 22:29:04.793 | INFO | threads:run:912 - Gunicorn进程运行正常开始检查端口8000访问情况
2025-08-29 22:29:04.809 | INFO | threads:run:918 - ss命令检查端口8000结果: tcp LISTEN 0 2048 0.0.0.0:8000 0.0.0.0:* users:(("gunicorn",pid=3223,fd=5),("gunicorn",pid=3222,fd=5),("gunicorn",pid=3218,fd=5),("gunicorn",pid=3217,fd=5),("gunicorn",pid=3215,fd=5))
2025-08-29 22:29:04.810 | INFO | threads:run:932 - 端口8000处于LISTEN状态开始本地请求测试
2025-08-29 22:29:04.907 | INFO | threads:run:939 - curl本地请求测试退出状态: 56
2025-08-29 22:29:04.907 | INFO | threads:run:940 - curl本地请求测试输出:
2025-08-29 22:29:04.908 | ERROR | threads:run:958 - Gunicorn进程运行正常但本地请求失败:
2025-08-29 22:29:04.908 | ERROR | gunicorn_tab:on_test_gunicorn_result:398 - Gunicorn测试失败: Gunicorn进程运行正常但本地请求失败:

View File

@@ -133,6 +133,18 @@ class DjangoTab(QWidget):
# 不显示警告,避免影响用户体验
QMessageBox.warning(self, "警告", f"加载django路径失败: {str(e)}")
def get_password(self):
"""从父类获取密码"""
if hasattr(self.parent, 'password_input'):
password = self.parent.password_input.text()
if not password:
QMessageBox.warning(self, "警告", "请输入服务器密码")
return None
return password
else:
QMessageBox.warning(self, "警告", "无法获取服务器密码")
return None
def check_ssh_connection(self):
if not self.parent or not self.parent.ssh_client:
QMessageBox.warning(self, "警告", "请先连接服务器")
@@ -143,12 +155,17 @@ class DjangoTab(QWidget):
if not self.check_ssh_connection():
return
# 获取密码
password = self.get_password()
if password is None:
return
self.output_text.append("正在安装Django...")
self.install_django_btn.setEnabled(False)
self.progress_bar.setVisible(True)
self.progress_bar.setValue(0)
self.django_install_thread = DjangoInstallThread(self.parent.ssh_client)
self.django_install_thread = DjangoInstallThread(self.parent.ssh_client, password)
self.django_install_thread.progress_updated.connect(self.update_progress)
self.django_install_thread.result_ready.connect(self.on_install_django_result)
self.django_install_thread.start()

View File

@@ -240,9 +240,8 @@ WorkingDirectory={project_path}
# 所有Gunicorn参数直接在这里配置
ExecStart=/usr/local/bin/gunicorn \\
--bind 0.0.0.0:8000 \\
--workers 3 \\
--workers 4 \\
--worker-class sync \\
--timeout 60 \\
--name {project_name} \\
--access-logfile {project_path}/logs/gunicorn_access.log \\
--error-logfile {project_path}/logs/gunicorn_error.log \\
@@ -280,10 +279,9 @@ Group={username}
WorkingDirectory={project_path}
# 所有Gunicorn参数直接在这里配置
ExecStart=/usr/local/bin/gunicorn \\
--bind 127.0.0.1:{port} \\
--workers $(nproc --all * 2 + 1) \\
--bind 0.0.0.0:{port} \\
--workers 4 \\
--worker-class sync \\
--timeout 60 \\
--name {project_name} \\
--access-logfile {project_path}/logs/gunicorn_access.log \\
--error-logfile {project_path}/logs/gunicorn_error.log \\

View File

@@ -210,10 +210,15 @@ class RemoteCommandTab(QWidget):
if not self.check_ssh_connection():
return
# 获取密码
password = self.get_password()
if password is None:
return
self.output_text.append("正在设置时区为Asia/Shanghai并重启服务器...")
self.set_timezone_btn.setEnabled(False)
self.timezone_thread = SetTimezoneAndRestartThread(self.parent.ssh_client)
self.timezone_thread = SetTimezoneAndRestartThread(self.parent.ssh_client, password)
self.timezone_thread.result_ready.connect(self.on_set_timezone_and_restart_result)
self.timezone_thread.start()
@@ -230,10 +235,15 @@ class RemoteCommandTab(QWidget):
if not self.check_ssh_connection():
return
# 获取密码
password = self.get_password()
if password is None:
return
self.output_text.append("正在检查防火墙状态...")
self.check_firewall_btn.setEnabled(False)
self.firewall_thread = CheckFirewallThread(self.parent.ssh_client)
self.firewall_thread = CheckFirewallThread(self.parent.ssh_client, password)
self.firewall_thread.result_ready.connect(self.on_check_firewall_result)
self.firewall_thread.start()
@@ -254,11 +264,16 @@ class RemoteCommandTab(QWidget):
if not port:
QMessageBox.warning(self, "警告", "请输入要开放的端口号")
return
# 获取密码
password = self.get_password()
if password is None:
return
self.output_text.append(f"正在开放端口 {port}...")
self.open_port_btn.setEnabled(False)
self.open_port_thread = OpenPortThread(self.parent.ssh_client, port)
self.open_port_thread = OpenPortThread(self.parent.ssh_client, port, password)
self.open_port_thread.result_ready.connect(self.on_open_port_result)
self.open_port_thread.start()
@@ -271,6 +286,19 @@ class RemoteCommandTab(QWidget):
self.output_text.append(f"端口开放失败: {message}")
logger.error(f"端口开放失败: {message}")
def get_password(self):
"""获取服务器连接密码"""
if not self.parent or not hasattr(self.parent, 'password_input'):
QMessageBox.warning(self, "警告", "无法获取服务器密码")
return None
password = self.parent.password_input.text()
if not password:
QMessageBox.warning(self, "警告", "请先输入服务器密码")
return None
return password
def check_ssh_connection(self):
if not self.parent or not self.parent.ssh_client:
QMessageBox.warning(self, "警告", "请先连接服务器")

View File

@@ -196,14 +196,15 @@ class DeleteDirectoryThread(QThread):
class SetTimezoneAndRestartThread(QThread):
result_ready = Signal(bool, str)
def __init__(self, ssh_client):
def __init__(self, ssh_client, password):
super().__init__()
self.ssh_client = ssh_client
self.password = password
def run(self):
try:
# 设置时区
stdin, stdout, stderr = self.ssh_client.exec_command("sudo timedatectl set-timezone Asia/Shanghai")
# 设置时区,使用-S选项从标准输入读取密码
stdin, stdout, stderr = self.ssh_client.exec_command(f"echo '{self.password}' | sudo -S timedatectl set-timezone Asia/Shanghai")
exit_status = stdout.channel.recv_exit_status()
if exit_status != 0:
@@ -212,8 +213,8 @@ class SetTimezoneAndRestartThread(QThread):
logger.error(f"设置时区失败: {error}")
return
# 重启服务器
stdin, stdout, stderr = self.ssh_client.exec_command("sudo reboot")
# 重启服务器,使用-S选项从标准输入读取密码
stdin, stdout, stderr = self.ssh_client.exec_command(f"echo '{self.password}' | sudo -S reboot")
self.result_ready.emit(True, "时区设置成功,服务器正在重启")
logger.info("时区设置成功,服务器正在重启")
@@ -227,14 +228,15 @@ class SetTimezoneAndRestartThread(QThread):
class CheckFirewallThread(QThread):
result_ready = Signal(bool, str)
def __init__(self, ssh_client):
def __init__(self, ssh_client, password):
super().__init__()
self.ssh_client = ssh_client
self.password = password
def run(self):
try:
# 检查UFW状态
stdin, stdout, stderr = self.ssh_client.exec_command("sudo ufw status")
# 检查UFW状态,使用-S选项从标准输入读取密码
stdin, stdout, stderr = self.ssh_client.exec_command(f"echo '{self.password}' | sudo -S ufw status")
exit_status = stdout.channel.recv_exit_status()
if exit_status == 0:
@@ -255,20 +257,21 @@ class CheckFirewallThread(QThread):
class OpenPortThread(QThread):
result_ready = Signal(bool, str)
def __init__(self, ssh_client, port):
def __init__(self, ssh_client, port, password):
super().__init__()
self.ssh_client = ssh_client
self.port = port
self.password = password
def run(self):
try:
# 开放端口
stdin, stdout, stderr = self.ssh_client.exec_command(f"sudo ufw allow {self.port}")
# 开放端口,使用-S选项从标准输入读取密码
stdin, stdout, stderr = self.ssh_client.exec_command(f"echo '{self.password}' | sudo -S ufw allow {self.port}")
exit_status = stdout.channel.recv_exit_status()
if exit_status == 0:
# 重新加载防火墙
stdin, stdout, stderr = self.ssh_client.exec_command("sudo ufw reload")
# 重新加载防火墙,使用-S选项从标准输入读取密码
stdin, stdout, stderr = self.ssh_client.exec_command(f"echo '{self.password}' | sudo -S ufw reload")
self.result_ready.emit(True, f"端口 {self.port} 开放成功")
logger.info(f"端口 {self.port} 开放成功")
@@ -287,9 +290,10 @@ class DjangoInstallThread(QThread):
result_ready = Signal(bool, str)
progress_updated = Signal(int)
def __init__(self, ssh_client):
def __init__(self, ssh_client, password):
super().__init__()
self.ssh_client = ssh_client
self.password = password
def run(self):
try:
@@ -320,8 +324,8 @@ class DjangoInstallThread(QThread):
self.progress_updated.emit(50)
# 如果pip安装失败尝试使用apt安装
stdin, stdout, stderr = self.ssh_client.exec_command("sudo apt update && sudo apt install -y python3-django")
# 如果pip安装失败尝试使用apt安装,使用-S选项从标准输入读取密码
stdin, stdout, stderr = self.ssh_client.exec_command(f"echo '{self.password}' | sudo -S apt update && echo '{self.password}' | sudo -S apt install -y python3-django")
exit_status = stdout.channel.recv_exit_status()
if exit_status == 0:
@@ -392,9 +396,58 @@ class DjangoTestThread(QThread):
output = stdout.read().decode()
if "manage.py runserver" in output:
self.progress_updated.emit(100)
self.result_ready.emit(True, "Django测试服务器启动成功")
logger.info("Django测试服务器启动成功")
self.progress_updated.emit(80)
logger.info("Django测试服务器启动成功,开始检查端口访问情况")
# 检查8000端口是否真的在监听
self.progress_updated.emit(85)
stdin, stdout, stderr = self.ssh_client.exec_command("ss -tulnp | grep 8000")
ss_output = stdout.read().decode()
logger.info(f"ss命令检查端口8000结果: {ss_output}")
# 如果ss命令没有结果尝试使用netstat
if not ss_output:
stdin, stdout, stderr = self.ssh_client.exec_command("netstat -tulnp | grep 8000")
netstat_output = stdout.read().decode()
logger.info(f"netstat命令检查端口8000结果: {netstat_output}")
port_check_output = netstat_output
else:
port_check_output = ss_output
# 检查端口是否在LISTEN状态
if "LISTEN" in port_check_output and "8000" in port_check_output:
self.progress_updated.emit(90)
logger.info("端口8000处于LISTEN状态开始本地请求测试")
# 本地发起请求测试
stdin, stdout, stderr = self.ssh_client.exec_command("curl -s http://127.0.0.1:8000")
curl_output = stdout.read().decode()
curl_exit_status = stdout.channel.recv_exit_status()
logger.info(f"curl本地请求测试退出状态: {curl_exit_status}")
logger.info(f"curl本地请求测试输出: {curl_output[:200]}..." if len(curl_output) > 200 else f"curl本地请求测试输出: {curl_output}")
if curl_exit_status == 0:
self.progress_updated.emit(100)
self.result_ready.emit(True, "Django测试服务器启动成功端口访问正常")
logger.info("Django测试服务器启动成功端口访问正常")
else:
# 检查错误类型
if "Failed to connect" in curl_output:
error_msg = "Django测试服务器启动成功但本地请求超时Gunicorn进程可能未正常响应"
elif "Bad Request (400)" in curl_output:
error_msg = "Django测试服务器启动成功但返回400错误可能是ALLOWED_HOSTS配置问题"
elif "500" in curl_output:
error_msg = "Django测试服务器启动成功但返回500错误可能是应用内部错误"
else:
error_msg = f"Django测试服务器启动成功但本地请求失败: {curl_output[:100]}"
self.result_ready.emit(False, error_msg)
logger.error(error_msg)
else:
self.progress_updated.emit(100)
self.result_ready.emit(False, "Django测试服务器启动成功但端口8000未处于LISTEN状态")
logger.error("Django测试服务器启动成功但端口8000未处于LISTEN状态")
else:
self.result_ready.emit(False, "Django测试服务器启动失败")
logger.error("Django测试服务器启动失败")
@@ -776,24 +829,137 @@ class GunicornTestThread(QThread):
self.progress_updated.emit(50)
# 测试Gunicorn启动,使用构造函数中传入的端口参数
test_command = f"cd {self.django_path} && timeout 10 gunicorn --workers 1 --bind 0.0.0.0:{self.port} {project_name}.wsgi:application --timeout 5"
# 在启动Gunicorn前,先检查端口是否被占用
logger.info(f"检查端口{self.port}是否被其他进程占用")
stdin, stdout, stderr = self.ssh_client.exec_command(f"sudo lsof -i :{self.port}")
lsof_output = stdout.read().decode()
lsof_exit_status = stdout.channel.recv_exit_status()
if lsof_exit_status == 0 and lsof_output:
logger.warning(f"端口{self.port}已被其他进程占用: {lsof_output}")
# 尝试杀死占用端口的进程
stdin, stdout, stderr = self.ssh_client.exec_command(f"sudo lsof -t -i :{self.port} | xargs sudo kill -9")
time.sleep(1) # 等待进程被杀死
logger.info(f"已尝试杀死占用端口{self.port}的进程")
else:
logger.info(f"端口{self.port}未被占用")
# 测试Gunicorn启动使用构造函数中传入的端口参数指定4个worker
test_command = f"cd {self.django_path} && gunicorn --workers 4 --bind 0.0.0.0:{self.port} {project_name}.wsgi:application --timeout 5"
logger.info(f"执行Gunicorn测试命令: {test_command}")
stdin, stdout, stderr = self.ssh_client.exec_command(test_command)
time.sleep(3) # 等待Gunicorn启动
# 检查Gunicorn是否运行
# 检查Gunicorn进程状态
stdin, stdout, stderr = self.ssh_client.exec_command("ps aux | grep gunicorn")
output = stdout.read().decode()
logger.info(f"Gunicorn进程检查结果: {output}")
# 检查Worker进程状态
worker_count = output.count('gunicorn') - 1 # 减去grep进程本身
logger.info(f"检测到Gunicorn Worker进程数量: {worker_count}")
# 详细分析进程结构
lines = output.strip().split('\n')
master_process = None
worker_processes = []
for line in lines:
if 'grep' not in line and 'gunicorn' in line:
parts = line.split()
if len(parts) >= 11:
pid = parts[1]
command = ' '.join(parts[10:])
if 'master' in command or 'gunicorn: master' in command:
master_process = (pid, command)
elif 'worker' in command:
worker_processes.append((pid, command))
if master_process:
logger.info(f"检测到Gunicorn主进程 - PID: {master_process[0]}, 命令: {master_process[1]}")
else:
logger.warning(f"未检测到Gunicorn主进程")
if worker_processes:
logger.info(f"检测到{len(worker_processes)}个Gunicorn Worker进程:")
for pid, command in worker_processes:
logger.info(f" - Worker PID: {pid}, 命令: {command}")
else:
logger.warning(f"未检测到Gunicorn Worker进程")
# 检查进程数量是否符合预期1个主进程+4个worker进程
if master_process and len(worker_processes) == 4:
logger.info(f"Gunicorn进程结构正常: 1个主进程 + 4个worker进程")
elif master_process and len(worker_processes) > 0:
logger.warning(f"Gunicorn进程结构部分正常: 1个主进程 + {len(worker_processes)}个worker进程预期4个")
else:
logger.error(f"Gunicorn进程结构异常: 未检测到完整的进程结构")
if worker_count < 1:
logger.error(f"Gunicorn主进程存在但Worker进程未启动可能是Django代码/配置错误")
# 尝试手动启动Gunicorn并获取详细错误日志
logger.info(f"尝试手动启动Gunicorn以获取详细错误日志")
stdin, stdout, stderr = self.ssh_client.exec_command(f"cd {self.django_path} && gunicorn --workers 4 --bind 0.0.0.0:{self.port} {project_name}.wsgi:application --timeout 5 --error-logfile -")
time.sleep(2)
error_output = stderr.read().decode()
logger.error(f"手动启动Gunicorn错误日志: {error_output}")
# 清理测试进程
stdin, stdout, stderr = self.ssh_client.exec_command(f"pkill -f 'gunicorn.*{self.port}'")
if "gunicorn" in output and f":{self.port}" in output:
self.progress_updated.emit(100)
self.result_ready.emit(True, f"Gunicorn测试成功 - 项目: {project_name}, 端口: {self.port}")
logger.info(f"Gunicorn测试成功 - 项目: {project_name}, 端口: {self.port}")
self.progress_updated.emit(80)
logger.info(f"Gunicorn进程运行正常开始检查端口{self.port}访问情况")
# 检查端口是否真的在监听
self.progress_updated.emit(85)
stdin, stdout, stderr = self.ssh_client.exec_command(f"ss -tulnp | grep {self.port}")
ss_output = stdout.read().decode()
logger.info(f"ss命令检查端口{self.port}结果: {ss_output}")
# 如果ss命令没有结果尝试使用netstat
if not ss_output:
stdin, stdout, stderr = self.ssh_client.exec_command(f"netstat -tulnp | grep {self.port}")
netstat_output = stdout.read().decode()
logger.info(f"netstat命令检查端口{self.port}结果: {netstat_output}")
port_check_output = netstat_output
else:
port_check_output = ss_output
# 检查端口是否在LISTEN状态
if "LISTEN" in port_check_output and f":{self.port}" in port_check_output:
self.progress_updated.emit(90)
logger.info(f"端口{self.port}处于LISTEN状态开始本地请求测试")
# 本地发起请求测试
stdin, stdout, stderr = self.ssh_client.exec_command(f"curl -s http://127.0.0.1:{self.port}")
curl_output = stdout.read().decode()
curl_exit_status = stdout.channel.recv_exit_status()
logger.info(f"curl本地请求测试退出状态: {curl_exit_status}")
logger.info(f"curl本地请求测试输出: {curl_output[:200]}..." if len(curl_output) > 200 else f"curl本地请求测试输出: {curl_output}")
if curl_exit_status == 0:
self.progress_updated.emit(100)
self.result_ready.emit(True, f"Gunicorn测试成功 - 项目: {project_name}, 端口: {self.port}, 访问正常")
logger.info(f"Gunicorn测试成功 - 项目: {project_name}, 端口: {self.port}, 访问正常")
else:
# 检查错误类型
if "Failed to connect" in curl_output:
error_msg = f"Gunicorn进程运行正常但本地请求超时端口{self.port}未响应"
elif "Bad Request (400)" in curl_output:
error_msg = f"Gunicorn进程运行正常但返回400错误可能是ALLOWED_HOSTS配置问题"
elif "500" in curl_output:
error_msg = f"Gunicorn进程运行正常但返回500错误可能是应用内部错误"
else:
error_msg = f"Gunicorn进程运行正常但本地请求失败: {curl_output[:100]}"
self.result_ready.emit(False, error_msg)
logger.error(error_msg)
else:
self.progress_updated.emit(100)
self.result_ready.emit(False, f"Gunicorn进程运行正常但端口{self.port}未处于LISTEN状态")
logger.error(f"Gunicorn进程运行正常但端口{self.port}未处于LISTEN状态")
else:
# 尝试更简单的测试方式
self.progress_updated.emit(80)
@@ -1040,9 +1206,131 @@ class ManageGunicornServiceThread(QThread):
port = "8000" # 默认端口
if hasattr(self, 'port') and self.port:
port = self.port
stdin, stdout, stderr = self.ssh_client.exec_command(f"sudo netstat -tlnp | grep :{port}")
netstat_output = stdout.read().decode()
logger.info(f"端口{port}监听状态: {netstat_output}")
# 在检查端口监听前,先检查端口占用情况
logger.info(f"检查端口{port}占用情况")
stdin, stdout, stderr = self.ssh_client.exec_command(f"sudo lsof -i :{port}")
lsof_output = stdout.read().decode()
lsof_exit_status = stdout.channel.recv_exit_status()
if lsof_exit_status == 0 and lsof_output:
logger.warning(f"端口{port}被占用: {lsof_output}")
else:
logger.info(f"端口{port}未被占用")
# 检查Gunicorn进程状态
stdin, stdout, stderr = self.ssh_client.exec_command("ps aux | grep gunicorn")
ps_output = stdout.read().decode()
logger.info(f"Gunicorn进程状态: {ps_output}")
# 详细分析进程结构
lines = ps_output.strip().split('\n')
master_process = None
worker_processes = []
for line in lines:
if 'grep' not in line and 'gunicorn' in line:
parts = line.split()
if len(parts) >= 11:
pid = parts[1]
command = ' '.join(parts[10:])
if 'master' in command or 'gunicorn: master' in command:
master_process = (pid, command)
elif 'worker' in command:
worker_processes.append((pid, command))
if master_process:
logger.info(f"检测到Gunicorn主进程 - PID: {master_process[0]}, 命令: {master_process[1]}")
else:
logger.warning(f"未检测到Gunicorn主进程")
if worker_processes:
logger.info(f"检测到{len(worker_processes)}个Gunicorn Worker进程:")
for pid, command in worker_processes:
logger.info(f" - Worker PID: {pid}, 命令: {command}")
else:
logger.warning(f"未检测到Gunicorn Worker进程")
# 检查进程数量是否符合预期1个主进程+4个worker进程
if master_process and len(worker_processes) == 4:
logger.info(f"Gunicorn进程结构正常: 1个主进程 + 4个worker进程")
elif master_process and len(worker_processes) > 0:
logger.warning(f"Gunicorn进程结构部分正常: 1个主进程 + {len(worker_processes)}个worker进程预期4个")
else:
logger.error(f"Gunicorn进程结构异常: 未检测到完整的进程结构")
# 检查Worker进程状态
worker_count = ps_output.count('gunicorn') - 1 # 减去grep进程本身
logger.info(f"检测到Gunicorn Worker进程数量: {worker_count}")
if worker_count < 1:
logger.error(f"Gunicorn主进程存在但Worker进程未启动可能是Django代码/配置错误")
# 使用ss命令检查端口监听状态
stdin, stdout, stderr = self.ssh_client.exec_command(f"sudo ss -tulnp | grep :{port}")
ss_output = stdout.read().decode()
logger.info(f"ss命令检查端口{port}监听状态: {ss_output}")
# 如果ss命令没有结果尝试使用netstat
if not ss_output:
stdin, stdout, stderr = self.ssh_client.exec_command(f"sudo netstat -tlnp | grep :{port}")
netstat_output = stdout.read().decode()
logger.info(f"netstat命令检查端口{port}监听状态: {netstat_output}")
port_check_output = netstat_output
else:
port_check_output = ss_output
# 检查端口是否在LISTEN状态
if "LISTEN" in port_check_output and f":{port}" in port_check_output:
logger.info(f"端口{port}处于LISTEN状态开始本地请求测试")
# 本地发起请求测试
stdin, stdout, stderr = self.ssh_client.exec_command(f"curl -s http://127.0.0.1:{port}")
curl_output = stdout.read().decode()
curl_exit_status = stdout.channel.recv_exit_status()
logger.info(f"curl本地请求测试退出状态: {curl_exit_status}")
logger.info(f"curl本地请求测试输出: {curl_output[:200]}..." if len(curl_output) > 200 else f"curl本地请求测试输出: {curl_output}")
if curl_exit_status == 0:
logger.info(f"服务启动成功,端口{port}访问正常")
else:
# 检查错误类型
if "Failed to connect" in curl_output:
logger.warning(f"服务启动成功,但本地请求超时,端口{port}未响应")
elif "Bad Request (400)" in curl_output:
logger.warning(f"服务启动成功但返回400错误可能是ALLOWED_HOSTS配置问题")
elif "500" in curl_output:
logger.warning(f"服务启动成功但返回500错误可能是应用内部错误")
else:
logger.warning(f"服务启动成功,但本地请求失败: {curl_output[:100]}")
else:
logger.warning(f"服务启动成功,但端口{port}未处于LISTEN状态")
# 检查SELinux状态
logger.info(f"检查SELinux状态")
stdin, stdout, stderr = self.ssh_client.exec_command("getenforce")
selinux_output = stdout.read().decode().strip()
logger.info(f"SELinux状态: {selinux_output}")
if selinux_output == "Enforcing":
logger.warning(f"SELinux处于Enforcing状态可能限制了端口绑定")
# 检查项目目录权限
logger.info(f"检查项目目录权限")
stdin, stdout, stderr = self.ssh_client.exec_command("ls -ld /home/xiaji/")
home_dir_output = stdout.read().decode().strip()
logger.info(f"/home/xiaji/目录权限: {home_dir_output}")
# 尝试更换端口测试
logger.info(f"尝试更换端口测试")
test_port = "8001"
stdin, stdout, stderr = self.ssh_client.exec_command(f"sudo ss -tulnp | grep :{test_port}")
test_port_output = stdout.read().decode()
if not test_port_output:
logger.info(f"端口{test_port}未被占用尝试用该端口启动Gunicorn")
# 这里只是记录日志,不实际更换端口
else:
logger.warning(f"服务启动后状态检查失败: {status_error}")