###Installations###
sudo pip install flask
sudo pip install supervisor
sudo pip install gunicorn
###Running the microservice###
- direct:
python damage.py
- gunicorn:
gunicorn damage:app -w 4 -b 0.0.0.0:8000 --name==damage_service
- supervisor:
supervisorctl start damage_service
olocalhost:9001
###/usr/local/etc/supervisord.conf###
[unix_http_server]
file=/tmp/supervisor.sock
chmod=0700
[supervisord]
logfile = /tmp/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /tmp/supervisord.pid
nodaemon = False
minfds = 1024
minprocs = 200
umask = 022
identifier = supervisor
directory = /tmp
nocleanup = true
childlogdir = /tmp
[supervisorctl]
serverurl = unix:///tmp/supervisor.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[inet_http_server]
port = 127.0.0.1:9001
username = user
password = 123
[include]
files = /usr/local/share/supervisor/conf.d/*.conf /Users/ricardovegas/dev/webinars/rpg-services/supervisord.conf
###./supervisor.conf###
[program:damage_service]
command=gunicorn damage:app -w 4
process_name=%(program_name)s
directory=/Users/ricardovegas/dev/webinars/rpg-services
###Links###
- http://supervisord.org/configuration.html
- http://flask.pocoo.org/docs/0.12/quickstart/#a-minimal-application
- http://flask-restful-cn.readthedocs.io/en/0.3.4/reqparse.html
- https://gist.github.com/rvegas/8ad455523af0d6d1dd6c01f63831f8fe
- http://flask.pocoo.org/docs/0.12/patterns/apierrors/
###Bibliography###