The CoBL project builds on top of the LexDB that is used to serve http://ielex.mpi.nl/.
To install CoBL yourself, the following dependencies must be provided:
- A running instance of PostgreSQL complete with a database to use.
- Python 3 and pip to install the
REQUIREMENTS. - npm and Bower to install JavaScript dependencies and bootstrap.
- Grunt to minify JavaScript.
- git to clone the repo.
To install follow these steps:
-
Make sure you've got PostgreSQL up and running with a database to use for CoBL.
-
Get hold of a recent database dump. If you have access to the lingdb server you will find recent ones in
/srv/container/postgres/backupas.bz2files. Insert this dump into your database. If you're using the container setup you can use the lingdb/postgres container for this task. -
Clone CoBL into a directory of your choice. Make sure to also provide potential submodules:
git submodule init git submodule update --recursiveThis is currently used for the logo but will likely be changed in the future.
-
If you're using
virtualenvwrapper, a command like this may be helpful:mkvirtualenv -pwhich python2.7-r REQUIREMENTS CoBLBasically make sure you've got theREQUIREMENTSinstalled and are usingpython2.7. -
Install bower dependencies: Inside the
CoBL/staticdirectory, run:bower install -
Use grunt to create minified JavaScript:
- If you don't have grunt on your system, you can use the
CoBL/static/package.jsonto provide it for you. Callingnpm installshould do the trick. Inside theCoBL/staticdirectory, run:grunt default
- If you don't have grunt on your system, you can use the
-
Copy
CoBL/ielex/local_settings.py.disttoCoBL/ielex/local_settings.py, and edit it.
-
Set
DEBUGhow you like it. If it isTrue, CoBL will serve static files itself and will not require the minified JavaScript so the grunt step isn't strictly necessary. If it is set toFalse, CoBL will use the minified JavaScript and will not provide static files itself. In this case an additional nginx to serve static files is a good choice. -
Set the database connection settings to something like this:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'ielexdb201510', 'USER': 'ielexuser', 'PASSWORD': 'rieloh7aes8ooGuu5AiPoo0dahj8ooqu', 'HOST': 'localhost', 'PORT': '5432', 'ATOMIC_REQUESTS': True # Required by sqlite3 (only) } } -
Set
SECRET_KEYto something secret.
- Test that the database connection works and migrations are applied correctly:
From
CoBL/run:python2.7 manage.py syncdbpython2.7 manage.py migrate
- Run the site from
CoBL:python2.7 manage.py runserver
CoBL uses AMD with RequireJS to keep the JavaScript code organized.
For deployment the JavaScript code gets minified to keep the filesize small.
We use a hash function to derive the name of the minified file.
The resulting file will have a name like minified.af9b00f5.js which will be specific enough so that
future changes will likely have different names and outdated browser caches won't be problematic.
Stylewise we make sure that our JavaScript code fits the expectations of JSHint to the extent that deployment will fail when code isn't formatted correctly.
Instead of tracking all our dependencies trough git directly or downloading them manually we use popular tools like npm and Bower. This makes it easy to upgrade dependencies to newer versions in the future and keeps the repository slim.
- Install node together with
npm. - Install
gruntandbowerusingnpm:
npm install -g bower
npm install -g grunt-cli- Install project specific
npmdependencies:
# In CoBL/static:
npm install- Install project specific
bowerdependencies:
# In CoBL/static:
bower install- Check and minify JavaScript with
grunt:
# In CoBL/static:
gruntYou can also instruct grunt to continuously watch files for changes
using grunt watch or to only use jshint using grunt jshint.
-
This repo was checked out to /srv/cobl
-
A
cobluser was created using these commands:useradd -M cobl # -M: no homedirectory created usermod -L cobl # -L: no login allowed for user chown -R cobl.cobl /srv/cobl
By editing
/etc/passwdhome ofcoblwas set to/srv/cobl. -
postgresqlwas installed, and a usercoblowning a databasecoblwas created. -
A virtualenv was created and cobl was setup using these commands:
su cobl pwd # should be /srv/cobl virtualenv -p `which python3` venv # Creates virtualenv for the project ./venv/bin/pip install --upgrade pip ./venv/bin/pip install -r REQUIREMENTS cd static npm install nodejs ./node_modules/bower/bin/bower install nodejs ./node_modules/grunt-cli/bin/grunt
-
Nginx is installed and configured using the config in
deployment/nginx/sites-available/cobl. -
The unit files found in
deploymentare installed usingdeployment/placeUnitFiles.sh. -
Updates to this setup are expected to be processed using the
deployment/update.shscript, which should be executed as usercobl.