Contribute | How to Develop Open Font Library

The following guide should help you set up a working copy of Open Font Library on your own server.

Get the Code

Clone the main repo: gitorious.org/fontlibrary/openfontlibrary_org

Add the assets submodule, which replaces the normal Aiki assets/ folder: gitorious.org/fontlibrary/assets-clean

Install the Site

Set up your database and run the Aiki installer as normal: aikiframework.org/wiki/Installing_Aiki

Look inside the assets/sql folder, and import those tables into your clean Aiki database.

Update the apps_recaptcha table by inserting a new row with your public key and private key. The site_id should be set to 1.

Download and install fontaine: sourceforge.net/projects/fontaine/. Put the Fontaine binary or a symlink to it in assets/extensions/fontlibrary/scripts/

Track developments

The Open Font Library uses Launchpad to coordinate all bug reports and blueprints: launchpad.net/openfontlibrary.

Edit away

Use the interface at http://localhost/admin and edit widgets

Submit your changes

Dump the OFLB widgets: mysqldump --compact --no-create-info -u DATABASE_USER -p DATABASE_NAME aiki_widgets --where=app_id=0 > oflb_aiki_widgets.sql

Copy oflb_aiki_widgets.sql into the sql/ directory in the assets repo

Use git to add and commit the changed .sql file

Push the changes to your own Gitorious account and put in a Merge request


The following information is of technical interest to developers working directly on the live and development sites:

Open Font Library has three servers:

  • /srv/www/openfontlibrary.org/
  • /srv/www/dev.openfontlibrary.org/
  • /srv/www/staging.openfontlibrary.org/

The Live server always has the latest user-generated content, meaning: Users, Fonts, Translations, Wiki

The Dev server has the latest widgets and code on disk.

The Staging server is used to test updating from Dev to Live.

STEP 1) Put Live site into maintenance mode

cd /srv/www/openfontlibrary.org/htdocs && rm .htaccess && ln -s ../private/openfontlibrary/htaccess-maintenance .htaccess

If you need to see through the site, then edit .htaccess and add your IP Address to the RewriteCond %{REMOTE_HOST}

STEP 2) Back up the live site

Dump the Live DB and if you are really paranoid, make a copy of the entire htdocs directory too!

STEP 3) Sync user content from Live to Staging

Look at the 'git log' and make sure that Live and Staging are in sync first on disk.

From the Live assets/ folder, copy the contents of fonts/ downloads/ and uploads/ to the Staging server.

Then save the user-generated content from the Live database:

mysqldump --opt -u OFLB_USER -p OFLB_DATABSE aiki_users aiki_dictionaries aiki_translation_rules oflb_categories oflb_commits oflb_families oflb_fonts oflb_formats oflb_glyphs oflb_levels oflb_licenses oflb_orthographies oflb_status oflb_wiki_pages oflb_wiki_text wiki_edit_types > openfontlibrary_Users-Fonts-Wiki.sql

Then import those tables into the Staging database.

In addition, if any languages have been added to the live site, you need to get the value of the aiki_sites.site_languages field for the site, and transfer it. Same goes for the aiki_sites.widget_language field. The aiki_languages table (otherwise deprecated) is used on the site to render the language menu dropdown.

Finally, double-check the Staging site and confirm that it matches the Live site.

STEP 4) Get Dev site ready to go

In the assets directory on the Dev site, make sure assets/sql has the latest SQL tables:

mysqldump --compact --no-create-info -u DATABASE_USER -p DATABASE_NAME aiki_widgets --where=app_id=0 > sql/oflb_aiki_widgets.sql

mysqldump --compact --no-create-info --where="id>'20'" -u DB_USER -p DB_NAME aiki_forms > sql/oflb_aiki_forms.sql

Then check in all code and then all submodules and then git push everything.

http://openfontlibrary.org/en/guidebook/edit/dev-faq

STEP 5) Update Staging

From the Staging site, pull all new code and update all submodules.

Then from the assets directory, push the new widgets into the db:

mysql --execute="delete from aiki_widgets where app_id = '0'" -u DATABASE_USER -p DATABASE_NAME && mysql -u DATABASE_USER -p DATABASE_NAME < sql/oflb_aiki_widgets.sql

mysql --execute="delete from aiki_forms where id > '20'" -u DATABASE_USER -p DATABASE_NAME && mysql -u DATABASE_USER -p DATABASE_NAME < sql/oflb_aiki_forms.sql

If any new plugins were added, then run the setup_plugin.php through your browser.

STEP 6) Test and Repeat

Test everything on Staging. If it's working, repeat Step 5 for the Live site!