문제

I've set up a Flask application to run on a tornado server backed by nginx. I've written a couple of bash scripts to reload server configuration when a new version is deployed, but I am unhappy with them. Basically what I have is:

to start the server (assuming in project root)

# this starts the tornado-flask wrapper
python myapp.py --port=8000 # .. some more misc settings

# this starts nginx
nginx

to stop it

pkill -f 'myapp.py'
nginx -s stop

to restart

cd $APP_ROOT
./script/stop && ./script/start

Many times these don't work smoothly and I need to manually run the commands. Also, I'm looking for a way to verify the service is alive, and start it up if it's down. Thoughts? Thanks.

도움이 되었습니까?

해결책

Supervisor is what you are looking for.

It's what I use to manage my Tornado apps along with some other processing daemons. It will daemonize, handle logging, pid files... Pretty much everything you need.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top