|
1 | | -Deploy the GUI |
2 | | -============== |
| 1 | +Deploy the GUI in web mode |
| 2 | +========================== |
3 | 3 |
|
4 | | -TODO: |
| 4 | +The :ref:`launching` section showed how you can launch the GUI on a local workstation. |
5 | 5 |
|
6 | | -local, central server, cloud |
| 6 | +To recap, you can launch the GUI in web mode by running: |
| 7 | + |
| 8 | +.. code-block:: bash |
| 9 | +
|
| 10 | + sigui --mode=web /path/for/my/sorting_analyzer |
| 11 | +
|
| 12 | +which will start a server on your localhost: |
| 13 | + |
| 14 | +.. code-block:: bash |
| 15 | +
|
| 16 | + Launching server at http://localhost:43957 |
| 17 | +
|
| 18 | +
|
| 19 | +However, the GUI can also be deployed on a remote server, and accessed through a web |
| 20 | +browser or directly in the cloud, thanks to its web mode. |
| 21 | + |
| 22 | +Deploying on a remote lab server |
| 23 | +-------------------------------- |
| 24 | + |
| 25 | +If you want to deploy the GUI on a remote lab server, the GUI can be used by multiple users |
| 26 | +with VPN access to the server. |
| 27 | + |
| 28 | +To setup the web GUI on a remote server, follow these steps: |
| 29 | + |
| 30 | +1. Choose a server machine in your lab network (e.g. "my-lab-server") that is accessible |
| 31 | + through VPN by all lab members. |
| 32 | + |
| 33 | +2. Install spikeinterface-gui and its dependencies on the server machine. |
| 34 | + |
| 35 | +3. Launch the GUI launcher on the server machine with the following command: |
| 36 | + |
| 37 | +.. code-block:: bash |
| 38 | +
|
| 39 | + sigui --mode=web --address=auto-ip |
| 40 | +
|
| 41 | +If all your analyzers will be in the same root folder (or in subfolders), you can also specify the ``--root-folder`` option: |
| 42 | + |
| 43 | +.. code-block:: bash |
| 44 | +
|
| 45 | + sigui --mode=web --address=auto-ip --root-folder=/path/to/my/analyzers |
| 46 | +
|
| 47 | +4. The server will start and display the IP address to access the GUI launcher, e.g.: |
| 48 | + |
| 49 | +.. code-block:: bash |
| 50 | +
|
| 51 | + Launching server at http://SERVER.IP.ADDRESS:43957/launcher |
| 52 | +
|
| 53 | +5. Share the displayed IP address with all lab members, so they can connect to the GUI launcher |
| 54 | + from their local machines. |
| 55 | + |
| 56 | + |
| 57 | +Deploying on cloud platforms |
| 58 | +---------------------------- |
| 59 | + |
| 60 | +The ``spikeinterface-gui`` web mode can also be deployed on cloud platforms such as AWS, GCP, or Azure. |
| 61 | + |
| 62 | +This type of deployment is recommended if all your raw and sorted data are already stored |
| 63 | +in the cloud. |
| 64 | + |
| 65 | +You will need a simple wrapper python script that ``Panel`` can serve. |
| 66 | + |
| 67 | +For example, create a file named ``si_launcher.py`` with the following content: |
| 68 | + |
| 69 | +.. code-block:: python |
| 70 | +
|
| 71 | + from spikeinterface_gui.launcher import Launcher |
| 72 | +
|
| 73 | + launcher = Launcher(backend="panel") |
| 74 | + launcher.layout.servable() |
| 75 | +
|
| 76 | +Then, you need a ``Dockerfile`` which installs the GUI and serves the panel app as entry point. |
| 77 | +Here is a minimal example of a ``Dockerfile``: |
| 78 | + |
| 79 | +.. code-block:: docker |
| 80 | +
|
| 81 | + FROM python:3.9-slim |
| 82 | +
|
| 83 | + RUN pip install spikeinterface-gui[web] |
| 84 | +
|
| 85 | + COPY si_launcher.py /si_launcher.py |
| 86 | +
|
| 87 | + EXPOSE 8000 |
| 88 | +
|
| 89 | + ENTRYPOINT ["sh", "-c", "panel serve /si_launcher.py --address 0.0.0.0 --port 8000 --allow-websocket-origin ${ALLOW_WEBSOCKET_ORIGIN} --keep-alive 10000 --warm"] |
| 90 | +
|
| 91 | +
|
| 92 | +You can then build and run the Docker image on your cloud platform of choice, making sure to set the |
| 93 | +``ALLOW_WEBSOCKET_ORIGIN`` environment variable to the domain name or IP address of your server. |
| 94 | + |
| 95 | +Note that you can also customize the launcher script to pre-load specific sorting analyzers or set a root folder. |
0 commit comments