Infrastructure Team/Zamboni

From Sugar Labs
Jump to navigation Jump to search
Stop hand.png NOTE:
The content of this page is considered
DEPRECATED and OBSOLETE
It is preserved for historical research, along with its talk page.


Sources

http://git.sugarlabs.org/projects/slo-activities

Branches structure:

  • master branch, last ASLO codebase
  • master-theme rebased to master branch, last ASLO codebase with sugar theme
  • v<version> branch, released ASLO version
  • v<version>-theme rebased to v<version> branch, released ASLO version with sugar theme
  • production tag to last stable branch

Install server

NOTE The followed instructions tested on Ubuntu 10.10(Maverick).

Install apache, mysql, and -dev packages.

sudo aptitude install apache2 libapache2-mod-wsgi mysql-server python-dev libxml2-dev libxslt1-dev libmysqlclient-dev libmemcached-dev

Create user

mkdir /srv/activities.sugarlabs.org
sudo adduser --home /srv/activities.sugarlabs.org/aslo aslo

To check out sources you need git and subversion.

sudo aptitude install git subversion

Checkout our fork.

git clone --recursive git://github.com/jbalogh/zamboni.git  /srv/activities.sugarlabs.org/zamboni

Fetch external dependencies:

cd /srv/activities.sugarlabs.org/zamboni
git clone --recursive git://github.com/jbalogh/zamboni-lib.git vendor

Set up server

Setup apache. Add followed lines to the end of VirtualHost section in /etc/apache2/sites-enabled file:

 <VirtualHost *:80>  #
   ServerName aslo1.rit.edu
   WSGIScriptAlias / /srv/activities.sugarlabs.org/zamboni/wsgi/zamboni.wsgi
   WSGIDaemonProcess zamboni processes=8 threads=1 
   WSGIProcessGroup zamboni
   Alias /media "/srv/activities.sugarlabs.org/zamboni/media"
   <location "/media/">
       SetHandler None
       Order deny,allow
       Allow from all
   </location>
   <Directory /srv/activities.sugarlabs.org/zamboni>
       Order deny,allow
       Allow from all
   </Directory>
#  <locationmatch "\.(jpg|gif|png)$">
#      SetHandler None
#  </locationmatch>
</virtualhost>

Setup mysql(you need to enter mysql root password for these commands).

mysqladmin -u root password remora
mysqladmin -u root -p create remora
mysql -u root -p

GRANT ALL ON *.* TO 'remora'@'localhost' IDENTIFIED BY 'remora';
exit; 

To test server create /var/www/site/app/webroot/php.php:

<?php phpinfo(); ?>

Open http://a.sl.o/php in browser and make sure mysql is enabled.

Configure ASLO

settings_local.py

$#$#$#$#$#$#$#$#$# from settings import *

DEBUG = True TEMPLATE_DEBUG = DEBUG DEBUG_PROPAGATE_EXCEPTIONS = DEBUG

  1. These apps are great during development.

INSTALLED_APPS += (

   'debug_toolbar',
   'django_extensions',
   'fixture_magic',

)

  1. You want one of the caching backends. Dummy won't do any caching, locmem is
  2. cleared every time you restart the server, and memcached is what we run in
  3. production.
  4. CACHE_BACKEND = 'caching.backends.memcached://localhost:11211?timeout=500'
  5. CACHE_BACKEND = 'caching.backends.locmem://'

CACHE_BACKEND = 'dummy://'

DATABASES = {

   'default': {
       'NAME': 'zamboni',
       'ENGINE': 'django.db.backends.mysql',
       'USER': 'zamboni',
       'PASSWORD': 'remora',
       'OPTIONS':  {'init_command': 'SET storage_engine=InnoDB'},
       'TEST_CHARSET': 'utf8',
       'TEST_COLLATION': 'utf8_general_ci',
   },

}

LOG_LEVEL = logging.DEBUG HAS_SYSLOG = False

  1. For debug toolbar.

if DEBUG:

   INTERNAL_IPS = ('127.0.0.1',)
   MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
   DEBUG_TOOLBAR_CONFIG = {
       'HIDE_DJANGO_SQL': False,
       'INTERCEPT_REDIRECTS': False,
   }
  1. If you're not running on SSL you'll want this to be False.

SESSION_COOKIE_SECURE = False

  1. Run tasks immediately, don't try using the queue.

CELERY_ALWAYS_EAGER = True

  1. @#@#@#@#@#@#@@#


cd /var/www
aslo/db-create-stub.sh

Open a.sl.o in browser. To login use:

login admin@sugarlabs.org
password test

Optional steps

Install php-memcache

yum install php-devel gcc zlib-devel

pecl install memcache
vim /etc/php.ini

You should add "extension=memcache.so" to php.ini

service httpd restart


TODO