reganto / soothe

Simulate a Distributed System with Tornado, Supervisor, Nginx, Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Soothe

soothe

Tools

  • Tornado as server
  • Supervisor as process manager
  • Nginx as reverse proxy and load balancer
  • Docker as container platform

Instruction

  • install tornado
pip install tornado
  • install supervisor
pip install supervisor
  • run supervisord
supervisord -c supervisor/init.conf

Best practice: don't use inet_http_server in production unless you provide security for it.

  • set nginx settings for load balancing

vi /etc/nginx/conf.d/default.conf

upstream backend {
    server localhost:8000 weight=2;
    server localhost:8001 weight=1;
    server localhost:8002 weight=1;
    server localhost:8003 backup;
}
server {
    listen           127.0.0.1:80;
    location / {
        proxy_pass http://backend;
    }
}
  • test nginx configs

nginx -t

  • reload nginx configs

nginx -s reload

  • open browser and go to localhost

About

Simulate a Distributed System with Tornado, Supervisor, Nginx, Docker

License:MIT License


Languages

Language:Python 76.7%Language:Dockerfile 23.3%