bitshares / bitshares-explorer-api

REST API for BitShares
https://explorer.bitshares-kibana.info/apidocs/
MIT License
32 stars 45 forks source link

add nginx to docker #12

Closed oxarbitrage closed 6 years ago

oxarbitrage commented 6 years ago

The dockerfile currently run the service by flask. this is ok for development but on production flask cant handle large amounts of traffic so service need to run behind nginx. i think it is possible but not sure. what do you think @knaperek ?

for reference here is my nginx file:

root@alfredo:~/bitshares-munich/explorer/repo/bitshares-python-api-backend# cat /etc/nginx/sites-available/myapp 
server {
    listen 5000;
    server_name 23.94.69.140;
    location / {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/api.sock;
    }
}
root@alfredo:~/bitshares-munich/explorer/repo/bitshares-python-api-backend# 

and the command i am using to start the service inside a screen session(probably not the best):

root@alfredo:~/bitshares-munich/explorer/repo/bitshares-python-api-backend# uwsgi --ini api.ini

knaperek commented 6 years ago

flask is just the web framework used, it's there always. The current Docker configuration uses uwsgi in http mode which is production ready as a front http server. Obviously we can add nginx in front but performance-wise it won't make any measurable difference - all the requests need to go to uwsgi anyway and there's nothing nginx could serve on its own (unless we make use of some plugins or caching or such...). For now I'm happy to go with uwsgi in http mode; there's much more important stuff to work on, also performance wise :-)

oxarbitrage commented 6 years ago

that makes sense, good enough for me. thank you very much for the explication. i am going to change my production service to docker now. thanks again.