Softwares

Delivery

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

                           Softwares delivery

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

General
=======

  A software is delivered as a container (Docker or Singularity).

  It is possible to also deliver some documentation for it.

Delivery content
================

* Software source code or where/how to get it.

* Container type :
  'docker' if software delivered as Docker image or
  'singularity' if software delivered as Singularity image.

* Information :

  - how_to_build (Docker or Singularity) image : build command

  - how_to_use the software : run command 

* Documentation (optional)

Commands of softwares delivery to ws web services
=================================================

* See full procedure at install folder :

  - install.txt

  - install_softwares.txt (containers images)

  - install_softwares_documentation.txt (documentation)

* IMG.txt :

  IMG.txt file contains commands to deliver/produce the softwares containers
  images : here is the IMG.txt for the sw_example software and into
  https://forgemia.inra.fr/nathalie.rousse/ws_deliv/DELIV, there is
  the IMG.txt for other softwares.

  Note : IMG.txt contains the commands to produce the Singularity image
  if type=singularity, the Docker image if type=docker.
  => If type=docker : see the following install step into
  install_softwares.txt (generating the Singularity image from the Docker one).

* DOC.txt :

  DOC.txt file contains commands to fill the DOC folder of each software :
  here is the DOC.txt for the sw_example software and into
  https://forgemia.inra.fr/nathalie.rousse/ws_deliv/DELIV, there is
  the DOC.txt for other softwares.

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

Installation

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

                           Install softwares

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

General
=======

  Software : Before to be able to be used by ws web services, a software has
  to previously be delivered and installed as required by ws.

  Documentation : There is on the ws server an online documentation for each
  software, that is at least a default documentation, and more if delivered.

Install software
================

  See install_softwares.txt

Install software documentation
==============================

  See install_softwares_documentation.txt

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

install_softwares.txt :

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

                           Install softwares

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

Description
===========

Softwares can be delivered with type=docker or with type=singularity.
Softwares are always run by Singularity.
Singularity image files associated with softwares must be installed on each
resource where their software is to be able to be run.

By calling SIMG_HOME the folder(s) where to install Singularity image files.

  - for ws machine :   SIMG_HOME=WSM_LOCAL_SIMG_HOME =/opt/ws_rsrc/wsm/simg
  - for muse cluster : SIMG_HOME=MUSE_LOCAL_SIMG_HOME=/opt/ws_rsrc/muse/simg 
    mount with muse machine, image files are physically on muse machine
  (more exactly, see conf/config.py for values)

Case of softwares delivered as Docker containers :

  In order to be able to run by Singularity a software that has been delivered
  with type=docker, a Singularity image file is going to be produced from its
  installed Docker image and also installed.  

  Production of Singularity containers from the Docker ones :

  - build_singularity_from_docker.sh (containing sudo commands) is a
    script file that builds, for each software of ws database with
    type=docker, its singularity image file from its docker image :
    {SIMG_HOME}/.{docker image name}.simg

  - generate_script_file is the method of
    /opt/ws/softwares/install/build_script_building_singularity_from_docker.py
    that generates the build_singularity_from_docker.sh file.
    This method is called by Action "Generate singularity from docker script
    file" of ws web services (see below).

Install softwares
=================

  The 3.5.3 Singularity version has been installed on development PC and on
  ws VM and is also available on muse machine.

  Concretely (a) the image files will be built for ws machine on
  development PC (where Docker...), (b) and then the resulting simg folder
  will be duplicated as required : copied to ws VM, muse machine.

  (a) Build details :

      With same value SIMG_HOME=WSM_LOCAL_SIMG_HOME (=/opt/ws_rsrc/wsm/simg)
      into /opt/ws_deliv/DELIV/IMG.txt an
      into install/build_script_building_singularity_from_docker.py

      1. Build original image of every software of the ws database
         (Singularity or Docker one, depending on software case) :

         See commands at /opt/ws_deliv/DELIV/IMG.txt

      2. Build all singularity image files from docker images :

         - Generate "build_singularity_from_docker.sh" file :

           Request GET admin of ws web services (as admin user)
           --> Into Softwares objects --> Select a Software (anyone), then
               Action "Generate singularity from docker script file"

         - Run "build_singularity_from_docker.sh" :
           /opt/ws/fab/install/build_singularity_from_docker.sh


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

install_softwares_documentation.txt :

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

                        Install softwares documentation

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

Description
===========

The folder dedicated to softwares online documentation is :
SOFTWARES_ONLINE_DOC=/var/www/html/softwares.

Under SOFTWARES_ONLINE_DOC, each software (named software_name into the ws
database) has its own subfolder (named software_name) dedicated to its
online documentation.

Production of a software default documentation :

  The method used to generate the default documentation for a software is :
  build_html_home_page of build_software_default_doc.py file under
  /opt/ws/softwares/doc/default_doc.
  This method is called by Action "Generate default doc" of ws web services
  (see 2. below).
  Notes :
  The ws web services (you want to call) must be running !
  Verify into build_software_default_doc.py the BASE_URL value according to
  the ws web services you want to call !

Install SOFTWARES_ONLINE_DOC folder
===================================

- Create SOFTWARES_ONLINE_DOC folder if it does not exist :
  mkdir /var/www/html/softwares

- Fill (or update) it :
  cp -fr /opt/ws/softwares/doc/online_home/* /var/www/html/softwares/.

To install one software documentation
=====================================

For a software named software_name into the ws database :

1. Generate software_name default documentation :

   Prerequisite : The ws web services must be running.

   Request GET admin of ws web services (as admin user)
   --> Into Softwares objects
       --> Select software_name, then Action "Generate default doc"

   That generates a default html home page for software_name :
   /opt/ws/fab/softwares/default_doc/{software_name}/sw_index.html

2. Create the folder dedicated to software_name documentation :

   mkdir /var/www/html/softwares/{software_name}

3. Fill folder SOFTWARES_ONLINE_DOC/{software_name} :

   a) If no documentation has been delivered for software_name :

      - Use the default html home page (generated at 2.) :
        cd /var/www/html/softwares/{software_name}
        ln -s /opt/ws/fab/softwares/default_doc/{software_name}/sw_index.html index.html

   b) If some documentation has been delivered for software_name :

      - Copy the relevant documentation files and folders under
        /var/www/html/softwares/{software_name}

      - Choose to expose or not (and how) the default html home page
        (generated at 2.), depending on delivery content.

Step '3.' concretely
====================

  To fill all the SOFTWARES_ONLINE_DOC/{software_name} folders : see
  commands at /opt/ws_deliv/DELIV/DOC.txt

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