Update npm and install a few global packages:
$ npm update && npm install --silent -g [email protected] [email protected] [email protected] [email protected]
Upgrade pip, setuptools and wheel to make sure you have latest versions:
$ mkvirtualenv ils
(ils)$ pip install --upgrade pip setuptools wheel
Install Invenio ILS:
(ils)$ pip install e-ternity[postgresql,elasticsearch2] --process-dependency-links
Install web assets (JavaScript and CSS dependencies):
(ils)$ invenio npm
(ils)$ cdvirtualenv var/instance/static/
(ils)$ npm install
Build web assets and collect static files:
(ils)$ invenio collect -v
(ils)$ invenio assets build
Next, you need to configure Invenio to tell where it can find your SQL database, Redis cache, RabbitMQ message broker and Elasticsearch search engine:
The configuration file is located in:
<sys.prefix>/var/instance/invenio.cfg
In the examples below we assume the remote services are running on the IP
address 192.168.33.3
.
Note
If you have everything running locahost
without passwords, you can skip
the configuration as everything is pre-configured for localhost
.
The most important Invenio related configuration to set is:
SECRET_KEY = '...your-very-secret-key...'
The secret key is used for protecting sessions and encrypting/decrypting tokens. For production systems is critical to set this configuration to keep your system secure.
Next, you need to tell Invenio which database you want to use. By default for
development purposes, Invenio will create a SQLite database next to
invenio.cfg
. To configure Invenio to use e.g. PostgreSQL set the following
configuration:
SQLALCHEMY_DATABASE_URI='postgresql://invenio:[email protected]/invenio'
Next, point Invenio to your Elasticsearch cluster:
SEARCH_ELASTIC_HOSTS=['192.168.33.3:9200']
Next, configure where Invenio can find the RabbitMQ message broker used for background jobs and bulk indexing:
BROKER_URL='amqp://invenio:[email protected]:5672/invenio'
Last, you need to configure where Invenio can find the Redis cache. The cache needs to be set in a couple of variables, as it is being used for different purposes (e.g. session store, background job results, caching):
CACHE_TYPE='redis'
CACHE_REDIS_URL='redis://192.168.33.3:6379/0'
ACCOUNTS_SESSION_REDIS_URL='redis://192.168.33.3:6379/1'
CELERY_RESULT_BACKEND='redis://192.168.33.3:6379/2'
Note, that each variable above points to a different database number in Redis
(the 0
, 1
, 2
suffix in the URL)
The last you need to do is to create the database tables and search indexes.
Create the database (not needed if the database was created outside of invenio already):
(ils)$ invenio db init
Create the database tables:
(ils)$ invenio db create
Create the search indexes and indexing queue:
(ils)$ invenio index init
(ils)$ invenio index queue init
Note
If for some reason something failed during table or index creation, you can remove everything again with:
(ils)$ invenio db drop --yes-i-know
(ils)$ invenio index destroy --force
You can load demo data by simply running:
(ils)$ invenio demo init