add preliminary readme, include uwsgi.ini file as example

master
Bryan 2021-03-16 21:56:08 -06:00
parent 2b5945ded1
commit d3b2daafca
2 changed files with 62 additions and 0 deletions

28
README.md Normal file
View File

@ -0,0 +1,28 @@
* modify doorcontrol.conf with your configuration
* move doorcontrol.conf to `/etc/doorcontrol/doorcontrol.conf`
* create `/usr/local/doorcontrol` directory
* create iot user
* change to iot user: `sudo -u iot -s`
* `chown iot:iot /usr/local/doorcontrol`
* create python virtual environment
* `python3 -m venv /usr/local/doorcontrol/venv`
* create `/usr/local/doorcontrol/src` directory
* move doorcontrol.py to `/usr/local/doorcontrol/src`
* activate virtual env: `source /usr/local/doorcontrol/venv/bin/activate`
* `pip install paho.mqtt, bottle`
* create uwsgi conf file, use example file and move to `/etc/uwsgi/apps-available`
* if using emperor mode: `ln -s /etc/uwsgi/apps-available/doorcontrol-uwsgi.ini /etc/uwsgi/vassels/doorcontrol-uwsgi.ini`
* modify nginx config:
location = /main-door { rewrite ^ /main-door/; }
location /main-door {
auth_basic off;
try_files $uri @main-door; }
location @main-door {
auth_basic off;
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/app/doorcontrol/dc.sock;
}
* create dir `mkdir /run/uwsgi/app/doorcontrol`
* chown iot:www-data

34
doorcontrol-uwsgi.ini Normal file
View File

@ -0,0 +1,34 @@
[uwsgi]
strict = true
uid = iot
gid = www-data
socket = /run/uwsgi/app/doorcontrol/dc.sock
#disable-logging = true
workers = 4
chmod-socket = 664
single-interpreter = true
master = true
plugin = python3,http
lazy-apps = true
enable-threads = true
### The followint 2 lines are important if we arent mounted at root of url
manage-script-name = true
mount = /main-door=app:app
#wsgi-file = app.py
#module = app:app
#route-run = fixpathinfo:
virtualenv = /usr/local/doorcontrol/venv
pythonpath = /usr/local/doorcontrol/venv/bin
chdir = /usr/local/doorcontrol/src
daemonize = /var/log/uwsgi/doorcontrol.log