Skip to content

installing

SYNET edited this page Oct 25, 2011 · 3 revisions

Dependencies

Ubuntu linux - recommended. Known to run on FreeBSD as well

  1. MySQL 5.1+ for RDBMS
  2. Python 2.7.x for runtime
  3. NGINX is used as a reverse proxy & caching backend
  4. memcached is used to cache common requests

Install dependencies

sudo apt-get install mysql, libmysqlclient-dev, nginx, uwsgi, memcached
sudo easy_install Django, South, MySQL-python

Define deployment_setings.py

We need API Key, to allow other tools to talk to the main server. Generate it using openssl rand -hex 16 And define database connections - they are intentionally separated and can basically be managed by multiple servers.

SYNET_API_KEY = '5d637c8b98ffd1c4d4f9cc3c8bf33884'

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql', 
    'NAME': 'synet',                      
    'USER': 'synet',                      
    'PASSWORD': 'synet',                  
    'HOST': 'localhost',             
    'PORT': '',                      
},
'epg': {
    'ENGINE': 'django.db.backends.mysql', 
    'NAME': 'epg',                   
    'USER': 'synet',                 
    'PASSWORD': 'synet',             
    'HOST': 'localhost',             
    'PORT': '',                      
}
}

Initialize database

During this process, you'll be prompted to enter an admin user name. python manage.py syncdb --database=default python manage.py migrate --all --database=default python manage.py syncdb --database=epg

Try it out

python manage.py runserver

you should be able to access the admin site via http://localhost:8000/synet/admin

Configure NGINX and uWSGI

  • NGINX is a powerful load balancer, static file server and acts as a proxy to an application engine.

  • uWSGI is a container to run the Python and ensure its operational.

  • documentation on NGINX+uWSGI+DJANGO

    file: /etc/event.d/synet_backend

    description "SYNET backend [uWSGI]"

    start on runlevel [2345] stop on runlevel [!2345]

    respawn exec /usr/bin/uwsgi
    --home /home/router/reference-backend
    --socket /var/run/synet.sock
    --chmod-socket
    --module synet_wsgi
    --pythonpath /home/router/reference-backend

Clone this wiki locally