Skip to content

Instantly share code, notes, and snippets.

@dfeeney
Created March 4, 2013 22:45
Show Gist options
  • Save dfeeney/5086359 to your computer and use it in GitHub Desktop.
Save dfeeney/5086359 to your computer and use it in GitHub Desktop.
Local Freemix akara setup script Just run 'sh setup.sh'. It will create a virtualenv, configure akara and start an instance running on port 8882. Then add the following to local_settings.py in your viewshare instance: AKARA_URL_PREFIX = 'http://localhost:8882'
# -*- mode: python -*-
# This is the main Akara server configuration file. It contains
# settings for the server and for its extension modules.
# The configuration file is written in Python. Configuration data goes
# into class attributes. If the module is "A.B.C" then the
# configuration information should be in the class named "C". If there
# is a conflict then use the parameter "akara_name" to set the full
# module name.
# class C1:
# akara_name = "akara.demo.C"
# name = "this is for one module ending with C"
#
# class C2:
# akara_name = "akara.example.C"
# name = "this is for another C module"
# An extension module should get its configuration class using
# akara.module_config(name)
# where "name" is the full module name (usually __name__).
# The name can be omitted in which case __name__ is used.
### Section 1: Global Akara Environment
# The directives in this section affect the overall operation of
# Akara, such as the number of concurrent requests it can handle and
# where it should place its PID and log files.
#
class Akara:
# Listen: interface name (optional) and port to listen for HTTP requests
Listen = 8882
# To specify the interface name use this format:
# Listen = "localhost:8880"
# ServerRoot = os.path.join(sys.prefix, "share", "akara")
ConfigRoot = "."
# PidFile: Filename which holds the process id of a running Akara
# server. The file is created when Akara starts and removed when it
# exists. It contains a single line: the pid followed by a newline.
#
PidFile = "logs/akara.pid"
# ModuleDir: directory containing the Akara extension modules
# Akara loads all of the *.py files in that directory
#
ModuleDir = "modules"
# ModuleCache: directory containing the module cache databases.
# Akara only creates such databases if the akara.caching
# feature is being used to cache GET requests
ModuleCache = "caches"
####
# Different options controlling the number of pre-forked server
# process to run at any one time.
#
# MaxServers: maximum number of servers to run at any one time
# (this is therefore the maximum number of simultaneous connections)
MaxServers = 150
#
# A 'spare' server is one which is waiting to handle an HTTP request
# MinSpareServers: minimum number of spare servers
MinSpareServers = 5
# MaxSpareServers: maximum number of spare servers
MaxSpareServers = 10
# MaxRequestsPerServer: restart a server after this many requests
MaxRequestsPerServer = 10
#### Log configuration
# ErrorLog: The location of the error log file.
#
ErrorLog = "logs/error.log"
# AccessLog: The location of the access log file.
# Uses the Apache combined log format
#
AccessLog = "logs/access.log"
# LogLevel: Set the severity level for Akara logging messages.
# Messages below the given log level are not written. The levels are,
# from highest to lowest:
# CRITICAL, ERROR, WARN, INFO, DEBUG
# Also, WARNING is an alias for WARN
#
#LogLevel = "INFO"
LogLevel = "DEBUG"
### Section 2: List of extension modules to install
# These are module names found on the Python path
MODULES = [
"akara.demo.cache_proxy",
"zen.akamod.geocoding",
"freemix_akara.load_data",
"freemix_akara.augment_data",
"freemix_akara.contentdm",
"freemix_akara.oai",
]
### Section 3: Other module configuration goes here
class geocoding:
cache_max_age = 86400
geocoder = 'http://purl.org/com/zepheira/services/geocoders/geonames-service'
geonames_service_user = 'zepheira'
#geocoder = 'http://purl.org/com/zepheira/services/geocoders/local-geonames'
#geonames_dbfile = Akara.ConfigRoot+'/caches/geonames.sqlite3'
class augment_data:
geonames_dbfile = Akara.ConfigRoot+'/caches/geonames.sqlite3'
class load_data:
magic_file_command="file -i -"
#dataload_diagnostics=True
dataload_diagnostics=(not 0) #=True ; Stupid kludge until we remove the limitation on using builtins
class cache_proxy:
maxlen = {
None: 8*24*3600, #Default will cover CDM sites (8 day cache)
#"http://dspace.mit.edu/oai/request": 24*3600, #Cache MIT DSpace for 24hrs
}
--extra-index-url http://pypi.zepheira.com/releases/index/
html5lib
httplib2
python-dateutil
simplejson
feedparser
xlrd
zen
akara
amara
freemix-akara
#!/bin/bash
virtualenv --no-site-packages --distribute .
source bin/activate
pip install -r ./requirements.txt
akara -f akara.conf setup
mkdir -p caches
wget -O caches/geonames.sqlite3 http://dl.dropbox.com/u/19247598/Akara/geonames.sqlite3
akara -f akara.conf start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment