App Store Code Structure

Terminology

Explanation of important files

Configuration Files

Django Apps

Other Directories

App Store Software Dependencies

The App Store requires the following software packages. If you're on a Mac, this can be installed with Homebrew. If you're on Linux, use your distribution's package manager.

Note that the versions specified here are not mandatory. They only indicate the version with which I've tested the App Store.

The following Python packages are also required. Each can be installed with pip install. If you don't have pip, type: easy_install pip.

Testing App Store Software Dependencies

Run the test_dependencies.py script like so:

Test the GeoIP library:

Note: this script can only be run after the Django project has been configured.

How requests are handled

         ||             |                               |                    |                    |            ||
Request=>|| ==Apache==> | == sites-enabled/appstore ==> | == django.wsgi ==> | == settings.py ==> | == urls.py ||
         ||             |                               |                    |                    |            ||
  1. An HTTP request is made to the Apache server.
  2. Apache looks in /etc/apache2/sites-enabled to see how to handle the request. The appstore configuration file is set to handle requests made to http://apps.cytoscape.org.

  3. appstore tells Apache to use mod_wsgi. mod_wsgi runs a Python interpreter within Apache. appstore tells mod_wsgi to start Python with /var/www/CyAppStore/django.wsgi.

  4. django.wsgi starts the Django library. It also tells Django the location of settings.py, which Django needs to start the site.

  5. settings.py contains the location of urls.py (defined in the ROOT_URLCONF variable), which is a list of URLs (in the form of regular expressions) and the Python functions that handle them.

  6. urls.py in the top directory of the App Store merely imports additional URLs from each Django app. It dispatches the request to the appropriate function that is designated to handle requests for a given URL. Functions are defined in the views.py file in each Django app.

  7. The handler function returns with a processed HTML page.

Debugging

  1. /etc/apache2/sites-enabled/appstore

    • This file tells Apache and mod_wsgi where to find the site. The most important line is this:
      WSGIScriptAlias / /var/www/CyAppStore/django.wsgi

      This tells Apache and mod_wsgi where to locate the site code. Make sure the path to django.wsgi is correct.

  2. /var/www/CyAppStore/django.wsgi

    • This file invokes Django's WSGI handler. It needs to correctly reference settings.py to start the site. Make sure these two lines are correct:

      SITE_PARENT_DIR = '/var/www'
      SITE_DIR = filejoin(SITE_PARENT_DIR, 'CyAppStore')
      To check if these variables are being defined correctly, you can launch a separate Python interpreter and enter these lines:
      from os.path import join as filejoin
      SITE_PARENT_DIR = '/var/www'
      SITE_DIR = filejoin(SITE_PARENT_DIR, 'CyAppStore')

      Then check if the variables SITE_PARENT_DIR and SITE_DIR are correct.

  3. /var/www/CyAppStore/settings.py

    • This file is pretty complicated. But if you've checked everything at this point, here's some ways to pinpoint problems in settings.py.

      1. If you're getting an HTTP 500 error, you can get the stack trace by turning on debug mode then reloading the page. Note that debug mode exposes sensitive information about the site to the public. Make sure to keep debug mode off as much as possible. Change to following line to True:

        DEBUG = False
      2. You can poke at the code by running a Python shell. Enter this command at the shell prompt in the same directory as settings.py:

        python manage.py shell
        You can check to see if the site's code is working correctly without having debug mode on. For example, to see if the list of all apps is working, enter this into the Python interpreter:
        from apps.models import App
        App.objects.all()
      3. The SQL database settings are specified by the DATABASES variable:

        DATABASES = {
                'default': deploy_database
        }

        Make sure that 'default' is pointing to te correct dictionary:

        deploy_database = {
                'ENGINE':   'django.db.backends.mysql',
                'NAME':     ...
                'USER':     ...,
                'PASSWORD': ...
        }
      4. If you're getting database errors, enter this command at the shell prompt in the same directory as settings.py:

        python manage.py dbshell
        If you're able to get a SQL prompt, that means Django can connect to the SQL database.
      5. If you make changes to a Python file but you're not seeing the changes taking effect, you may have to delete all the .pyc files. To do so, type this:

        make svnclean

Tips

App Store Test Protocol

  1. Does the front page load?
  2. Does "All Apps" load?
    1. Does sorting work as expected?
  3. Does a category load?
  4. Does a 2.x plugin page load? (e.g. /apps/psicquicuniversalclient)

    1. Does plugin downloading work?
    2. Does "Search for posts" work?
    3. Does ratings work?
  5. Does a 3.x app page load? (e.g. /apps/cluego)

    1. Do release downloads work?
    2. When a release is downloaded, is it reflected in the stats page?
  6. Does app page editing work?
    1. Icon?
    2. Any link field?
    3. Details editing?
    4. Deleting a 3.0 release?
      1. Does the release still show in the download stats?
      2. Does the release no longer show in the app page?
      3. Does the release no longer show in the backend?
      4. Does depending on the deleted release fail?
      5. Does submitting a jar with the same name and version succeed?
  7. Does search work?
  8. Do app author pages work? (e.g. /apps/with_author/John%20"Scooter"%20Morris)

  9. Does the "About" page load?
  10. Does the "Contact Us" page load and work?
  11. Does the /backend/all_apps page work?

    1. Does it refer accurately to icon and release URLs?
  12. Do the admin pages load?

App Submission Test Protocol

App submissions will principally test the manifest file. The following snippets are for jars created with the manifest files listed below.

To create an empty jar with just a given manifest, first make sure to have an empty file in the current directory. This is because jar requires at least one input file (besides the manifest) to create a jar. Run this command to create the jar:

jar cmf manifest jar-name.jar empty

Empty manifest test

This should fail: no Cytoscape-App-Name in the manifest.

Simple app test: no version

This should fail: no Cytoscape-App-Version in the manifest.

Manifest:

Cytoscape-App-Name: blah

Simple app test: no API compatibility

This should fail: no Cytoscape-API-Compatibility in the manifest.

Manifest:

Cytoscape-App-Name: blah
Cytoscape-App-Version: 1.0

Simple app test: new app

Manifest:

Cytoscape-App-Name: blah
Cytoscape-App-Version: 1.0
Cytoscape-API-Compatibility: 3.0

Simple app test: new release

This should succeed and not require admin approval. It should still send an email to the admin about the submission.

Manifest:

Cytoscape-App-Name: blah
Cytoscape-App-Version: 2.0
Cytoscape-API-Compatibility: 3.0

Simple app test: no authorization

Submit the jar with the same manifest as above but under a different, non-admin account. Submission should be rejected.

OSGi bundle: no name

This should fail: no Bundle-Name.

Manifest:

Bundle-SymbolicName: blah

OSGi bundle: no version

This should fail: no Bundle-Version.

Manifest:

Bundle-SymbolicName: blah
Bundle-Name: blah

OSGi bundle: no Cytoscape imports

This should fail: no Cytoscape packages in Import-Package.

Manifest:

Bundle-SymbolicName: blah
Bundle-Name: blah
Bundle-Version: 3.0
Import-Package: xyz,abc

OSGi bundle: no Cytoscape version in imports

This should fail: no Cytoscape packages in Import-Package.

Manifest:

Bundle-SymbolicName: blah
Bundle-Name: blah
Bundle-Version: 3.0
Import-Package: org.cytoscape.a, org.cytoscape.b

OSGi bundle: new release

This should succeed.

Manifest:

Bundle-SymbolicName: blah
Bundle-Name: blah
Bundle-Version: 3.0
Import-Package: org.cytoscape.a;version="(3.0,4]",
  org.cytoscape.b;version="(3.5,4]"

OSGi bundle: export package

This should succeed and ask for a pom and Javadocs.

Manifest:

Bundle-SymbolicName: blah
Bundle-Name: blah
Bundle-Version: 4.0
Import-Package: org.cytoscape.a;version="(3.0,4]",
  org.cytoscape.b;version="(3.5,4]"
Export-Package: blah

Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux