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/backup
as.bz2
files. 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 --recursive
This 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 -p
which python2.7-r REQUIREMENTS CoBL
Basically make sure you've got theREQUIREMENTS
installed and are usingpython2.7
. -
Install bower dependencies: Inside the
CoBL/static
directory, 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.json
to provide it for you. Callingnpm install
should do the trick. Inside theCoBL/static
directory, run:grunt default
- If you don't have grunt on your system, you can use the
-
Copy
CoBL/ielex/local_settings.py.dist
toCoBL/ielex/local_settings.py
, and edit it.
-
Set
DEBUG
how 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_KEY
to something secret.
- Test that the database connection works and migrations are applied correctly:
From
CoBL/
run:python2.7 manage.py syncdb
python2.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
grunt
andbower
usingnpm
:
npm install -g bower
npm install -g grunt-cli
- Install project specific
npm
dependencies:
# In CoBL/static:
npm install
- Install project specific
bower
dependencies:
# In CoBL/static:
bower install
- Check and minify JavaScript with
grunt
:
# In CoBL/static:
grunt
You 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
cobl
user 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/passwd
home ofcobl
was set to/srv/cobl
. -
postgresql
was installed, and a usercobl
owning a databasecobl
was 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
deployment
are installed usingdeployment/placeUnitFiles.sh
. -
Updates to this setup are expected to be processed using the
deployment/update.sh
script, which should be executed as usercobl
.