=============================================
Using project directories as home directories
=============================================

The ``projDirsAsHome`` option changes the AEN home directories from the standard
``/home/<username>`` location to the project directories and the location
``/projects/<username>/<project_name>/<username>/``. This ensures that AEN
and AEN apps will not be affected by configuration files in a user's home
directory, such as ``.bashrc`` or configuration files in subdirectories such as
``.ipython`` and ``.jupyter``.

Package cache locations
=======================

AEN version 4.1.3 stores the cache of packages in ``/home/<username>``, while
AEN versions 4.2.0 and higher store the cache of packages in
``/projects/<username>/<project_name>/<username>/``. By moving the package cache
to the same filesystem as the project, AEN versions 4.2.0 and higher can use
hardlinks and save disk space and time when creating or cloning environments.

These package cache locations are not affected by the ``projDirsAsHome`` option.

After upgrading from AEN 4.1.3 to AEN 4.2.0 or higher, existing projects will
still use the package cache in ``/home/<username>``. Do not remove this cache,
or the existing projects will break.

When users create new projects or install packages, the newly installed packages
will use the new cache location.

If you wish to remove the older package cache in ``/home/<username>``:

* Upgrade AEN to 4.2.0 or higher.
* Use ``conda remove`` to remove every non-default package in every project.
* Use ``conda install`` to replace them. The replaced packages will link to the
  new package cache in ``/projects/<username>/<project_name>/<username>/``.
* You can now safely remove the older package cache.

Enabling projDirsAsHome
=======================

NOTE: The ``projDirsAsHome`` option should be enabled immediately after performing
the installation process and before any users have logged in to AEN. This ensures
that users will not have home directories in different places due to some
creating their home directories when the option was disabled and others
creating their home directories when the option was enabled.

#. In the ``/opt/wakari/wakari-compute/etc/wakari/wk-compute-launcher-config.json``
   file, add the ``projDirsAsHome`` key value and set it to ``true``.

   .. code-block:: bash

      , "projDirsAsHome": true
   
   NOTE: You must add the comma at the beginning of the line. If you add this
   line as the last key, you must remove any comma at the end of the line.

#. Restart the AEN compute service:

   .. code-block:: bash

      sudo service wakari-compute restart
