Skip to content

Commit

Permalink
installation: ILS demo site
Browse files Browse the repository at this point in the history
* BETTER Updates Invenio demo site to use the new ILS flavour. Amends
  installation scripts and documentation accordingly.

* Switches to using `invenio` instead of `invenio3` as the canonical instance
  name.

Signed-off-by: Tibor Simko <tibor.simko@cern.ch>
  • Loading branch information
tiborsimko committed Mar 19, 2017
1 parent 5dc654e commit 72817e1
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 140 deletions.
8 changes: 4 additions & 4 deletions .inveniorc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

# sphinxdoc-kickstart-configuration-variables-begin
export INVENIO_WEB_HOST=192.168.50.10
export INVENIO_WEB_INSTANCE=invenio3
export INVENIO_WEB_VENV=invenio3
export INVENIO_WEB_INSTANCE=invenio
export INVENIO_WEB_VENV=invenio
export INVENIO_USER_EMAIL=info@inveniosoftware.org
export INVENIO_USER_PASS=uspass123
export INVENIO_POSTGRESQL_HOST=192.168.50.11
export INVENIO_POSTGRESQL_DBNAME=invenio3
export INVENIO_POSTGRESQL_DBUSER=invenio3
export INVENIO_POSTGRESQL_DBNAME=invenio
export INVENIO_POSTGRESQL_DBUSER=invenio
export INVENIO_POSTGRESQL_DBPASS=dbpass123
export INVENIO_REDIS_HOST=192.168.50.12
export INVENIO_ELASTICSEARCH_HOST=192.168.50.13
Expand Down
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ FROM python:2.7-slim

# Configure Invenio instance:
ENV INVENIO_WEB_HOST=127.0.0.1
ENV INVENIO_WEB_INSTANCE=invenio3
ENV INVENIO_WEB_VENV=invenio3
ENV INVENIO_WEB_INSTANCE=invenio
ENV INVENIO_WEB_VENV=invenio
ENV INVENIO_USER_EMAIL=info@inveniosoftware.org
ENV INVENIO_USER_PASS=uspass123
ENV INVENIO_POSTGRESQL_HOST=postgresql
ENV INVENIO_POSTGRESQL_DBNAME=invenio3
ENV INVENIO_POSTGRESQL_DBUSER=invenio3
ENV INVENIO_POSTGRESQL_DBNAME=invenio
ENV INVENIO_POSTGRESQL_DBUSER=invenio
ENV INVENIO_POSTGRESQL_DBPASS=dbpass123
ENV INVENIO_REDIS_HOST=redis
ENV INVENIO_ELASTICSEARCH_HOST=elasticsearch
Expand All @@ -58,10 +58,10 @@ USER invenio
RUN /code/scripts/create-instance.sh

# Make given VENV default:
ENV PATH=/home/invenio/.virtualenvs/invenio3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PATH=/home/invenio/.virtualenvs/invenio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
RUN echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
RUN echo "workon invenio3" >> ~/.bashrc
RUN echo "workon invenio" >> ~/.bashrc

# Start the Invenio application:
CMD ["/bin/bash", "-c", "invenio3 run -h 0.0.0.0"]
CMD ["/bin/bash", "-c", "invenio run -h 0.0.0.0"]
20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015, 2016 CERN.
# Copyright (C) 2015, 2016, 2017 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand All @@ -25,18 +25,18 @@
web:
restart: "always"
build: .
command: /bin/bash -c "invenio3 run -h 0.0.0.0"
command: /bin/bash -c "invenio run -h 0.0.0.0"
environment:
- PATH=/home/invenio/.virtualenvs/invenio3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- PATH=/home/invenio/.virtualenvs/invenio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
- INVENIO_WEB_HOST=127.0.0.1
- INVENIO_WEB_INSTANCE=invenio3
- INVENIO_WEB_VENV=invenio3
- INVENIO_WEB_INSTANCE=invenio
- INVENIO_WEB_VENV=invenio
- INVENIO_USER_EMAIL=info@inveniosoftware.org
- INVENIO_USER_PASS=uspass123
- INVENIO_POSTGRESQL_HOST=postgresql
- INVENIO_POSTGRESQL_DBNAME=invenio3
- INVENIO_POSTGRESQL_DBUSER=invenio3
- INVENIO_POSTGRESQL_DBNAME=invenio
- INVENIO_POSTGRESQL_DBUSER=invenio
- INVENIO_POSTGRESQL_DBPASS=dbpass123
- INVENIO_REDIS_HOST=redis
- INVENIO_ELASTICSEARCH_HOST=elasticsearch
Expand All @@ -56,8 +56,8 @@ postgresql:
restart: "always"
image: postgres
environment:
- POSTGRES_USER=invenio3
- POSTGRES_DB=invenio3
- POSTGRES_USER=invenio
- POSTGRES_DB=invenio
- POSTGRES_PASSWORD=dbpass123
ports:
- "25432:5432"
Expand Down Expand Up @@ -97,5 +97,5 @@ static:
restart: "no"
build: .
volumes:
- /home/invenio/.virtualenvs/invenio3/var/invenio3-instance/static
- /home/invenio/.virtualenvs/invenio/var/instance/static
user: invenio
38 changes: 11 additions & 27 deletions docs/installation/installation-detailed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -544,30 +544,14 @@ brand new Invenio v3.0 instance:
:end-before: # sphinxdoc-create-virtual-environment-end
:literal:

We continue by installing Invenio v3.0 base package and most of its available
modules (by using option ``full`` as opposed to using option ``minimal``) from
PyPI:
We continue by installing Invenio v3.0 Integrated Library System flavour demo
site from PyPI:

.. include:: ../../scripts/create-instance.sh
:start-after: # sphinxdoc-install-invenio-full-begin
:end-before: # sphinxdoc-install-invenio-full-end
:literal:

We can now create a new Invenio instance:

.. include:: ../../scripts/create-instance.sh
:start-after: # sphinxdoc-create-instance-begin
:end-before: # sphinxdoc-create-instance-end
:literal:

We can now install the newly created instance by means of provided ``setup.py``
script:

.. include:: ../../scripts/create-instance.sh
:start-after: # sphinxdoc-install-instance-begin
:end-before: # sphinxdoc-install-instance-end
:literal:

Let's briefly customise our instance with respect to the location of the
database server, the Redis server, the Elasticsearch server, and all the other
dependent services in our multi-server environment:
Expand Down Expand Up @@ -614,19 +598,19 @@ We continue by creating a user account:
:end-before: # sphinxdoc-create-user-account-end
:literal:

We proceed by populating our Invenio instance with demo MARCXML records that are
taken from the ``invenio-records`` package:
We can now create the Elasticsearch indexes and initialise the indexing queue:

.. include:: ../../scripts/populate-instance.sh
:start-after: # sphinxdoc-populate-with-demo-records-begin
:end-before: # sphinxdoc-populate-with-demo-records-end
:start-after: # sphinxdoc-index-initialisation-begin
:end-before: # sphinxdoc-index-initialisation-end
:literal:

Let's index all the uploaded records:
We proceed by populating our Invenio demo instance with some example demo
MARCXML records:

.. include:: ../../scripts/populate-instance.sh
:start-after: # sphinxdoc-index-all-records-begin
:end-before: # sphinxdoc-index-all-records-end
:start-after: # sphinxdoc-populate-with-demo-records-begin
:end-before: # sphinxdoc-populate-with-demo-records-end
:literal:

Start instance
Expand All @@ -650,13 +634,13 @@ We should now see our demo records on the web:

.. code-block:: shell
firefox http://localhost/records/1
firefox http://${INVENIO_WEB_HOST}/records/1
and we can access them via REST API:

.. code-block:: shell
curl -i -H "Accept: application/json" \
http://localhost/api/records/1
http://${INVENIO_WEB_HOST}/api/records/1
We are done! Our first Invenio v3.0 demo instance is fully up and running.
2 changes: 1 addition & 1 deletion docs/installation/installation-quick.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ installation scripts manually::
scripts/provision-rabbitmq.sh
scripts/provision-worker.sh
scripts/create-instance.sh
scripts/start-instance.sh
scripts/populate-instance.sh
scripts/start-instance.sh
firefox http://192.168.50.10/records/1

See :ref:`installation_detailed` for more information.
4 changes: 2 additions & 2 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 CERN.
# Copyright (C) 2016, 2017 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand All @@ -24,4 +24,4 @@

FROM nginx
RUN rm /etc/nginx/conf.d/default.conf
ADD invenio3.conf /etc/nginx/conf.d/
ADD invenio.conf /etc/nginx/conf.d/
2 changes: 1 addition & 1 deletion nginx/invenio3.conf → nginx/invenio.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ server {
charset utf-8;

location /static {
root /home/invenio/.virtualenvs/invenio3/var/invenio3-instance;
root /home/invenio/.virtualenvs/invenio/var/instance;
}

location / {
Expand Down
3 changes: 2 additions & 1 deletion requirements-devel.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015, 2016 CERN.
# Copyright (C) 2015, 2016, 2017 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand All @@ -25,6 +25,7 @@
-e git+https://github.com/inveniosoftware/dojson.git#egg=dojson
-e git+https://github.com/inveniosoftware/invenio-access.git#egg=invenio-access
-e git+https://github.com/inveniosoftware/invenio-accounts.git#egg=invenio-accounts
-e git+https://github.com/inveniosoftware/invenio-app-ils.git#egg=invenio-app-ils[postgresql,elasticsearch2]
-e git+https://github.com/inveniosoftware/invenio-assets.git#egg=invenio-assets
-e git+https://github.com/inveniosoftware/invenio-base.git#egg=invenio-base
-e git+https://github.com/inveniosoftware/invenio-celery.git#egg=invenio-celery
Expand Down
37 changes: 8 additions & 29 deletions scripts/create-instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ if [ "${INVENIO_WEB_HOST}" = "" ]; then
fi
if [ "${INVENIO_WEB_INSTANCE}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_WEB_INSTANCE before runnning this script."
echo "[ERROR] Example: export INVENIO_WEB_INSTANCE=invenio3"
echo "[ERROR] Example: export INVENIO_WEB_INSTANCE=invenio"
exit 1
fi
if [ "${INVENIO_WEB_VENV}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_WEB_VENV before runnning this script."
echo "[ERROR] Example: export INVENIO_WEB_VENV=invenio3"
echo "[ERROR] Example: export INVENIO_WEB_VENV=invenio"
exit 1
fi
if [ "${INVENIO_USER_EMAIL}" = "" ]; then
Expand All @@ -56,12 +56,12 @@ if [ "${INVENIO_POSTGRESQL_HOST}" = "" ]; then
fi
if [ "${INVENIO_POSTGRESQL_DBNAME}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_POSTGRESQL_DBNAME before runnning this script."
echo "[ERROR] Example: INVENIO_POSTGRESQL_DBNAME=invenio3"
echo "[ERROR] Example: INVENIO_POSTGRESQL_DBNAME=invenio"
exit 1
fi
if [ "${INVENIO_POSTGRESQL_DBUSER}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_POSTGRESQL_DBUSER before runnning this script."
echo "[ERROR] Example: INVENIO_POSTGRESQL_DBUSER=invenio3"
echo "[ERROR] Example: INVENIO_POSTGRESQL_DBUSER=invenio"
exit 1
fi
if [ "${INVENIO_POSTGRESQL_DBPASS}" = "" ]; then
Expand Down Expand Up @@ -100,8 +100,6 @@ scriptpathname=$(cd "$(dirname "$0")" && pwd)
# sphinxdoc-create-virtual-environment-begin
mkvirtualenv "${INVENIO_WEB_VENV}"
cdvirtualenv
mkdir -p src
cd src
# sphinxdoc-create-virtual-environment-end

# quit on errors and unbound symbols:
Expand All @@ -110,41 +108,22 @@ set -o nounset

if [[ "$@" != *"--devel"* ]]; then
# sphinxdoc-install-invenio-full-begin
# now we can install full Invenio:
# FIXME upgrade to dojson 1.3.0 WRT mappings and unpin
pip install dojson==1.2.1
pip install invenio-marc21==1.0.0a3
pip install invenio[full,postgresql] --pre
pip install invenio-app-ils[postgresql,elasticsearch2]
# sphinxdoc-install-invenio-full-end
else
pip install -r "$scriptpathname/../requirements-devel.txt"
fi

# sphinxdoc-create-instance-begin
inveniomanage instance create "${INVENIO_WEB_INSTANCE}"
# sphinxdoc-create-instance-end

if [[ "$@" != *"--devel"* ]]; then
# sphinxdoc-install-instance-begin
cd "${INVENIO_WEB_INSTANCE}"
pip install -e .
# sphinxdoc-install-instance-end
else
pip install -r requirements-devel.txt
fi

# sphinxdoc-customise-instance-begin
mkdir -p "../../var/${INVENIO_WEB_INSTANCE}-instance/"
mkdir -p "var/instance/"
pip install "jinja2-cli>=0.6.0"
jinja2 "$scriptpathname/instance.cfg" > "../../var/${INVENIO_WEB_INSTANCE}-instance/${INVENIO_WEB_INSTANCE}.cfg"
jinja2 "$scriptpathname/instance.cfg" > "var/instance/${INVENIO_WEB_INSTANCE}.cfg"
# sphinxdoc-customise-instance-end

# sphinxdoc-run-npm-begin
cd "${INVENIO_WEB_INSTANCE}"
${INVENIO_WEB_INSTANCE} npm
cdvirtualenv "var/${INVENIO_WEB_INSTANCE}-instance/static"
cdvirtualenv "var/instance/static"
CI=true npm install
cd -
# sphinxdoc-run-npm-end

# sphinxdoc-collect-and-build-assets-begin
Expand Down
21 changes: 3 additions & 18 deletions scripts/instance.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Database
SQLALCHEMY_DATABASE_URI='postgresql+psycopg2://{{ environ('INVENIO_POSTGRESQL_DBUSER') }}:{{ environ('INVENIO_POSTGRESQL_DBPASS') }}@{{ environ('INVENIO_POSTGRESQL_HOST') }}:5432/{{ environ('INVENIO_POSTGRESQL_DBNAME') }}'

# Static file
# Statis files
COLLECT_STORAGE='flask_collect.storage.file'

# Redis
Expand All @@ -13,29 +13,14 @@ ACCOUNTS_SESSION_REDIS_URL='redis://{{ environ('INVENIO_REDIS_HOST') }}:6379/1'
# Celery
BROKER_URL='amqp://guest:guest@{{ environ('INVENIO_RABBITMQ_HOST') }}:5672//'
CELERY_RESULT_BACKEND='redis://{{ environ('INVENIO_REDIS_HOST') }}:6379/2'
CELERY_ACCEPT_CONTENT=['json', 'msgpack', 'yaml']

# Elasticsearch
SEARCH_ELASTIC_HOSTS='{{ environ('INVENIO_ELASTICSEARCH_HOST') }}'

try:
from invenio_marc21.config import MARC21_REST_ENDPOINTS as RECORDS_REST_ENDPOINTS
except ImportError:
import copy
from invenio_records_rest.config import RECORDS_REST_ENDPOINTS as RRE
RECORDS_REST_ENDPOINTS = copy.deepcopy(RRE)
RECORDS_REST_ENDPOINTS['recid']['search_index'] = 'marc21'

RECORDS_UI_ENDPOINTS = {
'recid': {
'pid_type': 'recid',
'route': '/records/<pid_value>',
'template': 'invenio_marc21/detail.html',
},
}

# JSON Schema
JSONSCHEMAS_ENDPOINT='/schema'
JSONSCHEMAS_HOST='{{ environ('INVENIO_WEB_HOST') }}'

# OAI server
OAISERVER_RECORD_INDEX='marc21'
OAISERVER_ID_PREFIX='oai:{{ environ('INVENIO_WEB_INSTANCE') }}:recid/'
Loading

0 comments on commit 72817e1

Please sign in to comment.