===================
Install AEN Compute
===================

This is where projects are stored and run. Adding multiple AEN
Compute Nodes allows you to scale-out horizontally to increase
capacity. Projects can be created on individual Compute Nodes to spread
the load.

These procedures assume that you have already performed the :doc:`install-prep`,
:doc:`install-server` and :doc:`install-gateway` procedures.

Set variables and change permissions
====================================

In the script below, change ``<FQDN HOSTNAME OR IP ADDRESS>`` to the actual
fully qualified domain hostname or IP address. 

::

        export AEN_SERVER=<FQDN HOSTNAME OR IP ADDRESS> # Use the real FQDN
        chmod a+x aen-*.sh                 # Set installer to be executable
        
NOTE: You must perform the entire procedure before closing the terminal 
to ensure the variable export persists.

Run AEN Compute installer
=========================

::

        sudo -E ./aen-compute-4.1.3-Linux-x86_64.sh -w $AEN_SERVER
        ...
        ...
        PREFIX=/opt/wakari/wakari-compute
        Logging to /tmp/wakari_compute.log
        Checking server name
        ...
        ...
        Initial clone of root environment...
        Starting Wakari daemons...
        installation finished.
        Do you wish the installer to prepend the wakari-compute install location
        to PATH in your /root/.bashrc ? [yes|no]
        [no] >>> yes

Configure AEN Compute
=====================

Once installed, you need to configure the Compute Launcher on AEN Server.

1. Point your browser at the AEN Server
2. Login as the ``AEN_SRVC_ACCT`` user
3. Click the Admin link in the top navbar
4. Click Enterprise Resources in the left navbar
5. Click Add Resource
6. Select the correct (probably the only) Data Center to associate with this
   Compute Node
7. Enter the fully-qualified domain name here. 

Note: If the Compute Launcher is located on the same box as the Gateway, 
we recommend using ``http://localhost:5002`` for the URL value.

8. Add a Name and Description for the Compute Node
9. Click the Add Resource button to save the changes.

Configure conda to use local on-site Anaconda repo
==================================================

This integrates Anaconda Enterprise Notebooks to use a local on-site Anaconda
Enterprise Repository server instead of Anaconda.org.

Edit the condarc on the Compute Node
-------------------------------------

The ``condarc`` is the conda runtime configuration file. 

NOTE: If there are some channels below that you haven't mirrored, 
you should remove them from the configuration.

NOTE: Change ``<your Anaconda Repository name>`` in the following script 
to the actual name of your repository before running.

::

    #/opt/wakari/anaconda/.condarc
    channels:
        - defaults

    create_default_packages:
        - anaconda-client
        - ipykernel

    # Default channels are needed for when users override the system .condarc
    # with ~/.condarc. This ensures that "defaults" map to your Anaconda Repository and not
    # repo.continuum.io
    default_channels:
        - http://<your Anaconda Repository name>:8080/conda/anaconda
        - http://<your Anaconda Repository name>:8080/conda/wakari
        - http://<your Anaconda Repository name>:8080/conda/r-channel

    # Note:  You must add the "conda" subdirectory to the end
    channel_alias: http://<your Anaconda Repository name>:8080/conda

Configure Anaconda client
--------------------------

Anaconda client lets users work with the Anaconda Repository from the command-line, 
to search for packages, login, upload packages, etc.  The
command below sets this value globally for all users.

Run the following command filling in the proper repository URL.
This command requires ``sudo`` as the config file is written to the root file system: 
``/etc/xdg/binstar/config.yaml``. This sets the default config for ``anaconda-client`` 
for all users on compute node.

::

    sudo /opt/wakari/anaconda/bin/anaconda config --set url http://<your Anaconda Repository>:8080/api -s

Repeat compute node install procedure with additional nodes as necessary
========================================================================

One Data Center can support numerous nodes. If you need to configure 
additional Compute Nodes, run through this procedure for each Compute 
Node you wish to stand up. 

Finish
======

**Congratulations! You've successfully installed and configured
Anaconda Enterprise Notebooks.**

Next steps
==========

The following optional install procedures may need to be performed, 
depending on how you set up your Data Center:

* :doc:`option-config`
* :doc:`customization`
* :doc:`ldap`
* :doc:`ssl`
* :doc:`sso`
   
Additional post-install information:
   
* :doc:`installation_update`
* :doc:`uninstall`
* :doc:`release`
