Install from source
===================

.. note::

   In the commands below, substitute "<release>" for your version of choice,
   such as "queens" or "rocky".

   If you use the development version, replace "stable/<release>" with "master".

Install the services
--------------------

Retrieve and install cloudkitty:

.. code-block:: console

    git clone https://opendev.org/openstack/cloudkitty.git
    cd cloudkitty
    pip install -c https://opendev.org/openstack/requirements/raw/branch/stable/<release>/upper-constraints.txt .

This procedure installs the ``cloudkitty`` python library and the
following executables:

* ``cloudkitty-api``: API service
* ``cloudkitty-processor``: Processing service (collecting and rating)
* ``cloudkitty-dbsync``: Tool to create and upgrade the database schema
* ``cloudkitty-storage-init``: Tool to initiate the storage backend

Install sample configuration files:

.. code-block:: console

    mkdir /etc/cloudkitty
    tox -e genconfig
    cp etc/cloudkitty/cloudkitty.conf.sample /etc/cloudkitty/cloudkitty.conf
    cp etc/cloudkitty/policy.yaml /etc/cloudkitty
    cp etc/cloudkitty/api_paste.ini /etc/cloudkitty

Create the log directory:

.. code-block:: console

    mkdir /var/log/cloudkitty/

Install the client
------------------

Retrieve and install cloudkitty client:

.. code-block:: console

    git clone https://opendev.org/openstack/python-cloudkittyclient.git
    cd python-cloudkittyclient
    pip install -c https://opendev.org/openstack/requirements/raw/branch/stable/<release>/upper-constraints.txt .

Install the dashboard module
----------------------------

#. Retrieve and install cloudkitty's dashboard:

    .. code-block:: console

        git clone https://opendev.org/openstack/cloudkitty-dashboard.git
        cd cloudkitty-dashboard
        pip install -c https://opendev.org/openstack/requirements/raw/branch/stable/<release>/upper-constraints.txt .

#. Find where the python packages are installed:

    .. code-block:: console

        PY_PACKAGES_PATH=`pip --version | cut -d' ' -f4`

#. Add the enabled file to the horizon settings or installation.
   Depending on your setup, you might need to add it to ``/usr/share`` or
   directly in the horizon python package:

    .. code-block:: console

        # If horizon is installed by packages:
        ln -sf $PY_PACKAGES_PATH/cloudkittydashboard/enabled/_[0-9]*.py \
        /usr/share/openstack-dashboard/openstack_dashboard/enabled/

        # Directly from sources:
        ln -sf $PY_PACKAGES_PATH/cloudkittydashboard/enabled/_[0-9]*.py \
        $PY_PACKAGES_PATH/openstack_dashboard/enabled/

#. Restart the web server hosting Horizon.
