This is a very simple flask webapp for monitoring and controlling an IP camera and gate controlled by Raspberry Pi GPIO
$ apt update
$ apt upgrade
Install necessary packages
$ apt install build-essential supervisor
Install Python
$ apt-get install python2.7-dev python-setuptools
Install git
$ apt-get install git-core
Generate a new SSH key
$ ssh-keygen -t rsa -C "your_email@youremail.com"
Then add the key from ~/.ssh/id_rsa.pub to GitHub as a deployment key
Test the key by
$ ssh -T git@github.com
Install virtualenv
$ pip install virtualenv
Install nginx
$ apt-get install nginx
Install uWSGI
$ apt-get install uwsgi uwsgi-plugin-python
$ cd /var/www
$ git clone git@github.com:[username]/gate_control.git
Set owner to www-data
$ chown -R www-data:www-data /var/www/gate_control
Create folders
$ cd /web/example.com/
$ mkdir logs public_html source
$ cd /var/www
$ virtualenv gate_control_venv
Install deps
$ pip install flask, rpi.GPIO
$ cp ${repo}/resources/nginx/cameras /etc/nginx/sites-available/
Then create a symlink
$ ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com
Then you may need to delete default site
$ rm /etc/nginx/sites-enabled/default
$ cp ${repo}/resources/uwsgi/cameras.conf /etc/uwsgi/apps-available/
Then create a symlink
$ ln -s /etc/uwsgi/apps-available/cameras.conf /etc/uwsgi/apps-enabled/cameras.conf
$ cp ${repo}/resources/supervisord/camera_images.conf /etc/supervisor/conf.d/
$ supervisorctl reread
$ supervisorctl update
$ service uwsgi restart
$ service nginx restart