Install Qinling on Ubuntu 16.04

Install Qinling on Ubuntu 16.04

This section describes how to install and configure the Function management service, code-named qinling on the controller node that runs Ubuntu 16.04 (LTS).

Prerequisites

Before you install and configure Qinling, you must create a database, service credentials, and API endpoints.

  1. To create the database, complete these steps:

    • Use the database access client to connect to the database server as the root user:

      # mysql -u root -p
      
    • Create the qinling database:

      CREATE DATABASE qinling;
      
    • Grant proper access to the qinling database:

      GRANT ALL PRIVILEGES ON qinling.* TO 'qinling'@'localhost' \
        IDENTIFIED BY 'QINLING_DBPASS';
      GRANT ALL PRIVILEGES ON qinling.* TO 'qinling'@'%' \
        IDENTIFIED BY 'QINLING_DBPASS';
      

      Replace QINLING_DBPASS with a suitable password.

    • Exit the database access client.

  2. Source the admin credentials to gain access to admin-only CLI commands:

    $ . admin-openrc
    
  3. To create the service credentials, complete these steps:

    • Create the qinling user:

      $ openstack user create --domain default --password-prompt qinling
      User Password:
      Repeat User Password:
      +---------------------+----------------------------------+
      | Field               | Value                            |
      +---------------------+----------------------------------+
      | domain_id           | default                          |
      | enabled             | True                             |
      | id                  | f77c97367087440da5f923bfcc66f68b |
      | name                | qinling                          |
      | options             | {}                               |
      | password_expires_at | None                             |
      +---------------------+----------------------------------+
      
    • Add the admin role to the qinling user:

      $ openstack role add --project service --user qinling admin
      

      Note

      This command provides no output.

    • Create the qinling service entities:

      $ openstack service create function-engine \
          --name qinling --description="Function Service"
      +-------------+----------------------------------+
      | Field       | Value                            |
      +-------------+----------------------------------+
      | description | Function Service                 |
      | enabled     | True                             |
      | id          | 8811fab348b548e3adef6ff0b149edfb |
      | name        | qinling                          |
      | type        | function-engine                  |
      +-------------+----------------------------------+
      
  4. Create the Function engine service API endpoints:

    $ openstack endpoint create --region RegionOne \
        function-engine public http://controller:7070
    +--------------+----------------------------------+
    | Field        | Value                            |
    +--------------+----------------------------------+
    | enabled      | True                             |
    | id           | 70937a84ed434256b11853b7e8a05d91 |
    | interface    | public                           |
    | region       | RegionOne                        |
    | region_id    | RegionOne                        |
    | service_id   | 8811fab348b548e3adef6ff0b149edfb |
    | service_name | qinling                          |
    | service_type | function-engine                  |
    | url          | http://controller:7070           |
    +--------------+----------------------------------+
    $ openstack endpoint create --region RegionOne \
        function-engine internal http://controller:7070
    +--------------+----------------------------------+
    | Field        | Value                            |
    +--------------+----------------------------------+
    | enabled      | True                             |
    | id           | 7249f13c00cf4ca788da3df3fac9cfe2 |
    | interface    | internal                         |
    | region       | RegionOne                        |
    | region_id    | RegionOne                        |
    | service_id   | 8811fab348b548e3adef6ff0b149edfb |
    | service_name | qinling                          |
    | service_type | function-engine                  |
    | url          | http://controller:7070           |
    +--------------+----------------------------------+
    $ openstack endpoint create --region RegionOne \
        function-engine admin http://controller:7070
    +--------------+----------------------------------+
    | Field        | Value                            |
    +--------------+----------------------------------+
    | enabled      | True                             |
    | id           | 7726669d928d47198388c599bfcd62a5 |
    | interface    | admin                            |
    | region       | RegionOne                        |
    | region_id    | RegionOne                        |
    | service_id   | 8811fab348b548e3adef6ff0b149edfb |
    | service_name | qinling                          |
    | service_type | function-engine                  |
    | url          | http://controller:7070           |
    +--------------+----------------------------------+
    

Install and configure Qinling components

  1. Create qinling user and necessary directories:

    • Create user:

      # groupadd --system qinling
      # useradd --home-dir "/var/lib/qinling" \
            --create-home \
            --system \
            --shell /bin/false \
            -g qinling \
            qinling
      
    • Create directories:

      # mkdir -p /etc/qinling /var/lib/qinling/package
      # chown -R qinling:qinling /etc/qinling /var/lib/qinling/package
      
  2. Clone and install qinling:

    # apt install -y python-pip
    # cd /var/lib/qinling
    # git clone https://git.openstack.org/openstack/qinling.git
    # chown -R qinling:qinling qinling
    # cd qinling
    # pip install -e .
    
  3. Generate a sample configuration file:

    # su -s /bin/sh -c "oslo-config-generator \
        --config-file tools/config/config-generator.qinling.conf \
        --output-file etc/qinling.conf.sample" qinling
    # su -s /bin/sh -c "cp etc/qinling.conf.sample \
        /etc/qinling/qinling.conf" qinling
    # su -s /bin/sh -c "cp etc/policy.json.sample \
        /etc/qinling/policy.json" qinling
    
  4. Edit the /etc/qinling/qinling.conf:

    • In the [DEFAULT] section, configure RabbitMQ message queue access:

      [DEFAULT]
      ...
      transport_url = rabbit://openstack:RABBIT_PASS@controller:5672/
      

      Replace RABBIT_PASS with the password you chose for the openstack account in RabbitMQ.

    • In the [api] section, configure the IP address that Qinling API server is going to listen:

      [api]
      ...
      host = 10.0.0.9
      port = 7070
      

      Replace 10.0.0.9 with the management interface IP address of the controller node if different.

    • In the [database] section, configure database access:

      [database]
      ...
      connection = mysql+pymysql://qinling:QINLING_DBPASS@controller/qinling?charset=utf8
      

      Replace QINLING_DBPASS with the password you chose for the qinling database.

    • In the [storage] section, configure function package storage path:

      [storage]
      ...
      file_system_dir = /var/lib/qinling/package
      
    • In the [oslo_policy] section, configure the policy file path for Qinling service:

      [oslo_policy]
      ...
      policy_file = /etc/qinling/policy.json
      
    • In the [keystone_authtoken] section, configure Identity service access:

      [keystone_authtoken]
      ...
      memcached_servers = controller:11211
      www_authenticate_uri = http://controller:5000
      project_domain_name = default
      project_name = service
      user_domain_name = default
      password = QINLING_PASS
      username = qinling
      auth_url = http://controller:5000
      auth_type = password
      auth_version = v3
      

      Replace QINLING_PASS with the password you chose for the qinling user in the Identity service.

    Note

    Make sure that /etc/qinling/qinling.conf still have the correct permissions. You can set the permissions again with:

    # chown qinling:qinling /etc/qinling/qinling.conf

  5. Populate Qinling database:

    # su -s /bin/sh -c "qinling-db-manage --config-file \
        /etc/qinling/qinling.conf upgrade head" qinling
    

Install and configure Kubernetes and etcd

Installing Kubernetes in not in the scope of this guide, you can refer to Kubernetes installation guide for more information.

For etcd installation, you can refer to OpenStack Installation Guide.

  1. Config kubernetes in Qinling. Refer to Config Qinling using existing Kubernetes cluster.

  2. Config etcd. In the [etcd] section of /etc/qinling/qinling.conf, configure the IP address and port that etcd service is listening on.

    [etcd]
    ...
    host = 10.0.0.9
    port = 2379
    

Finalize installation

  1. Create an upstart config for qinling-api, it could be named as /etc/systemd/system/qinling-api.service:

    cat <<EOF > /etc/systemd/system/qinling-api.service
    [Unit]
    Description = OpenStack Function Management Service API
    
    [Service]
    ExecStart = /usr/local/bin/qinling-api
    User = qinling
    
    [Install]
    WantedBy = multi-user.target
    EOF
    
  2. Create an upstart config for qinling-engine, it could be named as /etc/systemd/system/qinling-engine.service:

    cat <<EOF > /etc/systemd/system/qinling-engine.service
    [Unit]
    Description = OpenStack Function Management Service Engine
    
    [Service]
    ExecStart = /usr/local/bin/qinling-engine
    User = qinling
    
    [Install]
    WantedBy = multi-user.target
    EOF
    
  3. Enable and start qinling-api and qinling-engine:

    # systemctl enable qinling-api
    # systemctl enable qinling-engine
    
    # systemctl start qinling-api
    # systemctl start qinling-engine
    
  4. Verify that qinling-api and qinling-engine services are running:

    # systemctl status qinling-api
    # systemctl status qinling-engine
    
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.