Packaging & installation of niViz
niViz has been created as a very flexible visualization / edition tool that should cater to all the usage scenarios of the Snowpack community. Therefore, it is currently possible to address the following scenarios:
- visualization / edition of snow profiles "on the go";
- visualization / edition of snow profiles integrated within an operational system;
- visualization / edition of snow profiles as a service, ie without requiring any software installation on the client's computer.
For the point (1), it is necessary to provide a package. The necessary steps to create a package are given in the section below. For the points (2) and (3), niViz must be installed in a server. The necessary steps are given in the last section.
Creating a package
Although there is no need to package or even install niViz for the end user, it is necessary to properly package it when starting from the sources in order to be able to distribute it (specially for offline use) or make it available on a server as a service. The necessary steps are described in this section.
The following software must be installed on the computer where the packaging will be performed:
- the git distributed version control system;
It is highly recommended to install node.js from source in order to get a recent enough version (it currently works well with the latest version 0.12.0).
First, check out (or clone, in the git terminology) the latest version of niViz from the repository (please keep in mind that you need to provide your ssh public key to the forge and allow for up to 10 minutes for your key to be updated on the forge before doing a checkout). Then, follow the steps listed below, at the root of your checkout:
- make dep, this will download (using npm) all the required dependencies;
- make dist, this will package everything into the dist directory
- enter the dist directory, it contains a subdirectory and an index.html file. Opening this file in a browser starts niViz.
- in order to install niViz locally on a computer, simply copy this dist directory (or directly its content) on the computer.
This covers two kind of installations: on a personal computer for potentially offline use and on a server.
This makes it possible to use niViz without any Internet connection. The easiest way to install it would be from a package, but a git checkout would work the same (after properly packaging niViz as outline above). Then copy the dist directory on the target computer (you can rename it to something more meaningful) and start niViz by opening dist/index.html in a web browser. It can be a good idea to add a direct link to this index.html directly either in the bookmarks or in the start menu.
After installing your web server of choice (for example Apache), copy the dist directory of niViz in one of the directories that is served by the web server. The easiest would be to copy it directly in the server root directory, but this depends on what other content is served by this machine. Rename the dist directory into something more meaningful (for example niViz) and make sure the ownership and permissions are right (most probably, it would need to belong to www-data). Make sure the web server is running, and open in a browser the URL for this installation, for example http://my_server.com/niViz.
If this server should serve operational content, then copy or link to the operational simulations' output directory. For example, if Snowpack runs on the same server, create a link in your server root pointing to the output directory of snowpack (in this example, we will name this link current). Now point your web browser to http://my_server.com/index.html?file=current/WFJ2.pro and this should automatically open the operational WFJ2 simulation in niViz. Make sure the permissions and ownerships are right and check in the web server's logs if something does not work (most probably a path has not been properly set, a path is not accessible to the web server or the web server has been configured not to follow links). Finally, consider creating a web page that would contains such links for all your operational simulations so the users can simply open this web page, click on the link to the simulation they want and get directly the visualization in their browser. A script that does this automatically and that can be run as a cron job is available in the snowpack-operational toolchain.