How To Install Mozilla Open Badges On Linux ServerLast Updated on
Mozilla Open Badges
It provides an open set of specifications, tools and services for generating verifiable badges that users can take with them wherever they go and use however they like.
The latest open standard can be found in the new assertion specification:
The assertion includes the open standard and the metadata specifications.
For more information, Please check out http://openbadges.org
Here are the steps to install openbadges in Ubuntu-11.10:
Setup a MySQL database. Create a database and a user with full privileges on that db. For example:
mysql> CREATE DATABASE openbadges;
mysql> GRANT ALL PRIVILEGES ON openbadges.* TO badgemaker@localhost IDENTIFIED BY ‘secret’;
mysql> CREATE DATABASE test_openbadges;
mysql> GRANT ALL PRIVILEGES ON test_openbadges.* to badgemaker@localhost IDENTIFIED BY ‘secret’;
Copy the openbadges/lib/environments/local-dist.js to openbadges/lib/environments/local.js and edit the configuration to match your local development environment. The MySQL database credentials should match step #1. For example:
Install external tools:
PhantomJS: We use PhantomJS for running unit tests. On a debian based Linux system
you can run sudo apt-get install phantomjs to install and run phantomjs –version to check
it is installed. For other systems you can try downloading and installing it or building it
Install local dependencies: npm install
Install submodules: git submodule update –init
Run the test suite: npm test
Start your server: npm start
QUICK SOLUTIONS TO INSTALL TOOLS:
sudo apt-get update
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/ariya/phantomjs.git
git checkout 1.9
Create a link for phantomjs/bin/environments/phantomjs
ln -s phantomjs/bin/environments/phantomjs /usr/bin/phantomjs
Install nodejs version 0.8.x, Sometimes it becomes very tidy to get its accurate version for
the application. So here we have NVM to resolve this issue:
To install NVM use this script:
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh
To download, compile, and install the latest v0.8.x release of node, do this:
# nvm install 0.8
And then in any new shell just use the installed version:
# nvm use 0.8
Or you can just run it:
# nvm run 0.8
If you want to see what versions are installed:
# nvm ls
If you want to see what versions are available to install:
# nvm ls-remote
To restore your PATH, you can deactivate it.
# nvm deactivate
To set a default Node version to be used in any new shell, use the alias ‘default’:
# nvm alias default 0.8
Optional: A real hostname
I like to be able to use http://openbadges.local for accessing the project. Assuming you used vagrant, you can change the hostname inlocal.js and do sudo echo “220.127.116.11 openbadges.local” >> /etc/hosts to make it happen.
If you need to modify the database schema, you’ll want to create a migration. You can do this as follows:
Come up with an alphanumeric name for your migration, e.g. add-issuer-column.
Run ./bin/db-migrate create add-issuer-column. This will create a new JS file prefixed with
a timestamp in the migrations directory. Something like the following should be displayed:
[INFO] Created migration at
Edit the new JS file as per the node-db-migrate instructions.
Try out your migration using ./bin/db-migrate up.
Try rolling back your migration using ./bin/db-migrate down.
And finally, note that during development, npm start automatically runs ./bin/db-migrate up for you. For production use, you’ll need to manually run this command yourself whenever you deploy changes that involve a schema change.
IF YOU WANT TO WRITE TESTS FOR YOUR MIGRATION, CHECK OUT TEST/MIGRATION.TEST.JS FOR INSPIRATION.
The codebase behaves slightly differently when run in an environment where environment variable NODE_ENV=production. These differences include:
less verbose logging using precompiled templates for client-side rendering run bin/template-precompile to generate “Test Site” banner will not show in the UI
References and Help: