Installation of erecord (development case)ΒΆ

*******************************************************************************
                            Install erecord

        Case of development under ubuntu with django development server

           Versions : ubuntu 17.10

*******************************************************************************

"Rename" erecord path as /opt/erecord, if erecord is installed somewhere else
(ln -s 'erecord path' /opt/erecord).

================
Some basic tools
================

- python 2.7 
- python-pip
- virtualenv tool

===========================
Copy of erecord source code
===========================

  - get erecord source code :
    git clone https://forgemia.inra.fr/record/recordweb.git
    => erecord source code is recordweb/vle-x/trunk/erecord

  - copy (or link) erecord as /opt/erecord

Notes :
- /opt/erecord/factory and /opt/erecord/repositories are empty at this stage.
- /opt/erecord/factory will contain things generated later on.
- /opt/erecord/repositories will contain some models repositories installed
  later on.

=====================
erecordenv virtualenv
=====================

- erecordenv virtualenv creation :
  virtualenv /opt/erecord/factory/install/erecordenv -p /usr/bin/python2.7 --no-site-packages

- erecordenv virtualenv activation :
  - in bash or sh case :
    source /opt/erecord/factory/install/erecordenv/bin/activate
  - in csh or tcsh case :
    source /opt/erecord/factory/install/erecordenv/bin/activate.csh

- just to control the activation of erecordenv virtualenv : which python

- installation (into erecordenv) from requirement.txt :
  pip install -r /opt/erecord/erecord/install/requirement.txt

==============================
erecord software configuration
==============================

- /opt/erecord/erecord/apps/erecord_cmn/configs/config.py file modifications :

      IN_PRODUCTION = False

- /opt/erecord/erecord/projects/ws/ws/settings.py file modifications :

      DEBUG = True

- URLs :
  Some URL values directly appear in source code (.py, .rst). They have to be
  in conformity with the documentation installation (see below) :

    Replace erecord.toulouse.inra.fr by 127.0.0.1 :

    - into /opt/erecord/docs/server/index.html

    - into /opt/erecord/erecord/apps/erecord_cmn/configs/config.py
      for ONLINEDOC_*

    - into /opt/erecord/erecord/apps/erecord_cmn/templates/erecord_cmn/index.html

    - into /opt/erecord/docs/source/devel/design/webapi/include/online_*.rst

    (commands, if 'erecord.toulouse.inra.fr' has to be replaced by
     '127.0.0.1' into online_*.rst files :
     cd /opt/erecord/docs/source/devel/design/webapi/include ;
     sed -i 's/erecord.toulouse.inra.fr/127.0.0.1/g' online_url*.rst ; )

====================================================
erecord static files generation (creation, updating)
====================================================

Static files (css, js, images)  :

  # if not yet done, activate erecordenv virtualenv :
  source /opt/erecord/factory/install/erecordenv/bin/activate
  # or source /opt/erecord/factory/install/erecordenv/bin/activate.csh
  cd /opt/erecord/erecord/projects/ws
  python manage.py collectstatic

========================================
erecord database creation (and updating)
========================================

Database /opt/erecord/databases/erecord_default.sqlite3 :

  # if not yet done, activate erecordenv virtualenv :
  source /opt/erecord/factory/install/erecordenv/bin/activate
  # or source /opt/erecord/factory/install/erecordenv/bin/activate.csh

  cd /opt/erecord/erecord/projects/ws

  - create/update database :
    python manage.py makemigrations erecord_db
    python manage.py makemigrations erecord_acs
    python manage.py makemigrations erecord_vpz
    python manage.py makemigrations erecord_slm
    python manage.py migrate

  - create admin user into database :
    python manage.py createsuperuser
                                     ... => admin user (erecordadmin)

==========================
erecord main documentation
==========================

- Main documentation generation :

  # if not yet done, activate erecordenv virtualenv :
  source /opt/erecord/factory/install/erecordenv/bin/activate
  # or source /opt/erecord/factory/install/erecordenv/bin/activate.csh
  cd /opt/erecord/docs
  make clean
  make cleanref
  make ref
  make html

  Note : The resulting documentation is produced under /opt/erecord/factory/docs

===
Run
===

  # if not yet done, activate erecordenv virtualenv :
  source /opt/erecord/factory/install/erecordenv/bin/activate
  # or source /opt/erecord/factory/install/erecordenv/bin/activate.csh

  cd /opt/erecord/erecord/projects/ws
  # (+ see static files updating and database updating)
  python manage.py runserver

=====
Notes
=====

- erecord online at :
  - erecord web site     : http://127.0.0.1/........... .
  - erecord web services : http://127.0.0.1:8000 .

- Installation remaining to be done :
  - vle environment (several vle versions, models repositories, models,
    simulators) : see /opt/erecord/erecord/install/vle/install_vle.txt

- To generate/use simulators HTML home pages : modify base_url into
  /opt/erecord/erecord/docs/vpzpages/build_vpzpages.py,get_token.py
  (127.0.0.1 address) and see
  /opt/erecord/erecord/install/prod/install_vpz_html_home_pages.txt

- See also /opt/erecord/erecord/install/help.txt.

*******************************************************************************