-- or --
* git clone ssh://yourlogin@git.onelab.eu/git/myslice.git
-* edit myslice/config.py and enter the details of your manifold backend
+* edit/create myslice/myslice.ini and enter the details of your manifold backend
$ apt-get install python-django-south
* init django
* all the local material for this deployment gets into /etc/unfold/
* I could not find a way to have client-auth without server auth;
- this is totally weird, and stupid, but just so
+ this is totally weird, and stupid, but that's how it is
so there is a need to install a (probably self-signed) cert
and related key in
/etc/unfold/myslice.cert
key=/etc/unfold/myslice.key
cert=/etc/unfold/myslice.cert
+# provide a hostname as the first arg to this command
+# (otherwise we use hostname)
if [[ -n "$@" ]] ; then hostname=$1; shift; else hostname=$(hostname); fi
function init_trusted_roots () {
apache/unfold.conf /etc/apache2/sites-available
manage.py usr/share/unfold/
usr/bin/unfold-init-ssl.sh
+etc/unfold/trusted_roots
+var/unfold
#!/bin/bash
+# tmp - (or?)
+set -x
# if this requires a service to be running, add something like this
# update-rc.d unfold defaults
[ -d /var/unfold ] || mkdir /var/unfold
chown -R www-data.www-data /var/unfold
chmod -R 700 /var/unfold
-# upgrading from older packages -- temporary
-[ -f /usr/share/unfold/myslice.sqlite3 ] && mv -f /usr/share/unfold/myslice.sqlite3 /var/unfold
-rm -f /etc/apache2/sites*/myslice.conf
# upgrading end
/usr/share/unfold/manage.py syncdb
/usr/share/unfold/manage.py migrate
-a2dissite default
+# enable required stuff
+a2enmod ssl
+a2dissite default || :
a2ensite unfold.conf
+# create a server-side cert/key and passes on gids to rehash them
+unfold-init-ssl.sh
service apache2 restart
# Manifold API Python interface
import copy, xmlrpclib
-from myslice.config import Config
+from myslice.configengine import ConfigEngine
from django.contrib import messages
from manifoldresult import ManifoldResult, ManifoldCode, ManifoldException
self.trace = []
self.calls = {}
self.multicall = False
- config = Config()
- self.url = config.manifold_url()
+ self.url = ConfigEngine().manifold_url()
self.server = xmlrpclib.Server(self.url, verbose=False, allow_none=True)
def __repr__ (self): return "ManifoldAPI[%s]"%self.url
return _execute_query(request, query, manifold_api_session_auth)
def execute_admin_query(request, query):
- config = Config()
- admin_user, admin_password = config.manifold_admin_user_password()
+ admin_user, admin_password = ConfigEngine().manifold_admin_user_password()
admin_auth = {'AuthMethod': 'password', 'Username': admin_user, 'AuthString': admin_password}
return _execute_query(request, query, admin_auth)
from manifold.manifoldapi import ManifoldAPI
from manifold.manifoldresult import ManifoldException
from manifold.util.log import Log
-from myslice.config import Config
+from myslice.configengine import ConfigEngine
debug=False
#debug=True
# We allow some requests to use the ADMIN user account
if (manifold_query.get_from() == 'local:user' and manifold_query.get_action() == 'create') \
or (manifold_query.get_from() == 'local:platform' and manifold_query.get_action() == 'get'):
- admin_user, admin_password = Config().manifold_admin_user_password()
+ admin_user, admin_password = ConfigEngine().manifold_admin_user_password()
manifold_api_session_auth = {'AuthMethod': 'password', 'Username': admin_user, 'AuthString': admin_password}
else:
print request.session['manifold']
from ConfigParser import RawConfigParser
from myslice.settings import ROOT
-# as this code suggests, you have the option to override these defaults
+#
+# DO NOT EDIT !!!
+#
+# This file does not contain any user-modifiable data
+#
+# te defaults here are, well, only default values,
+# and, you have the option to override them
# by writing a file myslice/myslice.ini
# that looks like this
#[manifold]
#url = http://manifold.pl.sophia.inria.fr:7080/
#admin_user = admin
#admin_password = admin
+#[googlemap]
+#api_key=theapikeyasprovidedbygoogle
# use a singleton instead of staticmethods
from manifold.util.singleton import Singleton
-class Config(object):
+class ConfigEngine(object):
__metaclass__ = Singleton
# the OpenLab-wide backend as managed by UPMC
def __init__ (self):
parser = RawConfigParser ()
parser.add_section('manifold')
- parser.set ('manifold', 'url', Config.default_manifold_url)
- parser.set ('manifold', 'admin_user', Config.default_manifold_admin_user)
- parser.set ('manifold', 'admin_password', Config.default_manifold_admin_password)
+ parser.set ('manifold', 'url', ConfigEngine.default_manifold_url)
+ parser.set ('manifold', 'admin_user', ConfigEngine.default_manifold_admin_user)
+ parser.set ('manifold', 'admin_password', ConfigEngine.default_manifold_admin_password)
parser.add_section('googlemap')
parser.set ('googlemap','api_key', None)
parser.read (os.path.join(ROOT,'myslice/myslice.ini'))
from manifold.manifoldresult import ManifoldResult
from ui.topmenu import topmenu_items, the_user
-from myslice.config import Config
+from myslice.configengine import ConfigEngine
class HomeView (FreeAccessView):
# expose this so we can mention the backend URL on the welcome page
def default_env (self):
- config=Config()
return {
- 'MANIFOLD_URL':config.manifold_url(),
+ 'MANIFOLD_URL':ConfigEngine().manifold_url(),
}
def post (self,request):
from plugins.lists.simplelist import SimpleList
from plugins.slicestat import SliceStat
-from myslice.config import Config
+from myslice.configengine import ConfigEngine
# View for 1 platform and its details
class ResourceView(FreeAccessView):
togglable = True,
query = resource_query,
query_all = resource_query,
- googlemap_api_key = Config().googlemap_api_key(),
+ googlemap_api_key = ConfigEngine().googlemap_api_key(),
checkboxes = False,
# center on Paris
#latitude = 49.,
from plugins.messages import Messages
from plugins.slicestat import SliceStat
-from myslice.config import Config
+from myslice.configengine import ConfigEngine
tmp_default_slice='ple.upmc.myslicedemo'
page.add_js_chunks ('$(function() { messages.debug("sliceview: jQuery version " + $.fn.jquery); });')
page.add_js_chunks ('$(function() { messages.debug("sliceview: users turned %s"); });'%("on" if do_query_users else "off"))
page.add_js_chunks ('$(function() { messages.debug("sliceview: leases turned %s"); });'%("on" if do_query_leases else "off"))
- config=Config()
- page.add_js_chunks ('$(function() { messages.debug("manifold URL %s"); });'%(config.manifold_url()))
+ page.add_js_chunks ('$(function() { messages.debug("manifold URL %s"); });'%(ConfigEngine().manifold_url()))
metadata = page.get_metadata()
resource_md = metadata.details_by_object('resource')
query = sq_resource,
query_all = query_resource_all,
# this key is the one issued by google
- googlemap_api_key = Config().googlemap_api_key(),
+ googlemap_api_key = ConfigEngine().googlemap_api_key(),
# the key to use at init-time
init_key = main_query_init_key,
checkboxes = True,
# xxx somehow this does not seem to show up in debian packaging
scripts = [ 'apache/unfold-init-ssl.sh' ],
data_files = [
- ( '/usr/share/unfold/static/js', glob ('static/js/*')),
- ( '/usr/share/unfold/static/css', glob ('static/css/*')),
- ( '/usr/share/unfold/static/img', glob ('static/img/*')),
- ( '/usr/share/unfold/static/fonts', glob ('static/fonts/*')),
- ( '/usr/share/unfold/templates', glob ('templates/*')),
- ( 'apache', [ 'apache/unfold.conf', 'apache/unfold.wsgi' ]),
+ ( '/usr/share/unfold/static/js', glob ('static/js/*')),
+ ( '/usr/share/unfold/static/css', glob ('static/css/*')),
+ ( '/usr/share/unfold/static/img', glob ('static/img/*')),
+ ( '/usr/share/unfold/static/fonts', glob ('static/fonts/*')),
+ ( '/usr/share/unfold/templates', glob ('templates/*')),
+ ( 'apache', [ 'apache/unfold.conf', 'apache/unfold.wsgi' ]),
+ ( '/etc/unfold/trusted_roots', []),
+ ( '/var/unfold', []),
])
from unfold.prelude import Prelude
-from myslice.config import Config
+from myslice.configengine import ConfigEngine
# decorator to deflect calls on this Page to its prelude
def to_prelude (method):
self.add_js_init_chunks("var MANIFOLD_METADATA =" + self.get_metadata().to_json() + ";\n")
def expose_js_manifold_config (self):
- config=Config()
- self.add_js_init_chunks(config.manifold_js_export())
+ self.add_js_init_chunks(ConfigEngine().manifold_js_export())
#################### requirements/prelude management
# just forward to self.prelude - see decorator above