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.sampletometashare/local_settings.pyand change the local_settings accordingly. -
Set up a Python 2 virtualenv
virtualenv venvactivate it
source venv/bin/activateand install the dependencies via
pip install -r requirements.txtCheck the version for
psycopg2in the requirements file. You may need to usepsycopg2==2.7. Check ifflupis 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 referenceTry upgrading
psycopg2:pip install psycopg2 --upgrade -
Launch Solr by
cd-ing in thesolr/folder and doingjava -jar -Djetty.port=chosen_port start.jarMake sure to update the
SOLR_URLandTESTING_SOLR_URLenvironment variables inmetashare/local_settings.pyaccordingly. -
Set up a PostgreSQL database and provide relevant information to the relevant
local_settings.pysection, this is updating theDATABASESvariable.4.1. Install
postgresqlsudo apt install postgresql postgresql-contrib4.2. Change
postgresqlaccess mode to create new database(s) and user(s). Edit thepb_hba.conffile by using the editor of your choice. The filepg_hba.confwill 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
postgresqlservice``` sudo service postgresql restart ```4.3. Create a user and assign to it a password. The one you will add to the
local_settings.pyfile.``` 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.pyfile. 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_useruser, you will be able to login on theyour_metashare_dbdata base by doing``` psql -U your_user your_metashare_db ```4.5. Check the
postgresqlservice port:``` sudo netstat -nl | grep postgres unix 2 [ ACC ] STREAM LISTENING 186337 /var/run/postgresql/.s.PGSQL.5433 ```and check the
PORTfield in theDATABASESvariable 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 migrateto set up the DB schema.
-
Do a
python manage.py rebuild_indexto set up the Solr index.
-
Create the directories
metashare/unprocessedandmetashare/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_ROOTmetashare/local_settings.pyenvironment variable and runpython manage.py collectstaticto collect all static files to the STATIC_ROOT directory.
-
Create a superuser so that one can log in to the application:
python manage.py createsuperuserand follow the instructions.
-
Add to the
local_settings.pythe list ofALLOWED_HOSTSfrom 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_HOSTSto accept connections from any host:ALLOWED_HOSTS = ["*"]Also, check the
DJANGO_BASEand theDJANGO_URLvariables 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 --insecureto 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 --insecureWe provide the
start_dev_webapp.shscript for starting the app in development mode and making it accessible from an internal network. And thestop_dev_webapp.shscript to stop the webapp. Notice that you may need to change the ports used in these scripts.