Changes between Version 1 and Version 2 of InstallingEventViewer


Ignore:
Timestamp:
11/10/18 21:45:34 (6 years ago)
Author:
tbretz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • InstallingEventViewer

    v1 v2  
    11The [https://www.fact-project.org/viewer/ Event Viewer] is a tool which allows to display raw data and manipulate raw data from a web browser. It is ideal to develop new algorithms without recompiling any code or writing a new framework. The disadvantage is that it is quite tedious to install. Here are some instructions.
    22
    3 First, you need to checkou FACT++:
     3== Requirements ==
     4
     5== PHP ==
     6
     7You need php installed. Otherwise, you will not be able to run the event viewer. In Ubuntu this is the package `php`.
     8
     9== Getting FACT++ ==
     10
     11First, you need to checkout FACT++ to get the tool `getevent`:
    412
    513{{{
     
    715}}}
    816
    9 Instructions how to compile FACT++ can be found here: InstallingFACT++. Compiling it with the TOOLS_ONLY option is enough.
     17Instructions how to compile FACT++ can be found here: InstallingFACT++. Compiling it with the TOOLS_ONLY option is enough. The web source code of the viewer is located now in FACT++/www/viewer.
    1018
    11 Now, you need to make sure that a web-server is installed, PHP is installed and the corresponding web-server configuration is set. For Ubuntu that means installing `apache2`, `php` and `libapache2.mod-php`.
     19== V8 ==
     20
     21To run the viewer, you need the V8 JavaScript engine installed. To be moe precise, you need the libraries and the development package (headers). A version of at least 5.6 is required. As most recent distributions ship with an older version. Tif you system uses apt (e.g. Ubuntu) you can check with
     22
     23{{{
     24[1] apt list | grep libv8
     25
     26libv8-3.14-dbg/xenial 3.14.5.8-5ubuntu2 amd64
     27libv8-3.14-dev/xenial 3.14.5.8-5ubuntu2 amd64
     28libv8-3.14.5/xenial,now 3.14.5.8-5ubuntu2 amd64 [installed,automatic]
     29libv8-6.4/xenial 6.4.388.18-ppa1~xenial amd64
     30libv8-6.4-dbg/xenial 6.4.388.18-ppa1~xenial amd64
     31libv8-6.4-dev/xenial 6.4.388.18-ppa1~xenial amd64
     32libv8-6.5/xenial 6.5.144-ppa1~xenial amd64
     33libv8-6.5-dbg/xenial 6.5.144-ppa1~xenial amd64
     34libv8-6.5-dev/xenial 6.5.144-ppa1~xenial amd64
     35libv8-6.6/xenial,now 6.6.313-ppa1~xenial amd64 [installed]
     36libv8-6.6-dbg/xenial 6.6.313-ppa1~xenial amd64
     37libv8-6.6-dev/xenial,now 6.6.313-ppa1~xenial amd64 [installed]
     38libv8-dev/xenial,now 3.14.5.8-5ubuntu2 amd64 [installed]
     39}}}
     40
     41To install a newer version, you can either compile your own version (https://v8.dev/) or install some community maintained package. Here is an example:
     42 
     43{{{
     44[2] sudo add-apt-repository ppa:pinepain/libv8
     45[3] sudo apt-get update
     46[4] sudo apt install v8-6.6 v8-6.6-dev
     47}}}
     48
     49This will install the headers and libraries into `/opt/libv8-6.6`.
     50
     51== V8Js ==
     52
     53Now you need the module which enables php to run V8Js (https://github.com/phpv8/v8js). Detailed installation instruction can be found in the README*.md files (Linux instructions: https://github.com/phpv8/v8js/blob/php7/README.Linux.md).
     54
     55If you have root rights, the easiest is to use pecl to install V8Js:
     56
     57{{{
     58[5] sudo pecl install v8js
     59}}}
     60
     61It will ask you for the installation directory of v8. In this example it is /opt/libv8-6.6.
     62
     63Without root rights, the best is to do it also through pecl but locally:
     64{{{
     65[5] pecl bundle v8js
     66[6] cd v8js
     67[7] phpize
     68[8] ./configure --with-v8js=/opt/libv8-6.6
     69[9] make
     70}}}
     71
     72You should now have a file `modules/v8js.so` in the v8js directory.
     73
     74== Local web-server ==
     75
     76You can use a system web-server (apache2), but it might be difficult to configure. Some instruction will follow at the end of this document.
     77
     78The easiest is to run a local web-server in user space. Fortunately, php comes with its own web-server exactly for this purpose. Its manual is available here http://php.net/manual/en/features.commandline.webserver.php.
     79
     80
     81Start it in the veiwer directory with
     82{{{
     83[10] cd FACT++/viewer
     84[11] php -S localhost:5000
     85}}}
     86
     87The viewer should now be accessible in your browser as `http://localhost:5000/index.html`.
     88
     89If you get an error that V8Js is not properly installed, you might need to create a file `php.ini` with the following contents
     90{{{
     91extenstion=v8js.so
     92}}}
     93
     94If that does not work, you might have to use an relative or absolute path to `v8js.so`.
     95
     96Start your web-server now with
     97{{{
     98[10] cd FACT++/viewer
     99[11] php -S localhost:5000 -c php.ini
     100}}}
     101
     102Now your viewer should load without an error.
     103
     104== Apache/2 ==
     105
     106If you want to use a global web-server, you can install `apache2`, `php` and `libapache2.mod-php`.
    12107
    13108Usually, the default directory for user web-content is /home/user/public_html. When you think you have identified where you can put web-contents,  I suggest to test if everything works properly.
     
    38133}}}
    39134
    40 The next challenge is to get V8Js running, the V8 interface for PHP. You can use `pecl` to install it:
    41 
    42 {{{
    43 [1] sudo pecl install v8js
    44 }}}
    45 
    46 You will see some downloads and how pecl tries to configure the compilation. As V8Js requires a quite recent V8 library and current systems still come with a rather old one, you might see an error like this:
    47 
    48 {{{
    49 checking for libv8_libplatform... configure: error: could not find libv8_libplatform library
    50 ERROR: `/tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --with-v8js' failed
    51 }}}
    52 
    53 if this is the case, you need to install a recent version of V8. In case of Ubuntu (>=16.04), you can do that with
    54 
    55 {{{
    56 [2] sudo add-apt-repository ppa:pinepain/libv8
    57 [3] sudo apt-get update
    58 [4] sudo apt install v8-6.6 v8-6.6-dev
    59 }}}
    60 
    61 You need to install the libraries and the developer files. Now you can run ![1] again providing the correct installation path (in the case of the PPA, this is /opt/libv8-6.6) and everything should run through.
    62 
    63135Then you have to configure apache to use the new extension by adding `extension=v8js.so` to your `php.ini` (in Ubuntu it is found at /etc/php/7.0/apache2/php.ini).
    64136
     
    67139[5] sudo service apache2 reload
    68140}}}
    69 
    70 I sugget to like the viewer directory in your public_html directory, e.g.
    71 {{{
    72 [6] cd ~/public_html
    73 [7] ln -s [your-FACT++-directory]/www/viewer
    74 }}}
    75 
    76 You should now be able to access the viewer from your web-browser as `http://localhost/~user/viewer/`. Ideally without getting an error (except that no files could be found)
    77 
    78 If that goes well, as a last step, you have to change the path to the FACT++ tool `getevent` and the paths to your data. As you will most likely only want to display raw data (Monte Carlo data and calibrated data needs special preparation), just add the path to your raw data three times.
    79 
    80 
    81 
    82 
    83 
    84 
    85