<commit_before>.. _install-desktops-install-desktop-app:

Install Desktop App
===================

No we will go through installing the provided `bc_desktop`_ app as well as
configuring it work at your center.

#. We will build this app in our previous working directory:

   .. code-block:: sh

      cd ~/ood/src

#. We start by cloning and checking out the latest tag for the `bc_desktop`_
   app:

   .. code-block:: sh

      scl enable git19 -- git clone https://github.com/OSC/bc_desktop.git
      cd bc_desktop/
      scl enable git19 -- git checkout v0.1.1

#. We now must configure desktop apps for each cluster you want this to run
   under in the following directory ``local/``

   .. code-block:: sh

      # Make the `local/` directory if it doesn't already exist
      mkdir local

      # Change our working directory to `local/`
      cd local

#. For each cluster we want to launch desktop on we will need a corresponding
   YAML configuration file (e.g., ``cluster1.yml``, ``cluster2.yml``, ...) that
   looks like:

   .. code-block:: yaml

      # bc_desktop/local/cluster1.yml
      ---
      title: "Cluster1 Desktop"
      cluster: "cluster1"        # must correspond to a cluster config

   where the ``cluster`` attribute must match a valid cluster configuration
   file.

   .. danger::

      Please do not modify any of the code above the ``local/`` path as it may
      put the Git repo in a bad state.

      We recommend you version all the changes you make in the ``local/``
      directory you use for the `bc_desktop`_ app so that you don't lose any of
      it.

#. Install the Desktop App to its system location at ``/var/www/ood/apps/sys``
   with:

   .. code-block:: sh

      sudo rsync -rlptv --delete --quiet ~/ood/src/bc_desktop/ /var/www/ood/apps/sys/bc_desktop

#. Navigate to your OnDemand site, in particular the Dashboard App, and you
   should see in the top dropdown menu "Interactive Apps" => "Cluster1
   Desktop".

   After choosing "Cluster1 Desktop" from the menu, you should be presented
   with a form to submit a Desktop to the given cluster.

   Submit a desktop and wait for it to run. If you see a Desktop start Running
   but then quickly disappear you can debug it by viewing the logs in::

     ~/ondemand/data/sys/dashboard/batch_connect/sys/bc_desktop/<cluster>/output/<uuid>/

   where ``uuid`` is a randomly generated id for a single desktop session. You
   might want to find the latest one by looking at the timestamps.

   .. warning::

      The form may fail to submit due to the defaults we chose for a given
      resource manager: Torque, Slurm, LSF, PBS Pro... Please continue to the
      next section to learn how to customize batch job submission.

.. _bc_desktop: https://github.com/OSC/bc_desktop/<commit_msg>leverage new ood-apps-installer for install desktop<commit_after>.. _install-desktops-install-desktop-app:

Install Desktop App
===================

No we will go through installing the provided `bc_desktop`_ app as well as
configuring it work at your center.

#. We will build this app in our previous web applications setup directory
   (discussed in :ref:`install-apps`):

   .. code-block:: sh

      cd ~/ood/src/apps/

#. By default this app is not built and installed with all the other required
   OOD apps. You will need to build this app explicitly with:

   .. code-block:: sh

      scl enable rh-ruby22 nodejs010 git19 -- rake build:bc_desktop

   .. note::

      The Desktop App is an **optional** app and will not be built and
      installed when you call:

      .. code-block:: sh

         scl enable rh-ruby22 nodejs010 git19 -- rake
         sudo scl enable rh-ruby22 -- rake install

      Instead you need to explicitly build and install it to prevent you from
      installing an app that is not properly configured for your users:

      .. code-block:: sh

         scl enable rh-ruby22 nodejs010 git19 -- rake build:bc_desktop
         sudo scl enable rh-ruby22 -- rake install:bc_desktop

#. We now must configure desktop apps for each cluster you want this to run
   under in the following directory ``local/``

   .. code-block:: sh

      # Make the `local/` directory if it doesn't already exist
      mkdir local

      # Change our working directory to `local/`
      cd local

#. For each cluster we want to launch desktop on we will need a corresponding
   YAML configuration file (e.g., ``cluster1.yml``, ``cluster2.yml``, ...) that
   looks like:

   .. code-block:: yaml

      # bc_desktop/local/cluster1.yml
      ---
      title: "Cluster1 Desktop"
      cluster: "cluster1"        # must correspond to a cluster config

   where the ``cluster`` attribute must match a valid cluster configuration
   file.

   .. danger::

      Please do not modify any of the code above the ``local/`` path as it may
      put the Git repo in a bad state.

      We recommend you version all the changes you make in the ``local/``
      directory you use for the `bc_desktop`_ app so that you don't lose any of
      it.

#. Install the Desktop App to its system location at ``/var/www/ood/apps/sys``
   with:

   .. code-block:: sh

      sudo scl enable rh-ruby22 -- rake install:bc_desktop

#. Navigate to your OnDemand site, in particular the Dashboard App, and you
   should see in the top dropdown menu "Interactive Apps" => "Cluster1
   Desktop".

   After choosing "Cluster1 Desktop" from the menu, you should be presented
   with a form to submit a Desktop to the given cluster.

   Submit a desktop and wait for it to run. If you see a Desktop start Running
   but then quickly disappear you can debug it by viewing the logs in::

     ~/ondemand/data/sys/dashboard/batch_connect/sys/bc_desktop/<cluster>/output/<uuid>/

   where ``uuid`` is a randomly generated id for a single desktop session. You
   might want to find the latest one by looking at the timestamps.

   .. warning::

      The form may fail to submit due to the defaults we chose for a given
      resource manager: Torque, Slurm, LSF, PBS Pro... Please continue to the
      next section to learn how to customize batch job submission.

.. _bc_desktop: https://github.com/OSC/bc_desktop/
{'fraction_non_alphanumeric': 0.08406078241189784, 'fraction_numerical': 0.007759456838021339, 'mean_word_length': 2.7519708914493632, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 3, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1077694', 'n_tokens_mistral': 1825, 'n_tokens_neox': 1666, 'n_words': 817}