IT/Community/WG/Badgus

From MozillaWiki
< IT‎ | Community
Jump to: navigation, search
Module Name Module Owner
Badg.us ewong


Summary

Badg.us is a site where anyone can create a series of Open Badges to recognize skills, achievements and interests. This platform is available for free and intended to provide an easy option for issuing interoperable badges that align with the Open Badges metadata standard.

Documentation

Overview

  • AWS
    • Compute Region (AZ):
  • RDS:
  • ELB

Monitoring

Instances

Web servers

Name Service Flavor IP Addr
badge-us-01 web standard.medium 15.185.183.5/10.7.214.134
badge-us-02 web standard.medium 15.185.155.235/10.7.217.60

Set Up

(Please note: This is a WIP.]

  • Spin up instance using image.
    • The database is on the DBaaS, so it's already installed and setup. Just need to point these instances to it.
  • Create badger user account.
 sudo useradd badger
 sudo usermod -a -G wheel badger
 sudo chmod o+x /home/badger
  • sudo install packages:
 sudo yum install gcc
 sudo yum install httpd
 sudo yum install mod_wsgi
 sudo yum install git
 sudo yum install memcached
 sudo yum install python-devel
 sudo yum install mysql-devel
 sudo yum install python-pip
 sudo yum install mysql
 sudo yum install libjpeg
 sudo yum install libjpeg-devel
  • setup virtualenv
 sudo pip install virtualenv
 virtualenv ./dj
 source ./dj/bin/activate
  • pip install some modules
 pip install python-memcached
 pip install PIL
 pip install reportlab
  • get source and get submodules
 git clone https://github.com/mozilla/badgus badgus
 cd badgus
 git submodule update --init --recursive
  • setup database info on local.py
 cd badgus/settings
 sudo cp /root/files/local.py .
 sudo chown badger.badger local.py
  • edit local.py
 STATIC_ROOT = 'static/'   # <-- add this line
 MEDIA_ROOT = '/var/www/html/media'  # <-- add this line
 DATABASES = {
      'default': {
            ...
            'NAME': 'badge',       # <-- modify this
            'USER': 'badge',       # <-- modify this
            'PASSWORD': '<password>',   # <-- modify this
            'HOST': '15.125.20.29',     # <-- modify this
            ...
 ADMINS = (
      ('<admin name>', '<admin email>'),   # <-- modify this line
 )
 BADGER_ALLOW_ADD_BY_ANYONE = True  # <-- find this line and change it
  • collect static files
    • in /home/badger/badgus
    • (enter yes when asked "Are you sure you want to do this?")
  ./manage.py collecticstatic
  sudo mv ./static /var/www/html
  • Setup Apache
    • sudo vi /etc/httpd/conf/httpd.conf
      • Add the following lines to the bottom of the httpd.conf file:
    AddHandler wsgi-script .wsgi

    NameVirtualHost *:80

    Alias /media "/var/www/html/media"
    Alias /static "/var/www/html/static"

    WSGISocketPrefix /var/run/wsgi

    <VirtualHost *:80>
       ServerName 15.185.155.235      # <-- change this

       <Directory "/var/www/html/media">
         Order deny,allow
         Allow from all
       </Directory>

       WSGIDaemonProcess badg.us user=badger group=badger threads=25 python-path=/home/badger/badgus:/home/badger/badgus/badgus
       WSGIProcessGroup badg.us

       <Directory "/var/www/html/static">
         Order deny,allow
         Allow from all
       </Directory>

       WSGIScriptAlias / /home/badger/badgus/wsgi/playdoh.wsgi

       <Directory "/">
         Options FollowSymLinks
         AllowOverride None
         Order deny,allow
         Allow from all
       </Directory>

       <Directory "/home/badger/badgus/badgus">
         Order allow,deny
         Allow from all
       </Directory>
    </VirtualHost>
  • Under Apache's /var/www/html
    • If you have the images file (from badg.us):
      • Uncompress the images file to /var/www/html/media
      • sudo chown -R badger.badger /var/www/html/media/uploads
      • sudo chmod -R 775 /var/www/html/media/uploads
    • If you are starting new:
      • sudo mkdir /var/www/html/media /var/www/html/media/uploads /var/www/html/media/uploads/{awards|badge|profile}
      • sudo chown -R badger.badger /var/www/html/media/uploads
      • sudo chmod -R 775 /var/www/html/media/uploads
  • Edit /home/badger/badgus/wsgi/playdoh.wsgi
    • add the following lines after "import site"
  import sys
    • add the following lines to this file after "site.addsitedir(os.path.abspath(os.path.join(wsgidir, '../')))
  sys.path.insert(0, '/home/badger/badgus')
  sys.path.insert(0, '/home/badger/dj/lib/python2.6/site-packages')


  • Run manage.py instructions
 cd /home/badger/badgus
 ./manage.py syncdb
 ./manage.py migrate
  • Final touches:
 sudo service memcached start
 sudo service httpd start
 sudo chkconfig memcached on
 sudo chkconfig httpd on
  • [TODO] Set up using glusterfs to synchronize each instance's media/ folders.

Configuration files

  • /home/badger/badgus/badgus/settings/local.py