A tiny service that records location checkins
Create an RDS PostgreSQL instance that can be connected to from your server, then:
sudo apt-get install -y python-setuptools postgresql-client libpq-dev python-dev
sudo easy_install pip
sudo pip install virtualenv
virtualenv env
env/bin/pip install -r requirements.txt
The database is configured with the following environment variables:
CHECKIN_DB_HOSTis the DB host; it defaults tolocalhostCHECKIN_DB_PORTis the DB port; it defaults to5432CHECKIN_DB_USERis the DB userCHECKIN_DB_PASSWORDis the DB password for the given DB user
The admin interface is configured with the following environment variables:
CHECKIN_ADMIN_USERCHECKIN_ADMIN_PASSWORD
The Google Maps API key is set with:
CHECKIN_GOOGLE_API_KEY
Set the above environment variables to whatever is appropriate from your RDS configuration and then run the app:
gunicorn -w 4 -b 0.0.0.0:9000 checkin:app
In reality, you'll want to deploy gunicorn behind Nginx, with Nginx talking to gunicorn over a UNIX socket. Configuring gunicorn and Nginx is beyond the scope of this document.