我在尝试部署我的项目时遇到了 Dokku 的部署问题。该错误消息表明gunicorn 存在问题,但我无法找出根本原因。详情如下:
错误信息:
remote: perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Attempting pre-flight checks (web.1)
-----> Executing 2 healthchecks
Running healthcheck name='default' type='uptime' uptime=10
Running healthcheck name='port listening check' attempts=3 port=5000 retries=2 timeout=5 type='listening' wait=5
Healthcheck succeeded name='port listening check'
=====> Start healthcheck output
state=restarting
=====> End healthcheck output
remote: ! Failure in name='default': container has restarted 6 times
some_id
remote: ! Could not start due to 1 failed checks (web.1)
=====> Start of myproject container output (web.1)
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
=====> End of myproject container output (web.1)
=====> Start of container output (.)
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
setuidgid: fatal: unable to run gunicorn: file does not exist
=====> End of container output (.)
remote: parallel: This job failed:
remote: /var/lib/dokku/plugins/available/scheduler-docker-local/bin/scheduler-deploy-process-container myproject herokuish dokku/myproject:latest latest web 1 1
To id_adress:myproject
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'id_adress:myproject'
失败似乎与找不到gunicorn文件有关。
我已检查 Dokku 文档并确保必要的配置已到位。 我使用了这个建议和这个建议,但我仍然有同样的问题。
有人在 Dokku 部署和 Gunicorn 进程方面遇到过类似的问题吗?我可以采取哪些步骤来排查和解决此问题? 任何见解或指导将不胜感激。谢谢!
更新: 原来我需要在 Procfile 中写入
web: gunicorn config.wsgi --log-file -
相关应用程序可能是基于构建包的应用程序。构建包由 herokuish 基础镜像 按特定顺序运行,第一个检测到的镜像即为所应用的镜像。
如果没有更多日志信息(部署的第一部分已在发布的日志中删除),很可能会检测到多个构建包,其中 python 构建包 - 它将在
requirements.txt
中安装依赖项 - 不是第一个。您可能希望通过创建 .buildpacks
文件并将其提交到存储库的基础来使用多个构建包,并指定您需要的每个构建包的内容。下面是指定justheroku/python buildpack的示例。
heroku/python
您还可以通过 buildpacks 命令设置构建包:
dokku buildpacks:add node-js-app heroku/python
这将代表您管理
.buildpacks
文件。