Commit 3f1a89c7dd changed most of the
install docs to use "Default" instead of "default" for project/user
domain names according to the keystone docs, but the install doc for
PyPI has been missed. This patch fixes it accordingly.
Change-Id: I2e92730ff5819bf49cf1b286356870fdb9c6ece5
Story: #2006652
Task: #36894
8.7 KiB
Install and configure Placement from PyPI
The section describes how to install and configure the placement service using packages from PyPI. Placement works with Python version 2.7, but version 3.6 or higher is recommended.
This document assumes you have a working MySQL server and a working
Python environment, including the about-pip package installer. Depending on your
environment, you may wish to install placement in a virtualenv.
This document describes how to run placement with uwsgi as its web server. This is but one of many different ways to host the service. Placement is a well-behaved WSGI application so should be straightforward to host with any WSGI server.
If using placement in an OpenStack environment, you will need to ensure it is up and running before starting services that use it but after services it uses. That means after Keystone, but before anything else.
Prerequisites
Before installing the service, you will need to create the database, service credentials, and API endpoints, as described in the following sections.
pip
Note
Examples throughout this reference material use the pip
command. This may need to be pathed or spelled differently (e.g.
pip3) depending on your installation and Python
version.
python-openstackclient
If not already installed, install the openstack command
line tool:
# pip install python-openstackclient
Create Database
Placement is primarily tested with MySQL/MariaDB so that is what is described here. It also works well with PostgreSQL and likely with many other databases supported by sqlalchemy.
To create the database, complete these steps:
Use the database access client to connect to the database server as the
rootuser or by usingsudoas appropriate:# mysqlCreate the
placementdatabase:MariaDB [(none)]> CREATE DATABASE placement;Grant proper access to the database:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \ IDENTIFIED BY 'PLACEMENT_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \ IDENTIFIED BY 'PLACEMENT_DBPASS';Replace
PLACEMENT_DBPASSwith a suitable password.Exit the database access client.
Configure User and Endpoints
Note
If you are not using Keystone, you can skip the steps below but will
need to configure the :oslo.configapi.auth_strategy setting with a value of
noauth2. See also /contributor/quick-dev.
Note
You will need to authenticate to Keystone as an admin
before making these calls. There are many different ways to do this,
depending on how your system was set up. If you do not have an
admin-openrc file, you will have something similar.
Important
These documents use an endpoint URL of
http://controller:8778/ as an example only. You should
configure placement to use whatever hostname and port works best for
your environment. Using SSL on the default port, with either a domain or
path specific to placement, is recommended. For example:
https://mygreatcloud.com/placement or
https://placement.mygreatcloud.com/.
Install and configure components
The default location of the placement configuration file is
/etc/placement/placement.conf. A different directory may be
chosen by setting OS_PLACEMENT_CONFIG_DIR in the
environment. It is also possible to run the service with a partial or no
configuration file and set some options in the
environment. See /configuration/index for additional configuration
settings not mentioned here.
Note
In the steps below, controller is used as a stand in for
the hostname of the hosts where keystone, mysql, and placement are
running. These may be distinct. The keystone host (used for
auth_url and www_authenticate_uri) should be
the unversioned public endpoint for the Identity service.
Install placement and required database libraries:
# pip install openstack-placement pymysqlCreate the
/etc/placement/placement.conffile and complete the following actions:Create a
[placement_database]section and configure database access:[placement_database] connection = mysql+pymysql://placement:PLACEMENT_DBPASS@controller/placementReplace
PLACEMENT_DBPASSwith the password you chose for the placement database.Create
[api]and[keystone_authtoken]sections, configure Identity service access:[api] auth_strategy = keystone # use noauth2 if not using keystone [keystone_authtoken] www_authenticate_uri = http://controller:5000/ auth_url = http://controller:5000/ memcached_servers = controller:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = placement password = PLACEMENT_PASSReplace
PLACEMENT_PASSwith the password you chose for theplacementuser in the Identity service.Note
The value of
user_name,password,project_domain_nameanduser_domain_nameneed to be in sync with your keystone config.You may wish to set the :oslo.config
debugoption toTrueto produce more verbose log output.
Populate the
placementdatabase:$ placement-manage db syncNote
An alternative is to use the :oslo.config
placement_database.sync_on_startupoption.
Finalize installation
Now that placement itself has been installed we need to launch the service in a web server. What follows provides a very basic web server that, while relatively performant, is not set up to be easy to manage. Since there are many web servers and many ways to manage them, such things are outside the scope of this document.
Install and run the web server:
Install the
uwsgipackage (these instructions are against version 2.0.18):# pip install uwsgiRun the server with the placement WSGI application in a terminal window:
Warning
Make sure you are using the correct
uwsgibinary. It may be in multiple places in your path. The wrong version will fail and complain about bad arguments.# uwsgi -M --http :8778 --wsgi-file /usr/local/bin/placement-api \ --processes 2 --threads 10In another terminal confirm the server is running using
curl. The URL should match the public endpoint set inconfigure-endpoints-pypi.$ curl http://controller:8778/The output will look something like this:
{ "versions" : [ { "id" : "v1.0", "max_version" : "1.31", "links" : [ { "href" : "", "rel" : "self" } ], "min_version" : "1.0", "status" : "CURRENT" } ] }Further interactions with the system can be made with osc-placement.