"Fossies" - the Fresh Open Source Software Archive

Member "barbican-12.0.0/doc/source/contributor/dev.rst" (14 Apr 2021, 3688 Bytes) of package /linux/misc/openstack/barbican-12.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) reStructured Text source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 Setting up a Barbican Development Environment
    2 ==============================================
    3 
    4 These instructions are designed to help you setup a standalone version of
    5 Barbican which uses SQLite as a database backend. This is not suitable for
    6 production due to the lack of authentication and an interface to a secure
    7 encryption system such as an HSM (Hardware Security Module). In addition,
    8 the SQLite backend has known issues with thread-safety. This setup is purely
    9 to aid in development workflows.
   10 
   11 Installing system dependencies
   12 ------------------------------
   13 
   14 **Ubuntu 15.10:**
   15 
   16 .. code-block:: bash
   17 
   18     # Install development tools
   19     sudo apt-get install git python-tox
   20 
   21     # Install dependency build requirements
   22     sudo apt-get install libffi-dev libssl-dev python-dev gcc
   23 
   24 **Fedora 30:**
   25 
   26 .. code-block:: bash
   27 
   28     # Install development tools
   29     sudo dnf install git python3-tox
   30 
   31     # Install dependency build requirements
   32     sudo dnf install gcc libffi-devel openssl-devel redhat-rpm-config
   33 
   34 Setting up a virtual environment
   35 --------------------------------
   36 
   37 We highly recommend using virtual environments for development.  You can learn
   38 more about `Virtual Environments`_ in The Python Tutorial.
   39 
   40 If you installed tox in the previous step you should already have virtualenv
   41 installed as well.
   42 
   43 .. _Virtual Environments: https://docs.python.org/3/tutorial/venv.html
   44 
   45 .. code-block:: bash
   46 
   47     # Clone barbican source
   48     git clone https://opendev.org/openstack/barbican
   49     cd barbican
   50 
   51     # Create and activate a virtual environment
   52     virtualenv .barbicanenv
   53     . .barbicanenv/bin/activate
   54 
   55     # Install barbican in development mode
   56     pip install -e $PWD
   57 
   58 Configuring Barbican
   59 --------------------
   60 
   61 Barbican uses oslo.config for configuration.  By default the api process will
   62 look for the configuration file in ``$HOME/barbican.conf`` or
   63 ``/etc/barbican/barbican.conf``.  The sample configuration files included in the
   64 source code assume that you'll be using ``/etc/barbican/`` for configuration and
   65 ``/var/lib/barbican`` for the database file location.
   66 
   67 .. code-block:: bash
   68 
   69    # Create the directories and copy the config files
   70    sudo mkdir /etc/barbican
   71    sudo mkdir /var/lib/barbican
   72    sudo chown $(whoami) /etc/barbican
   73    sudo chown $(whoami) /var/lib/barbican
   74    cp -r etc/barbican /etc
   75    tox -e genconfig
   76    cp etc/oslo-config-generator/barbican.conf /etc/barbican/barbican.conf
   77    sed -i 's/\/v1: barbican-api-keystone/\/v1: barbican_api/' /etc/barbican/barbican-api-paste.ini
   78 
   79 All the locations are configurable, so you don't have to use ``/etc`` and
   80 ``/var/lib`` in your development machine if you don't want to.
   81 
   82 Running Barbican
   83 ----------------
   84 
   85 If you made it this far you should be able to run the barbican development
   86 server using this command:
   87 
   88 .. code-block:: bash
   89 
   90    bin/barbican-api
   91 
   92 An instance of barbican will be listening on ``http://localhost:9311``.  Note
   93 that the default configuration uses the unauthenticated context.  This means
   94 that requests should include the ``X-Project-Id`` header instead of including
   95 a keystone token in the ``X-Auth-Token`` header.  For example:
   96 
   97 .. code-block:: bash
   98 
   99    curl -v -H 'X-Project-Id: 12345' \
  100            -H 'Accept: application/json' \
  101            http://localhost:9311/v1/secrets
  102 
  103 For more information on configuring Barbican with Keystone auth see the
  104 :doc:`Keystone Configuration </configuration/keystone>` page.
  105 
  106 Building the Documentation
  107 --------------------------
  108 
  109 You can build the html documentation using tox:
  110 
  111 .. code-block:: bash
  112 
  113    tox -e docs
  114 
  115 
  116 Running the Unit Tests
  117 ----------------------
  118 
  119 You can run the unit test suite using tox:
  120 
  121 .. code-block:: bash
  122 
  123    tox -e py36