Marvin Live install guide

    Marvin Live is a NodeJS based application for molecule design and idea management. It includes an HTTP and WebSocket server to serve multiple clients running the embedded web application.

    Installation is only required for the server, clients access the web server through the configured host and port.

    Server requirements

    Client requirements

    • Latest Chrome, Firefox 31 or newer, Opera 15 or newer, IE 11 or newer, Safari 10 or newer

    Installing NodeJS

    You need NodeJS 10.12.0 or newer v10 LTS version to run Marvin Live. Download the installer from https://nodejs.org/ and follow the installation wizard. Linux users may install from their mainline repositories if available, or use NodeSource’s fantastic install scripts. To verify a successful installation, open the terminal and type:

    
    user:~$ node -v
    v10.12.0

    NodeJS installs its package manager as well, called npm. To verify it’s been installed:

    
    user:~$ npm -v
    6.4.1 

    {info} Note 1: if node or npm command are unrecognized, it’s missing from the environmental variables. On Windows, closing and opening the command prompt or restarting the server may help.

    Note 2: on Ubuntu servers, if you install NodeJS from the mainline repository, the node executable may be called nodejs.

    Prerequisites on RedHat / CentOS 6.x releases

    From version v16.11.7, RedHat / CentOS 6.x releases with glibc 2.14 or older require additional steps before a successful installation.

    
    # confirm affected libc version
    bash-4.1# ldd --version
    ldd (GNU libc) 2.12
     
    # install software collections, devtools and enable it
    bash-4.1# yum install centos-release-scl scl-utils
    bash-4.1# yum install devtoolset-3-gcc devtoolset-3-gcc-c++
    bash-4.1# scl enable devtoolset-3 bash

    Installing Marvin Live - network installer

    Now you need to point npm to the ChemAxon download site, and login. The instructions on the download page provide you with the API key used to access the repository. This is required the first time only.

    
    user:~$ curl -o ~/.npmrc -u<email address>:<api key> https://hub.chemaxon.com/artifactory/api/npm/auth
    user:~$ npm config set registry https://hub.chemaxon.com/artifactory/api/npm/npm

    You may set your proxy configuration if needed, these settings will be used for outgoing HTTP requests that download Marvin Live and its components. Usage is described in the npm docs.

    
    user:~$ npm set http_proxy ...
    user:~$ npm set https_proxy ...

    Choose an application directory where you want to install the application, to store configuration files and persistent storage. Once there, you can install the application with:

    
    user:~$ mkdir app
    user:~$ cd app/
    user:~/app$ npm install marvin-live

    This will download and install the latest version of the application in the app directory. You can find the full list of recently added features and changes in the History of changes document.

    {info} Note: at this point on Windows 8 and Windows Server 2008 and Windows Server 2012, you may get this error: Error: ENOENT, stat 'C:\Users\User\AppData\Roaming\npm'. This error message is about a missing folder. You can resolve this issue by creating the quoted folder or starting the command prompt as administrator.

    You can upgrade Marvin Live with the install command, which will fetch the latest version. To install a specific version (not recommended), append its version number to the package name with the following syntax: marvin-live@18.25.0Upgrading to a new version

    
    user:~/app$ npm install marvin-live

    This will replace the existing Marvin Live installation folder, but leave any configuration, persistence intact.

    Installing Marvin Live - offline bundle

    With the offline installer bundle, you can warm the cache with all required dependencies that would be otherwise fetched from the (external) NPM repository.

    
    user:~/app$ ./addcache.sh
    ...
    user:~/app$ npm install /data/npm/marvin-live-18.25.0-offline.tgz

    This will install the latest version of the application in the app directory. You can find the full list of recently added features and changes in the History of changes document.

    {info} Note: at this point on Windows 8 and Windows Server 2008 and Windows Server 2012, you might get this error: Error: ENOENT, stat 'C:\Users\User\AppData\Roaming\npm'. This error message is about a missing folder. You can resolve this issue by creating the quoted folder or starting the command prompt as administrator.

    You can upgrade Marvin Live by re-running the above command and a new offline installer package.

    Upgrading to a new version

    
    user:~/app$ npm install /data/npm/marvin-live-18.25.0-offline.tgz

    This will replace the existing Marvin Live installation folder, but leave any configuration, persistence intact.

    Configuration

    This application requires a configuration file to be passed as a command line argument. The configuration file holds all the key settings regarding networking, security, persistence, plugins and more. A sample file with defaults is provided within the application: ~/app/node_modules/marvin-live/config-sample.json.

    Please copy this to your application directory, and rename it to your preference. Do not modify this file in place, and do not store your settings within the node_modulesdirectory, because it is automatically removed / replaced on upgrade !

    
    user:~/app$ cp node_modules/marvin-live/config-sample.json \
    ./config.json

    {info} Note: on Windows, make sure you save the json file with ANSI encoding when editing with a text editor such as Notepad.

    The minimum configuration requires port and license attributes to be specified, but a more general sample of the options is below. Note that some values point to files or other services. These should be changed to match your environment - of course you can store your ChemAxon license files or Marvin Live plugins anywhere. See below in the spreadsheet for your full list of options:

    
    {
     "converterService": "http://localhost:8080/webservices/",
     "servicesDirectory": "../services/",
     "port": 8888,
     "license": ["./marvin4js-license.cxl", "./mlive-license.cxl"],
     "secretKey": "CHANGETHIS",
     "authentication": {
       "internal": {
         "type": "local",
         "label": "Testing domain",
         "accounts": [{
           "username": "demo",
           "password": "demo"
         }]
       }
      },
      "snapshotFields": [{
        "name": "task",
        "label": "Task"
      }, {
        "name": "status",
        "label": "Status",
        "values": ["Not ready for review", "Ready for review", "Approved", "On hold", "Synthesized", "Cancelled"]
      }]
    }

    In the Configuration Guide you can find a detailed description for options and further customization instructions.

    Starting Marvin Live

    Once a basic config file is available, you can start the server in foreground mode with:

    
    user:~/app$ node node_modules/marvin-live/ -c config.json

    When the application is ready to use, it prints Listening on http://localhost:8888/.

    To stop a running instance, simply press Ctrl+C.

    Given the IP or hostname of your server and the port set in the configuration, you may now distribute the web interface link to the users of the application.

    Setting up a service

    To run Marvin Live as a daemon/service, you could create configurations in supervisord/supervisorctl, use an init script or a systemd script. Below you can find an example for both: /etc/supervisor/conf.d/marvinlive.conf

    
    [program:marvinlive]
    command=/usr/bin/node /home/user/app/node_modules/marvin-live/ -c /home/user/app/config.json
    autostart=true  
    autorestart=true  
    stderr_logfile=/var/log/marvinlive.err.log  
    stdout_logfile=/var/log/marvinlive.out.log  
    user=user

    /etc/init.d/marvin-live

    
    #!/bin/bash
     
    # /etc/init.d/marvin-live -- startup script for the Marvin Live
     
    ################ BEGIN RED HAT init info #######################
    # Provides:          marvin-live
    # Required-Start:    $local_fs $remote_fs $network
    # Required-Stop:     $local_fs $remote_fs $network
    # Should-Start:      $named
    # Should-Stop:       $named
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Start Marvin Live.
    # Description:       Start the Marvin Live nodejs application and frontend.
    #
    ################ END RED HAT init info #######################
     
    ################## BEGIN Debian/Ubuntu init info ##################
    # Provides:          marvin-live
    # Required-Start:    $remote_fs $named $syslog
    # Required-Stop:     $remote_fs $named $syslog
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Debian initscript for marvin-live
    # Description:       Start the Marvin Live nodejs application and frontend.
    #
    ################## END Debian/Ubuntu init info ##################
    name="Marvin Live"
    nodejs_bin="/usr/bin/nodejs"
    dir_home="/home/user/app/"
    app_home="$dir_home/marvin-live"
    file_log="$dir_home/log/marvin-live.log"
    dir_tmp="$dir_home/tmp"
    user=user
    date=$(date "+%Y-%m-%d %H:%M:%S")
     
    f_get_pid(){
     if pid=$(pgrep -f /node_modules/marvin-live);
      then
       echo "PID: $pid"
      else
       echo "$name is not running"
     fi
    }
     
    case $1 in
     start)
      echo "Starting $name"
      su -s /bin/bash $user -c "echo $date -- Starting $name" >> $file_log
      su -s /bin/bash $user -c "$nodejs_bin $app_home/node_modules/marvin-live/ -c $app_home/config.json >>$file_log 2>&1 &"
      f_get_pid
     ;;
     
     stop)
      echo "Stopping $name"
      f_get_pid
      kill $pid
      su - $user -c "echo $date -- Stopping $name >> $file_log"
     ;;
     
     restart)
      $0 stop
      sleep 2
      $0 start
     ;;
     
     status)
      f_get_pid
     ;;
     
     *)
      echo "Usage: $0 {start|stop|restart|status}"
      exit 1
    esac

    /lib/systemd/system/marvinlive.service

    
    [Unit]
    Description=Marvin Live
    Wants=network-online.target
    After=network-online.target
     
    [Service]
    User=marvinlive
    Group=marvinlive
    Type=simple
    ExecStart=/usr/bin/node /home/marvinlive/app/node_modules/marvin-live/ -c /home/marvinlive/app/config.json
     
    [Install]
    WantedBy=multi-user.target

    Marvin Live behind a proxy

    Marvin Live uses a persistent websocket connection between each client and the server for messaging. If you deploy the application behind a proxy, you need to make sure the proxy doesn't interfere with websockets. In case of nginx, you should review the websocket module’s configuration options.