Installing Cue on Ubuntu¶
This install guide provides details on how to install on a Ubuntu based image with the necessary dependencies and required configuration.
Architecture¶
Installation of Cue requires four (2) primary Cue components, two (2) components that are external dependencies for Cue, and three (3) optional components.
Required Cue Components¶
- Cue API
- Cue Worker
Required Dependencies¶
- MySQL
- Zookeeper
Optional Components¶
- Cue Command-line Client (python-cueclient)
- Cue Dashboard (cue-dashboard)
- Openstack Client (python-openstackclient)
Additional Setup¶
Additional setup beyond installing Cue services is required in Keystone to allow authentication of user credentials against Keystone. Also the Keystone service catalog must be updated to include Cue’s service endpoints.
Prerequisites¶
Install¶
$ sudo apt-get install zookeeper zookeeperd python-mysqldb
MySQL¶
Note
The following commands should be done using the mysql command line or similar.
Create the MySQL user
$ GRANT ALL ON cue.* TO 'cue'@'localhost' IDENTIFIED BY 'cue'
Create the database
$ CREATE DATABASE cue
Installing using Source (Git)¶
- Install pre-requisites:
$ sudo apt-get install git python-dev python-pip
$ sudo apt-get build-dep python-lxml
- Clone the repository:
$ git clone git://github.com/openstack/cue cue
- Change directory to the newly cloned repository
$ cd cue
- Install all dependencies using pip
$ sudo pip install -r requirements.txt
$ sudo pip install MySQL-python
- Install Cue:
$ sudo python setup.py develop
- Copy over configuration files
$ sudo cp -R etc/cue /etc/
$ ls /etc/cue/*.sample | while read f; do sudo cp $f $(echo $f | sed "s/.sample$//g"); done
Create directories¶
Since we are not running packages some directories are not created for us.
$ sudo mkdir /var/lib/cue /var/log/cue
# Needed if you are running cue as a non root user.
$ sudo chown cue_user /var/lib/cue /var/log/cue
Configuring¶
Register Cue with Keystone¶
1. Create new user for cue service
keystone user-create --name cue --tenant <tenant_uuid> --pass <password
2. Add admin role for cue_admin user
keystone user-role-add --user cue_admin --tenant cue_admin_service --role=admin
Add Cue Service Endpoint to Keystone¶
1. Add cue service to keystone
keystone service-create --type message_broker --name cue --description "Message Broker provisioning service"
2. Create a new endpoint for the cue service in keystone
keystone endpoint-create --region RegionOne --service <cue_service_uuid> --publicurl http://<cue_api_ip>:8795/ --adminurl http://<cue_api_ip>:8795/ --internalurl http://<cue_api_ip>:8795/
Create Message Broker Image¶
The Cue service makes use of custom Ubuntu images with required messaging broker (e.g. RabbitMQ) installed. Building images uses the Tripleo diskimage-builder tools. Image elements for the RabbitMQ image are found in cue/contrib/image-elements/, you will also find the ‘image-build-rabbitmq.sh’ script which will build a custom image compatible with Cue.
The images are based on the latest base Ubuntu cloud image with the following elements:
- os-apply-config
- os-refresh-config
- ntp
- hosts
- cue-rabbitmq-base (cue/contrib/image-elements/cue-rabbit-base)
- ifmetric (cue/contrib/image-elements/ifmetric)
Note: building images will require a machine with more than 4GB of memory.
Once the image is built, it must be uploaded to Glance (disk format is qcow2) and message broker details added to Cue database through cue-management.
1. Create new Message Broker and set it as active broker
$ cue-manage --config-file etc/cue/cue.conf broker add <name> true
2. Add metadata indicating image id (created above) for new Message Broker
$ cue-manage --config-file etc/cue/cue.conf broker add_metadata <broker-uuid> --image <image-uuid>
Cue Config¶
$ sudo editor /etc/cue/cue.conf
Copy or mirror the configuration from this sample file here:
[DEFAULT]
management_network_id = <uuid>
os_security_group = <uuid>
policy_file = /etc/cue/policy.json
# Show more verbose log output (sets INFO log level output)
verbose = True
# Show debugging output in logs (sets DEBUG log level output)
debug = True
# Log levels for Zookeeper client and Stevedore
default_log_levels = kazoo.client=INFO,stevedore=INFO
[database]
# Database connection string - to configure options for a given implementation
connection = mysql://<user>:<password>@<ip-address>/cue
[api]
# Cue REST API specific configuration
api_port = 8795
api_host = <rest-api-ip-address>
auth_strategy = keystone
[taskflow]
# Zookeeper host node
zk_hosts=<zookeeper-ip-address>
[openstack]
# Credentials used by Cue to access OpenStack services
os_password = <password>
os_username = <username>
os_auth_url = http://192.168.131.199:35357/v3
os_auth_version = 3
os_project_name = <project-name>
os_project_domain_name = <project-domain-name>
os_user_domain_name = <user-domain-name>
[keystone_authtoken]
# Credentials used by Cue for KeyStone authentication
auth_url = http://<keystone-ip-address>:35357
auth_plugin = <auth-password>
project_name = service
password = <password>
username = <username>
More details on configuration values:
Sync Database schemas¶
Initialize database schema for Cue
$ cue-manage --config-file /etc/cue/cue.conf database upgrade
Notes:
- magement_network_id must be different than provided user network id through API.
Starting the services¶
Worker¶
$ cue-worker --config-file /etc/cue/cue.conf
API¶
The API can be started as is (through shell) or can be started behind Apache. Starting the API behind Apache is the recommended method for running the API (section below).
Starting with command shell:
$ cue-api --config-file /etc/cue/cue.conf
Running Cue API behind Apache2¶
Note
In this howto we explain how to setup cue-api to run behind a Apache2 instance vs as a process of it’s own.
We will assume that cue is available under /opt/stack/cue as it is in devstack.
Symlink app.wsgi to /var/www
$ sudo mkdir /var/www/cue
$ sudo ln -s /opt/stack/cue/cue/api/app.wsgi /var/www/cue
Setup Apache2 config
$ sudo cp /opt/cue/etc/apache2/cue.conf /etc/apache2/sites-available
$ sudo a2ensite cue
$ sudo service apache2 reload
You should now have cue-api running under Apache2!