NSA CM Reporting Tool System Description Draft

From Nanuna internal
Jump to: navigation, search

Contents

Overview

The NSA CM reporting tool is a web application written in Python and based on the Django web framework. Its design is typical for such applications. The main components are:

  • A location for static files, which are not served through Django but directly from the Apache web server. Static files are images, css and JavaScript files. These are located within the Apache web root. They could theoretically be served by a completely separate web server. However, for the expected load in use by a single operations team, such a setup is not required. This location is associated with a URL base.
  • A location for the code files, that is, the Django project and apps within it. This locations should never be within the Apache web root but can otherwise be freely chosen. The mod_wsgi configuration directive within the Apache configuration file points to this location as described in the mod_wsgi documentation. Fixtures (that is, initial data in JSON format, or other data files for import) are kept within this directory structure.
  • A location for the wsgi script. We hare keeping this within the code file directory hierarchy.
  • A location for the Django templates. We are keeping these within the code file directory hierarchy.
  • A MySQL Database. The database is created, dropped and populated via the Django management scripts (python manage.py syncdb and similar). The access

An ssl certificate is installed at the Apache site root and Apache is configured to redirect all http requests for the base URL to https.

Configuration files

The main configuration file is settings.py at the root of the code file (Django project) directory hierarchy. For illustrative purposes, we are providing an example settings.py file.

[Status: August 2012] Currently, some configuration changes, for example after an import of legacy reports that go back many years, or to change user interface elements, require editing of the JavaScript file newcm.js, which is located below the static files directory root.

CM reporting tool database schema

The MySQL database is initially generated by the Django application's management scripts. The relational schema is as follows (click to enlarge):

NSACMRDBM schema 20120626.png

Code paths and settings for Site Master on nanuna

base URL
https://nanuna.gi.alaska.edu/cm
static file location
/products/htdocs/media/cm/
This path maps to http://nanuna.gi.alaska.edu/media/cm/
Django project (code file) location
/products/cm/mysite/
wsgi script
/products/cm/mysite/apache/django.wsgi
Django template location
/products/cm/mysite/new_cm_templates

Code paths and settings for staging environment on nanuna

base URL
https://nanuna.gi.alaska.edu/cm-test
static file location
/products/htdocs/media/cm-test/
This path maps to http://nanuna.gi.alaska.edu/media/cm-test/
Django project (code file) location
/products/cm/nsadb/
wsgi script
/products/cm/nsadb/apache/django.wsgi
Django template location
/products/cm/nsadb/new_cm_templates

Code paths and settings for Site Master on Barrow server

The Local Instance in Barrow is only accessible from hosts within the ARM network in Barrow and selected hosts via a Site Access Request. The nanuna server is authorized to access this system. Within the ARM NSA network, DNS resolves the name cmdb-nsac1.nsa.arm.gov to its IP address 192.148.94.234. Outside this network, the server has to be accessed via its IP address, or alternatively you can map the IP address manually in your /etc/hosts file. The application runs under the user cmdbu. The password can be found within the NSA team's password safe. This is a CentOS system within a virtual machine. As this server is protected via the firewall, no ssl certificate is installed.

base URL
http://cmdb-nsac1.nsa.arm.gov/cm
static file location
/var/www/html/media/cm
This path maps to http://cmdb-nsac1.nsa.arm.gov/media/cm/
Django project (code file) location
/products/nsaops/cmrdb/
wsgi script
/products/nsaops/cmrdb/apache/django.wsgi
Django template location
/products/nsaops/cmrdb/new_cm_templates/

Management scripts

For management tasks, one of the two following methods is used:

  • Django management tasks for the simplest tasks, eg. python manage.py loaddata, which picks up the fixture named initial_data.json in the fixtures directory. It also governs synchronization between instances.
  • Fabric scripts. The fab file is part of the code repository, but not of the deployed code. It should be checked out to the systems administrator's workstation together with the code environment and used locally. This file governs deployment of new code, templates or static files as well as on-demand synchronization between instances and on-demand data load.

Code repository

[Status: 2011/12] The development environment used for the initial phase has been Chris Waigl's workstation (OS X), with the code residing in a Dropbox folder. The code has not been copied to the shared Dropbox folder described on the NSA Barrow system access and management page.

A remote Git repository has been created on nanuna, and code, script and data files are pushed to the remote repository after each commit. It has the world-readable bit set and can therefore be cloned remotely if you have ssh access to nanuna:

git clone ssh://[username]@nanuna.gi.alaska.edu:/home/cwaigl/Projects/ARM_CMRDB

PLEASE NOTE: The code repository contains the configuration files for all live and test instances, which requires database credentials. Please treat them with great confidentiality. The files also contain numerous data files and a documentation framework. The data volume is at the moment substantially larger than the deployed code base.

Personal tools