summaryrefslogtreecommitdiff
path: root/doc/source/install/install-manual.rst
blob: 563e23a4c0ef93a5e223dbbc76f75293fe9135de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
.. _install-manual:

Manual Trove Installation
=========================

Objectives
~~~~~~~~~~

This document provides a step-by-step guide for manual installation of Trove
with an existing OpenStack environment for development purposes.

This document will not cover OpenStack setup for other services.

Requirements
~~~~~~~~~~~~

A running OpenStack environment installed on Ubuntu 16.04 or 18.04 LTS is
required, including the following components:

- Compute (Nova)
- Image Service (Glance)
- Identity (Keystone)
- Network (Neutron)
- If you want to provision databases on block-storage volumes, you also need
  Block Storage (Cinder)
- If you want to do backup/restore or replication, you also need Object Storage
  (Swift)
- AMQP service (RabbitMQ or QPID)
- MySQL (SQLite, PostgreSQL) database

Networking requirements
-----------------------

Trove makes use of an "Management Network" that the controller uses to talk to
trove instance and vice versa. All the trove instance that Trove deploys will
have interfaces and IP addresses on this network. Therefore, it’s important
that the subnet deployed on this network be sufficiently large to allow for the
maximum number of trove instance and controllers likely to be deployed
throughout the lifespan of the cloud installation.

You must also create a Neutron security group which will be applied to trove
instance port created on the management network. The cloud admin has full
control of the security group, e.g it can be helpful to allow SSH access to the
trove instance from the controller for troubleshooting purposes (ie. TCP port
22), though this is not strictly necessary in production environments.

Finally, you need to add routing or interfaces to this network so that the
Trove controller is able to communicate with Nova servers on this network.

Trove Installation
~~~~~~~~~~~~~~~~~~

Required packages for Trove
---------------------------

List of packages to be installed:

.. code-block:: bash

    $ sudo apt-get install -y build-essential python-dev libpython-dev \
    python-setuptools libffi-dev libxslt1-dev libxml2-dev libyaml-dev \
    libssl-dev zlib1g-dev mysql-client python-pymysql libmysqlclient-dev git

Python settings
---------------

Install pip:

.. code-block:: bash

    curl -SO# https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py pip==9.0.3 && rm -f get-pip.py

Install virtualenv, create Trove environment and activate it:

.. code-block:: bash

    pip install virtualenv --user
    virtualenv --system-site-packages trove_env
    source trove_env/bin/activate

Get Trove
---------

Obtain the Trove source components from OpenStack repositories:

.. code-block:: bash

    cd ~
    git clone https://opendev.org/openstack/trove.git
    git clone https://opendev.org/openstack/python-troveclient.git


Install Trove
-------------

First, install the requirements:

.. code-block:: bash

    cd ~/trove
    sudo pip install -r requirements.txt -r test-requirements.txt

Then, install Trove:

.. code-block:: bash

    sudo pip install -e .

Finally, install the Trove client:

.. code-block:: bash

    cd ~/python-troveclient
    sudo pip install -e .
    cd ~

Other required OpenStack clients (python-novaclient, python-keystoneclient,
etc.) should already be installed as part of the Trove requirements.

Prepare Trove for OpenStack
---------------------------

.. note::

    You need to run the following commands using OpenStack admin credentials.

#.  Create Trove service user with admin role in the ``service`` project.

    .. code-block:: bash

        openstack user create trove --project service --password-prompt
        openstack role add --user trove --project service admin

#.  Register Trove in Keystone.

    .. code-block:: bash

        openstack service create --name trove --description "Database" database
        openstack endpoint create --region RegionOne database public 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'
        openstack endpoint create --region RegionOne database admin 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'
        openstack endpoint create --region RegionOne database internal 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'

    Where <EnvironmentPublicIP> is the IP address of the server where Trove was
    installed. This IP should be reachable from any hosts that will be used to
    communicate with Trove.

Trove configuration
~~~~~~~~~~~~~~~~~~~

There are several configuration files for Trove, you can find samples of the
config files in ``etc/trove/`` of Trove repo:

- api-paste.ini and trove.conf β€” For trove-api service
- trove-guestagent.conf β€” For trove-guestagent service
- ``<datastore_manager>.cloudinit`` β€” Userdata for VMs during provisioning

Options in trove.conf
---------------------

#.  Config service tenant model, change the values according to your own
    environment.

    .. code-block:: ini

        nova_proxy_admin_user = admin
        nova_proxy_admin_pass = password
        nova_proxy_admin_tenant_name = admin
        nova_proxy_admin_tenant_id = f472127c03f6410899225e26a3c1d22c
        nova_proxy_admin_user_domain_name = default
        nova_proxy_admin_project_domain_name = default
        remote_nova_client = trove.common.clients_admin.nova_client_trove_admin
        remote_cinder_client = trove.common.clients_admin.cinder_client_trove_admin
        remote_neutron_client = trove.common.clients_admin.neutron_client_trove_admin
        os_region_name = RegionOne

#.  Management config options.

    management_networks
      Trove management network ID list. Cloud admin needs to create the
      networks.

    management_security_groups
      Security group IDs that applied to the management port in the trove
      instance. Cloud admin needs to create the security groups.

    nova_keypair
      The Nova keypair used to create trove instance. Cloud admin needs to
      create the keypair.

    cinder_volume_type
      The Cinder volume type name used to create volume that attached to the
      trove instance, otherwise, users need to provide the volume type when
      creating the instance.

Prepare Trove database
~~~~~~~~~~~~~~~~~~~~~~

Create the Trove database schema:

- Connect to the storage backend (MySQL, PostgreSQL)
- Create a database called `trove` (this database will be used for storing
  Trove ORM)
- Compose connection string. Example:
  ``mysql+pymysql://<user>:<password>@<backend_host>:<backend_port>/<database_name>``

Initialize the database
-----------------------

Once the database for Trove is created, its structure needs to be populated.

.. code-block:: bash

    $ trove-manage db_sync

Create and register Trove guest image
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To build Trove guest image, refer to
`Build guest agent image <https://docs.openstack.org/trove/latest/admin/trovestack.html#build-guest-agent-image>`_

Run Trove
~~~~~~~~~

Starting Trove services
-----------------------

Run trove-api:

.. code-block:: bash

    $ trove-api --config-file=${TROVE_CONF_DIR}/trove.conf &

Run trove-taskmanager:

.. code-block:: bash

    $ trove-taskmanager --config-file=${TROVE_CONF_DIR}/trove.conf &

Run trove-conductor:

.. code-block:: bash

   $ trove-conductor --config-file=${TROVE_CONF_DIR}/trove.conf &