Fabelier

a * Lab to make things

User Tools

Site Tools


doc:nodeshot

Nodeshot

Nodeshot is an easy to use Wireless Community MapServer made by the http://ninux.org Ninux Community. One instance can be find on their website. It's based on Django.

This page aims at providing a tutorial on how to install an instance of this software. we are using a Dedicated server running Debian 6.0.

Requirements

  • Linux OS
  • Python > 2.5
  • Django > 1.4
  • Web Server (this tutorial will cover Apache specifics)
  • Database (this tutorial will cover Sqlite3 specifics)

Install Django 1.4 and Apache

At this date (March 2012), we need the last development version (1.4)

 cd /opt
 sudo git clone git://github.com/django/django.git

Some additional steps are required due to the utilization of the development version:

 sudo su
 pypath=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"` && echo "/opt/django" > $pypath/django.pth
 ln -s /opt/django/django/bin/django-admin.py /usr/local/bin
 exit

Install Apache and WSGI, a required module for running Django

 sudo apt-get install apache2 libapache2-mod-wsgi

Install Sqlite3:

 sudo apt-get install sqlite3

Install and configure Nodeshot

Add system User:

 sudo adduser --system --home /srv/nodeshot --disabled-password nodeshot

Get source of nodeshot in user folder:

 cd /srv/nodeshot/
 sudo git clone https://github.com/ninuxorg/nodeshot.git

Change the owner:

 sudo chown -R nodeshot:nogroup /srv/nodeshot/

Rename the repo folder as “mapserver”:

 sudo mv /srv/nodeshot/nodeshot /srv/nodeshot/mapserver

Copy Settings.py template:

 cd /srv/nodeshot/mapserver
 sudo cp settings.example.py settings.py

Edit setting.py with you favorite editor. The Settings template is very well commented and self-explanatory. Here are some stuff I modified :

 DATABASES = {
  'default': {
      'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
      'NAME': '/srv/nodeshot/mapserver/nodeshot.db',                      # Or path to database file if using sqlite3.
      # 'USER': 'nodeshot',                      # Not used with sqlite3.
      # 'PASSWORD': 'XXXXX',                  # Not used with sqlite3.
      # 'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
      # 'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
  }
 }

By using Sqlite3 you must indicate the absolute path !

 TIME_ZONE = 'Europe/Paris'
 LANGUAGE_CODE = 'en-US'
 SITE_URL = "http://nodeshot.fabelier.org/"
 NODESHOT_GMAP_CENTER = {
  'lat': '48.856614',
  'lng': '2.352222'
 }
 NODESHOT_SITE = {
  'name': 'Nodeshot Fabelier',
  'domain': 'nodeshot.fabelier.org'
 }

Add wsgi.py script in /srv/nodeshot/mapserver:

 import os
 import sys
 sys.path.append(os.path.dirname(os.path.realpath(__file__)))
 os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
 import django.core.handlers.wsgi
 application = django.core.handlers.wsgi.WSGIHandler()

Create DocumentRoot Folder and link Nodehsot media folder to it:

 sudo mkdir /var/www/nodeshot
 sudo ln -s /srv/nodeshot/mapserver/media /var/www/nodeshot/media

Edit Apache config file /etc/apache2/sites-available/default :

 <VirtualHost *:8080>
      ServerName nodeshot.fabelier.org
      ServerAlias nodeshot.fabelier.org
      DocumentRoot /var/www/nodeshot/
      WSGIScriptAlias / /srv/nodeshot/mapserver/wsgi.py
 </VirtualHost>

create the database structure

 cd /srv/nodeshot/mapserver
 sudo python manage.py syncdb

Troubleshooting

If http://nodeshot.fabelier.org/admin give you an error, you can try this :

 cd /srv/nodeshot/mapserver
 sudo chown www-data. .
 sudo chown www-data nodeshot.db

If the same address, when working, doesn't load any css, try this :

 sudo ln -s /opt/django/django/contrib/admin/static/admin /srv/nodeshot/mapserver/media/admin

Missing Python Libraries

Django might fail to start because your server might miss some python libraries. If this happens you must install the missing libraries in order to proceed.

Some common missing libraries are:

  • MySQLdb - fix with “apt-get install python-mysqldb” (depends on your distribution)
doc/nodeshot.txt · Last modified: 2015/02/17 21:27 by gturri