无法成功运行芹菜和芹菜在Azure App Service上的击败
我在Azure上部署了Django REST API作为应用程序服务。在我的DRF API中,我使用芹菜和芹菜节拍在一夜之间运行Cron Jobs。
我为Redis设置了一个Azure Cache,并将经纪人URL设置在其位置并进行了运行测试。当我在本地初始化它时,一切都起作用。
但是,当尝试使用startup.sh文件部署API以在服务器重新加载上运行芹菜时,它会破裂。我无法达到管理员,并且响应不再返回。日志显示了这些错误:
Container app-api for site app-api did not start within expected time limit.
Container app-api didn't respond to HTTP pings on port: 8000, failing site start
我想知道我是否将其设置为错误。在应用程序服务中配置>一般设置>启动命令:我将startup.sh放在
startup.sh文件位于root项目级别,包含:
gunicorn — bind=0.0.0.0 — timeout 600 api.wsgi & celery -A api.celery worker -l info & celery -A api.celery beat -l info
更不寻常的是,当我删除启动文件时,一切都会再次工作(手动运行芹菜/beat cellery/beat命令),并且似乎已经运行了即使应用程序服务没有响应,也要定期任务。
在本地启动时,这种原因将有效,但是一旦我使用启动文件并保存设置,导致服务器重新启动,它就会破裂。
我尝试了许多不同的启动文件组合,但没有成功。任何帮助将不胜感激。
I have my Django REST API deployed as an App Service on Azure. Within my DRF API I'm using Celery and Celery Beat to run CRON jobs overnight.
I set up an Azure Cache for Redis and I've set the broker URL to its location and have run tests. Everything works when I initialize it locally.
However, when attempting to deploy the API with a startup.sh file to run celery on server reload, it breaks. I can't reach the admin and responses no longer return. The logs show these errors:
Container app-api for site app-api did not start within expected time limit.
Container app-api didn't respond to HTTP pings on port: 8000, failing site start
I wonder if I'm setting it up wrong. In the App Service > Configuration > General Settings > Startup Command: I put startup.sh
The startup.sh file is at the root project level and contains:
gunicorn — bind=0.0.0.0 — timeout 600 api.wsgi & celery -A api.celery worker -l info & celery -A api.celery beat -l info
Even more unusual, when I remove the startup file everything works again(after manually running celery/beat commands) AND it seems to have run the periodic task even when the app service was not responding.
Any reason why this would work when initiated locally, but as soon as I use the startup file and save the setting, causing a server restart, it breaks.
I've tried many different startup file combinations, but to no success. Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了同样的问题,并通过打电话给芹菜工人并在开始应用程序命令之前进行击败来解决。我也在使用枪支。
I had the same problem and solved by calling celery worker and beat before the start application command. I'm also using the gunicorn.