简体   繁体   English

使用Nginx运行守护程序的Bottle应用程序

[英]Running a daemonized bottle application with nginx

I have a bottle application (specifically, homu ) which I want to deploy on a server. 我有一个瓶子应用程序(特别是homu ),我想将其部署在服务器上。

The traditional way to run this application is to just run the program (eg python whatever.py ), without any server integration. 运行该应用程序的传统方法是仅运行程序(例如python whatever.py ),而无需任何服务器集成。 The application is stateful and updates its state by listening to the github webhooks api. 该应用程序是有状态的,并通过侦听github webhooks api来更新其状态。 It also has a configuration panel that bottle delivers. 它还具有瓶子提供的配置面板。

Whilst it is able to recover from a crash, this requires a lot of GitHub API requests (which get throttled), so it's preferable to have it running continuously. 尽管它能够从崩溃中恢复,但这需要大量GitHub API请求(这些请求受到限制),因此最好使其连续运行。

Now, I know how to daemonize a bottle application , but this requires running it as a separate program running on a separate port from nginx. 现在,我知道如何守护瓶子应用程序了 ,但这需要将其作为独立程序运行在与nginx不同的端口上。 I'd like to have nginx delegate certain paths to the running bottle application. 我想让Nginx将某些路径委托给正在运行的Bottle应用程序。

How do I do this? 我该怎么做呢?

(Alternatively, a way for me to set it up so that nginx is responsible for keeping it running is nice too) (或者,我可以通过一种方式设置它,让nginx负责保持其运行状态也不错)

One way to do this would be to reverse-proxy it. 一种方法是将其反向代理。

location /foo/bar {
  proxy_pass http://localhost:someport/;
}

and then run the bottle application on someport 然后在someport上运行bottle应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM