Commit dac1fa3c authored by Nathalie Rousse's avatar Nathalie Rousse
Browse files

Mainly documentation of installation

parent 470b2801
......@@ -2,8 +2,7 @@
<head>
<title>erecord web services</title>
<!-- meta http-equiv="refresh" content="0; URL=http://erecord.toulouse.inra.fr:8000"-->
<meta http-equiv="refresh" content="0; URL=http://147.100.179.168:8000">
<meta http-equiv="refresh" content="0; URL=http://erecord.toulouse.inra.fr:8000">
</head>
<body></body>
......
......@@ -42,13 +42,13 @@ The erecord project software is developed with :
.. literalinclude:: ../../../../erecord/install/requirement.txt
The stored models software have previously been developed with vle, that is a C++ platform.
The stored models software have previously been developed with :term:`vle`, that is a C++ platform.
Deployment environment
----------------------
The software is deployed on a virtual machine with **Debian 9.5** (*Stretch*),
**Apache2.4** server and **mod_wsgi**.
The software has been deployed on a virtual machine with **Debian 9.5**
(*Stretch*), **Apache2.4** server and **mod_wsgi**.
*Django’s primary deployment platform is WSGI, the Python standard for web
servers and applications. mod_wsgi is an Apache module which can host any
......@@ -61,14 +61,20 @@ Installation procedure
- :ref:`devel_deployment_install_vle`
- :ref:`devel_deployment_install_vle_repositories`
Running instructions
====================
More
====
See :ref:`deploy_run_server`.
:ref:`Installation of erecord in case of development situation <devel_deployment_install_erecord_devcase>`
OLDASUPPRIMER
=============
Ce qui suit OLDASUPPRIMER
=========================
See :ref:`devel_deployment_updating_case`.
See :ref:`devel_deployment_fromscratch_case`.
Running instructions
====================
See :ref:`deploy_run_server`.
......@@ -4,5 +4,19 @@
Installation of erecord
=======================
.. literalinclude:: ../../../../erecord/install/debian/apache2.4/install.txt
.. literalinclude:: ../../../../erecord/install/prod/install.txt
Installation remaining to be done
=================================
Vle environment
---------------
- :ref:`devel_deployment_install_vle` (several vle versions can be installed)
- :ref:`devel_deployment_install_vle_repositories`
Simulators HTML home pages
--------------------------
.. literalinclude:: ../../../../erecord/install/prod/install_vpz_html_home_pages.txt
.. _devel_deployment_install_erecord_devcase:
=======================
Installation of erecord (development case)
=======================
.. literalinclude:: ../../../../erecord/install/dev/install.txt
*******************************************************************************
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 to /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/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
====================
Static files creation (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 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
===
django INIT
-----------
# 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 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
python manage.py createsuperuser
=> admin (erecordadmin)
python manage.py collectstatic
python manage.py runserver
django 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
python manage.py migrate
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/install_vle.txt
- To generate/use simulators HTML home pages : modify
/opt/erecord/erecord/docs/vpzpages/build_vpzpages.py (127.0.0.1 address)
and see /opt/erecord/erecord/install/install_vpz_html_home_pages.txt
*******************************************************************************
......@@ -4,15 +4,32 @@
*******************************************************************************
Case of development under ubuntu
================================
General
=======
see /opt/erecord/erecord/install/ubuntu/install.txt
The erecord project software is developed with :
Case of production under debian
===============================
- python language (python 2.7 version),
- django framework,
- some django applications, like for example django-rest-framework.
- SQLite for databases.
- Sphinx for documentation.
see /opt/erecord/erecord/install/debian/apache/install.txt
The stored models software have previously been developed with vle.
Install
=======
Case of development situation
-----------------------------
See /opt/erecord/erecord/install/dev/install.txt
Case of production situation
----------------------------
See /opt/erecord/erecord/install/prod/install.txt
*******************************************************************************
*******************************************************************************
Install erecord
Case of production under debian with apache http server
Versions : debian 9.5 (stretch), apache2.4
*******************************************************************************
"Rename" erecord path as /opt/erecord, if erecord is installed somewhere else
(ln -s 'erecord path' /opt/erecord).
================
Some basic tools
================
- sudo installation
apt-get install sudo
- python 2.7 installation
apt-get install python2.7
- pip installation
apt-get install python-pip
- virtualenv tool installation
pip install virtualenv
- Apache HTTP Server
- Apache2.4 installation
apt-get install apache2
- mod_wsgi installation
apt-get install libapache2-mod-wsgi
=======================
Miscellaneous libraries
=======================
libcurl installation
--------------------
Those libraries are needed by pycurl.
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev
===========================
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 erecord to /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
=====================
Python modules are installed in a 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 = True
- /opt/erecord/erecord/projects/ws/ws/settings.py file modifications :
DEBUG = False
- URLs :
Some URL values directly appear in source code (.py, .rst). They have to be
in conformity with the erecord_ws file and with the documentation
installation (see below) :
If needed, replace erecord.toulouse.inra.fr by the appropriate IP address :
- into /opt/erecord/docs/server/index.html
- into /opt/erecord/erecord/apps/erecord_cmn/configs/config.py
for ONLINEDOC_*
- into /opt/erecord/docs/source/devel/design/webapi/include/online_*.rst
Note : commands, if '127.0.0.1' had to be replaced by
'erecord.toulouse.inra.fr' into online_*.rst files :
cd /opt/erecord/docs/source/devel/design/webapi/include ;
sed -i 's/127.0.0.1/erecord.toulouse.inra.fr/g' online_url*.rst ;
====================
erecord static files
====================
Static files creation (css, js, images) :
- Activate erecordenv virtualenv (if not yet done) :
source /opt/erecord/factory/install/erecordenv/bin/activate
or source /opt/erecord/factory/install/erecordenv/bin/activate.csh
- generate :
cd /opt/erecord/erecord/projects/ws
python manage.py collectstatic
==========================
erecord main documentation
==========================
- Main documentation generation :
- Activate erecordenv virtualenv (if not yet done) :
source /opt/erecord/factory/install/erecordenv/bin/activate
or source /opt/erecord/factory/install/erecordenv/bin/activate.csh
- generate :
cd /opt/erecord/docs
make clean
make cleanref
make ref
make html
Note : The resulting documentation is produced under /opt/erecord/factory/docs
- Main documentation installation :
- add server entry :
sudo cp /opt/erecord/docs/server/docs.html /opt/erecord/factory/docs/docs.html
sudo cp /opt/erecord/docs/server/index.html /opt/erecord/factory/docs/index.html
- save maybe existing /var/www/docs.html,index.html
- install under /var/www :
sudo ln -s /opt/erecord/factory/docs /var/www/erecord
sudo ln -s /var/www/erecord/docs.html /var/www/docs.html
sudo ln -s /var/www/erecord/index.html /var/www/index.html
====================
Apache configuration
====================
/etc/apache2/ports.conf file modifications
------------------------------------------
Modify the apache2 ports.conf file so that the Apache2 server listens to the
port 8000 dedicated to the erecord_ws site
(see /opt/erecord/erecord/projects/ws/ws/erecord_ws file) and the port 80
dedicated to the online documentation :
Listen 8000
Listen 80
...
<IfModule ssl_module>
Listen 443
</IfModule>
erecord_ws file modifications
-----------------------------
Give/control into the erecord_ws file the appropriate values (ServerName,
erecord paths), then install it in the appropriate location :
- get the appropriate version of erecord_ws file :
cp /opt/erecord/erecord/projects/ws/ws/debian/apache2.4/erecord_ws /opt/erecord/erecord/projects/ws/ws/erecord_ws
- /opt/erecord/erecord/projects/ws/ws/erecord_ws file modifications :
ServerName : if needed, replace erecord.toulouse.inra.fr by the appropriate IP address
erecord paths : /opt/erecord/...
- install erecord_ws file :
sudo cp /opt/erecord/erecord/projects/ws/ws/erecord_ws /etc/apache2/sites-available/erecord_ws.conf
===
Run
===
- Apache2 user as owner :
sudo chown -R www-data:www-data /opt
sudo chown -R www-data:www-data /var/www
- Activate erecord_ws site :
sudo a2ensite erecord_ws.conf
- Apache run :
sudo systemctl reload apache2
(or sudo service apache2 reload)
=====
Notes
=====
- apache error log file : /log/apache2/error.log
- erecord online at :
- erecord web site : http://erecord.toulouse.inra.fr .
- erecord web services : http://erecord.toulouse.inra.fr:8000 .
- Installation remaining to be done :
- vle environment (several vle versions, models repositories, models,
simulators) : see /opt/erecord/erecord/install/install_vle.txt
- simulators HTML home pages : see
/opt/erecord/erecord/install/install_vpz_html_home_pages.txt
*******************************************************************************
*******************************************************************************
Install Simulators HTML home pages
*******************************************************************************
"Rename" erecord path as /opt/erecord, if erecord is installed somewhere else
(ln -s 'erecord path' /opt/erecord).
Careful : To be able to generate the simulators HTML home pages (and then
install them on the production machine), the erecord web services have to
already run on the production machine.
- Simulators home pages generation :
Careful : This generation must be done from another machine than the
production one (where erecord webservices run and where the generated html
home pages will then be installed).
On this other machine :
- Activate erecordenv virtualenv (if not yet done) :
source /opt/erecord/factory/install/erecordenv/bin/activate
or source /opt/erecord/factory/install/erecordenv/bin/activate.csh
cd /opt/erecord/docs
- generate a token for a user (username, password) who is authorized for
every simulator in limited access :
make username=... password=... token_value
- generate pages :
make cleanvpzpages
make genvpzpages
The resulting documentation is produced under folder
/opt/erecord/factory/docs/vpzpages (gen and private).
- Simulators home pages installation under /var/www of the production machine :
- get the generated /opt/erecord/factory/docs/vpzpages/gen folder :
copy it from the machine where it has been generated to the
production machine.
- remove maybe existing previous generated /var/www/docs/vpzpages/gen :
rm -fr /var/www/docs/vpzpages/gen
- install under /var/www :
sudo mv /opt/erecord/factory/docs/vpzpages/gen /var/www/docs/vpzpages/gen
*******************************************************************************
*******************************************************************************
Run erecord
*******************************************************************************
Case of development under ubuntu
================================
"RENAME" erecord path as /opt/erecord, for example :
ln -s /home/nrousse/workspace_git/DEVELOPPEMENT_WEB/recordweb/vle-x/trunk/erecord /opt/erecord
erecordenv activation
---------------------
#source /opt/erecord/factory/install/erecordenv/bin/activate.csh
source /opt/erecord/factory/install/erecordenv/bin/activate ; which python
django INIT
-----------
cd /opt/erecord/erecord/projects/ws
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
python manage.py createsuperuser
=> admin (erecordadmin)
python manage.py collectstatic
python manage.py runserver
django
------
cd /opt/erecord/erecord/projects/ws
python manage.py migrate
python manage.py runserver
*******************************************************************************
*******************************************************************************
erecord installation
Case of development under ubuntu
*******************************************************************************
"RENAME" erecord path as /opt/erecord, for example :