Kitware / paraviewweb

Web framework for building interactive visualization relying on VTK or ParaView to produce visualization data
http://kitware.github.io/paraviewweb/
BSD 3-Clause "New" or "Revised" License
163 stars 51 forks source link

Set up as multi-user in Paraview #225

Closed chris2009 closed 7 years ago

chris2009 commented 8 years ago

Hi my friends! I have been working with ParaviewWeb very well but when I have tried to set up the Multi-User mode but I really don't now how I have to set up the file :

*<VirtualHost :80> ServerName ServerAdmin webmaster@example-host.example.com DocumentRoot "" ErrorLog "logs/pv-error_log" CustomLog "logs/pv-access_log" common

# Have Apache pass these requests to the launcher
ProxyPass /paraview http://localhost:9000/paraview

# Turn on the rewrite engine
RewriteEngine On

# This is the path the mapping file Jetty creates
RewriteMap session-to-port txt:<MAPPING-FILE-DIR/proxy.txt

# This is the rewrite condition. Look for anything with a sessionId= in the query part of the URL and capture the value to use below.
RewriteCond %{QUERY_STRING}     ^sessionId=(.*)$ [NC]

# This does the rewrite using the mapping file and the sessionId
RewriteRule    ^/proxy.*$  ws://${session-to-port:%1}/ws  [P]

<Directory "<MY-DOCUMENT-ROOT">
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
    AllowOverride None
    Require all granted
</Directory>

**

May you help me How Do I have to put in the parts:

Thanks very much.

scottwittenburg commented 8 years ago

If you have a public dns name (or even a hostname for your machine on your local network), you should use that for the ServerName. You should set the DocumentRoot to be the directory where the web content you plan to host is located.

Additionally, you should replace strings like <MAPPING-FILE-DIR> or <MY-DOCUMENT-ROOT> with appropriate values for your system.

The documentation on multi-user setup is included not so much as a feature of the project, but rather as an example of how you may choose to manage multiple users, where there could be many other options. You can find more documentation on Apache virtual hosts here:

http://httpd.apache.org/docs/current/vhosts/

chris2009 commented 8 years ago

Hi! scottwittenburg, thank you for your response.

I did some changes in the document but I have problems, yet. My file 001-pvw.conf is likes this:

<VirtualHost 127.0.1.1:80> ServerName 127.0.1.1 ServerAdmin webmaster@example-host.example.com DocumentRoot "/home/christian/Escritorio/Proyecto/build/www" ErrorLog "logs/pv-error_log" CustomLog "logs/pv-access_log" common

# Have Apache pass these requests to the launcher
ProxyPass /paraview http://localhost:8080/apps/Visualizer

# Turn on the rewrite engine
RewriteEngine On

# This is the path the mapping file Jetty creates
RewriteMap session-to-port txt:/home/christian/Escritorio/apache/config/proxy.txt

# This is the rewrite condition. Look for anything with a sessionId= in the query part of the URL and capture the value to use below.
RewriteCond %{QUERY_STRING}     ^sessionId=(.*)$ [NC]

# This does the rewrite using the mapping file and the sessionId
RewriteRule    ^/proxy.*$  ws://${session-to-port:%1}/ws  [P]

<Directory "/home/christian/Escritorio/Proyecto/build/www">
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
    AllowOverride None
    Require all granted
</Directory>

` And when I follow the next step:

$ sudo a2ensite 001-pvw.conf $ sudo service apache2 restart

I get the next message:

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

And then I put this for more details: systemctl status apache2.service, and I get this: sep 07 15:15:36 christian-All-Series systemd[1]: Failed to start LSB: Apache2 web server.

I think couls be a problem of set up the file 001-pvw.conf, yet.

scottwittenburg commented 8 years ago

Not sure what the issue is. I noticed a couple potential issues with your apache virtual host configuration though:

1) Is your local host ip really 127.0.1.1? Perhaps you could try replacing that with localhost?

2) The ProxyPass line should not be pointed at a visualization instance, but rather at the launcher, as the launcher is what should run the visualization processes. So it should be pointing at the host/port where you are running the launcher, and it should end in /paraview, not /apps/Visualizer. See the following for information on the launcher:

http://kitware.github.io/paraviewweb/docs/guides/launcher_api.html http://kitware.github.io/paraviewweb/docs/guides/python_launcher.html http://kitware.github.io/paraviewweb/docs/guides/launching_examples.html

One take-away from that third link is that you must configure your apache virtual host and your launcher in such a way that they are compatible. E.g. in the launcher config, you state what interface, host, port the launcher should listen on, and then in the virtual host config, the ProxyPass to launcher (/paraview) needs to match.

Hope this helps.

chris2009 commented 8 years ago

Thank you for your advices Scottwittenburg but I continue having problems as I said in the before comment. I have a question How should content the file proxy.txt?

scottwittenburg commented 8 years ago

You will not add any content to that file yourself. However, it must exist and be readable and writable by both the launcher process and the apache process. The launcher will write lines into it which map session ids to the appropriate ports where it has started those processes running. Then apache needs to be able to read it so when it receives a websocket request like:

ws://127.0.1.1/proxy?sessionId=1deeadf0-fa0e-1126-a850-3c07547598ec

it knows where to send that. If you need information on how to arrange permissions so that is true, the link below may help. It is just another page within those guides I linked above.

http://kitware.github.io/paraviewweb/docs/guides/apache_front_end.html#Create-a-proxy-mapping-file

I think if that file does not exist with the correct permissions when you start apache, that could cause it to fail.

chris2009 commented 8 years ago

You were rigth Scottwittenburg, I hadn't the correct permissions when I started apache. I continued with the steps and in the set up of Python as Launcher, I wrote the following command:

My question is: Where should be located the file launcher.config? I PUTTED THIS FILE IN /home/christian/Escritorio/Proyecto/ParaView/VTK/Web/Python/vtk/web TOGETHER WITH THE FILE launcher.py

My file launcher.config is this:

`

===============================

General launcher configuration

===============================

"configuration": { "host" : "localhost", # name of network interface to bind for launcher webserver "port" : 8080, # port to bind for launcher webserver "endpoint": "paraview", # SessionManager Endpoint "content": "/.../www", # Optional: Directory shared over HTTP "proxy_file" : "/home/christian/Escritorio/mappingfile/proxy.txt", # Proxy-Mapping file for Apache "sessionURL" : "ws://${host}:${port}/ws", # ws url used by the client to connect to started process "timeout" : 5, # Wait time in second after process start "log_dir" : "/.../viz-logs", # Directory for log files "upload_dir" : "/.../uploadDirectory", # Start file upload server on same port as launcher "fields" : ["file", "host", "port", "updir"] # Fields not listed are filtered from response },

===============================

Resources list for applications

===============================

"resources" : [ { "host" : "localhost", "port_range" : [9001, 9003] } ],

===============================

Set of properties for cmd line

===============================

"properties" : { "build_dir" : "/.../build", "python_exec" : "/.../build/bin/vtkpython", "WWW" : "/.../build/www", "source_dir": "/.../src" },

===============================

Application list with cmd line

===============================

"apps": { "pipeline": { "cmd": [ "${python_exec}", "-dr", "${python_path}/paraview/web/pv_web_visualizer.py", "--port", "${port}", "--data-dir", "${dataDir}", "-f", "--authKey", "${secret}" ], "ready_line" : "Starting factory" }, "visualizer": { "cmd": [ "${python_exec}", "-dr", "${python_path}/paraview/web/pv_web_visualizer.py", "--port", "${port}", "--data-dir", "${dataDir}", "-f", "--authKey", "${secret}" ], "ready_line" : "Starting factory" }, "loader": { "cmd": [ "${python_exec}", "-dr", "${python_path}/paraview/web/pv_web_file_loader.py", "--port", "${port}", "--data-dir", "${dataDir}", "-f", "--authKey", "${secret}" ], "ready_line" : "Starting factory" }, "data_prober": { "cmd": [ "${python_exec}", "-dr", "${python_path}/paraview/web/pv_web_data_prober.py", "--port", "${port}", "--data-dir", "${dataDir}", "-f", "--authKey", "${secret}" ], "ready_line" : "Starting factory" } } }`

THank you for your time.