This code base is a fork of the ELRC-SHARE software, itself a fork of the META-SHARE software.
With respect to the ELRC-SHARE, the ELRI National Relay Station (NRS) software will integrate, among other things:
- group-based policy management,
- automatic language resource processing toolchain integration
- manual quality control workflow elements.
- Java 8
In order to set up a minimal working development version of the platform, the following steps need to be undertaken:
-
Copy
metashare/local_settings.sample
tometashare/local_settings.py
and change the local_settings accordingly. -
Set up a Python 2 virtualenv
virtualenv venv
activate it
source venv/bin/activate
and install the dependencies via
pip install -r requirements.txt
Check the version for
psycopg2
in the requirements file. You may need to usepsycopg2==2.7
. Check ifflup
is also in the requirements file. It may be needed.If this error occurs:
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: /data/elri/ELRI/venv/local/lib/python2.7/site-packages/psycopg2/.libs/./libresolv-2-c4c53def.5.so: symbol __res_maybe_init version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
Try upgrading
psycopg2
:pip install psycopg2 --upgrade
-
Launch Solr by
cd
-ing in thesolr/
folder and doingjava -jar -Djetty.port=chosen_port start.jar
Make sure to update the
SOLR_URL
andTESTING_SOLR_URL
environment variables inmetashare/local_settings.py
accordingly. -
Set up a PostgreSQL database and provide relevant information to the relevant
local_settings.py
section, this is updating theDATABASES
variable.4.1. Install
postgresql
sudo apt install postgresql postgresql-contrib
4.2. Change
postgresql
access mode to create new database(s) and user(s). Edit thepb_hba.conf
file by using the editor of your choice. The filepg_hba.conf
will most likely be at /etc/postgresql/9.x/main/pg_hba.conf or /etc/postgresql/10/main/pg_hba.conf``` sudo <editor> /etc/postgresql/10/main/pg_hba.conf #Database administrative login by Unix domain socket #local all postgres peer local all postgres trust # Database administrative login by Unix domain socket #local all all peer local all all md5 # Allow replication connections from localhost, by a user with the # replication privilege. #local replication all peer local replication all md5 ```
And restart the
postgresql
service``` sudo service postgresql restart ```
4.3. Create a user and assign to it a password. The one you will add to the
local_settings.py
file.``` psql -U postgres postgres=# create role your_user; postgres=# alter user your_user with encrypted password 'yourPassword' ; ``` and allow this user to login to the psql service: ``` createdb -U postgres your_user psql -U postgres postgres=# grant all privileges on database your_user to your_user ; postgres=# ALTER ROLE "your_user" WITH LOGIN; ```
At this point, you will be able to login with your user doing
psql -U your_user
.4.4. Create a database. The one you will add to the
local_settings.py
file. And grant permissions to the user you created before.``` createdb -U postgres your_metashare_db psql -U postgres postgres=# grant all privileges on database your_metashare_db to \ your_user ; ```
If you have allowed the login for the
your_user
user, you will be able to login on theyour_metashare_db
data base by doing``` psql -U your_user your_metashare_db ```
4.5. Check the
postgresql
service port:``` sudo netstat -nl | grep postgres unix 2 [ ACC ] STREAM LISTENING 186337 /var/run/postgresql/.s.PGSQL.5433 ```
and check the
PORT
field in theDATABASES
variable of thelocal_settings.py
, in this case it should be5433
. -
Generate migrations for the relevant apps by doing a
python manage.py makemigrations accounts repository stats \ recommendations storage
-
Do a
python manage.py migrate
to set up the DB schema.
-
Do a
python manage.py rebuild_index
to set up the Solr index.
-
Create the directories
metashare/unprocessed
andmetashare/processed
. -
Create the file
metashare/maintainers.dat
, which should have the following format:Country_name:maintainer_user_name_1,user_name_2,...
for each authorised country_name/maintainer_user_name in the system.
-
Create the folder specified in the
STATIC_ROOT
metashare/local_settings.py
environment variable and runpython manage.py collectstatic
to collect all static files to the STATIC_ROOT directory.
-
Create a superuser so that one can log in to the application:
python manage.py createsuperuser
and follow the instructions.
-
Add to the
local_settings.py
the list ofALLOWED_HOSTS
from which the webapp will be available:ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
Should you need to access the development server from remote machines, you need to set up
ALLOWED_HOSTS
to accept connections from any host:ALLOWED_HOSTS = ["*"]
Also, check the
DJANGO_BASE
and theDJANGO_URL
variables to know the base path under which Django is deployed. By default, the webapp will be deployed inhttp://localhost:8000/django_base_value
. -
Do a
python manage.py runserver --insecure
to launch the app in the development mode.
If you want to launch the app in development mode and make it available from an internal network run:
python manage.py runserver 0.0.0.0:port --insecure
We provide the
start_dev_webapp.sh
script for starting the app in development mode and making it accessible from an internal network. And thestop_dev_webapp.sh
script to stop the webapp. Notice that you may need to change the ports used in these scripts.