Statistics
| Branch: | Tag: | Revision:

root / docs / setup.rst @ c5b9380c

History | View | Annotate | Download (12.6 kB)

1 85e3803d Stavros Sachtouris
Setup
2 85e3803d Stavros Sachtouris
=====
3 0c24b26b Stavros Sachtouris
4 85e3803d Stavros Sachtouris
Kamaki is easy to install from source or as a package. Some ui features are optional and can be install separately. Kamaki behavior can be configured in the kamaki config file.
5 0c24b26b Stavros Sachtouris
6 c52d1b08 Stavros Sachtouris
Quick Setup
7 c52d1b08 Stavros Sachtouris
-----------
8 c52d1b08 Stavros Sachtouris
9 c52d1b08 Stavros Sachtouris
Kamaki interfaces rely on a list of configuration options. Be default, they are configured to communicate with the `Okeanos IaaS <http://okeanos.grnet.gr>`_.
10 c52d1b08 Stavros Sachtouris
11 c52d1b08 Stavros Sachtouris
.. note:: It is essential for users to get a configuration token (okeanos.grnet.gr users go `here <https://accounts.okeanos.grnet.gr/im/>`_) and provide it to kamaki:
12 c52d1b08 Stavros Sachtouris
13 d6737e18 Stavros Sachtouris
14 c52d1b08 Stavros Sachtouris
.. code-block:: console
15 c52d1b08 Stavros Sachtouris
    :emphasize-lines: 1
16 c52d1b08 Stavros Sachtouris
17 c52d1b08 Stavros Sachtouris
    Example 1.1: Set user token to myt0k3n==
18 c52d1b08 Stavros Sachtouris
19 1d1b2724 Stavros Sachtouris
    $ kamaki config set token myt0k3n==
20 c52d1b08 Stavros Sachtouris
21 0c24b26b Stavros Sachtouris
Optional features
22 0c24b26b Stavros Sachtouris
-----------------
23 0c24b26b Stavros Sachtouris
24 4054c46d Stavros Sachtouris
For installing any or all of the following, consult the `kamaki installation guide <installation.html#install-ansicolors>`_
25 961e6040 Stavros Sachtouris
26 0c24b26b Stavros Sachtouris
* ansicolors
27 7536c9bf Stavros Sachtouris
    * Make command line / console user interface responses prettier with text formating (colors, bold, etc.)
28 0c24b26b Stavros Sachtouris
    * Can be switched on/off in kamaki configuration file: colors=on/off
29 4054c46d Stavros Sachtouris
    * Has not been tested on non unix / linux based platforms
30 0c24b26b Stavros Sachtouris
31 4054c46d Stavros Sachtouris
* mock 
32 4054c46d Stavros Sachtouris
    * For kamaki contributors only
33 4054c46d Stavros Sachtouris
    * Allow unittests to run on kamaki.clients package
34 4054c46d Stavros Sachtouris
    * Needs mock version 1.X or better
35 0c24b26b Stavros Sachtouris
36 0c24b26b Stavros Sachtouris
Any of the above features can be installed at any time before or after kamaki installation.
37 0c24b26b Stavros Sachtouris
38 0c24b26b Stavros Sachtouris
Configuration options
39 0c24b26b Stavros Sachtouris
---------------------
40 0c24b26b Stavros Sachtouris
41 7536c9bf Stavros Sachtouris
Kamaki comes with preset default values to all configuration options. All vital configuration options are set to use the okeanos.grnet.gr cloud services. User information is not included and should be provided either through the kamaki config command or by editing the configuration file.
42 0c24b26b Stavros Sachtouris
43 85e3803d Stavros Sachtouris
Kamaki configuration options are vital for correct Kamaki behavior. An incorrect option may render some command groups dysfunctional. There are two ways of managing configuration options: edit the config file or use the kamaki config command.
44 0c24b26b Stavros Sachtouris
45 0c24b26b Stavros Sachtouris
Using multiple setups
46 0c24b26b Stavros Sachtouris
^^^^^^^^^^^^^^^^^^^^^
47 0c24b26b Stavros Sachtouris
48 0c24b26b Stavros Sachtouris
Kamaki setups are stored in configuration files. By default, a Kamaki installation stores options in *.kamakirc* file located at the user home directory.
49 0c24b26b Stavros Sachtouris
50 7536c9bf Stavros Sachtouris
If a user needs to switch between different setups, Kamaki can explicitly load configuration files with the --config option:
51 0c24b26b Stavros Sachtouris
52 03d661d8 Stavros Sachtouris
.. code-block:: console
53 03d661d8 Stavros Sachtouris
54 03d661d8 Stavros Sachtouris
    $ kamaki --config <custom_config_file_path> [other options]
55 0c24b26b Stavros Sachtouris
56 0c24b26b Stavros Sachtouris
Using many different configuration files for different cloud services is encouraged.
57 0c24b26b Stavros Sachtouris
58 0c24b26b Stavros Sachtouris
Modifying options at runtime
59 0c24b26b Stavros Sachtouris
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60 0c24b26b Stavros Sachtouris
61 7536c9bf Stavros Sachtouris
All kamaki commands can be used with the -o option in order to override configuration options at runtime. For example::
62 0c24b26b Stavros Sachtouris
63 03d661d8 Stavros Sachtouris
.. code-block:: console
64 03d661d8 Stavros Sachtouris
65 03d661d8 Stavros Sachtouris
    $ kamaki store list -o global.account=anotheraccount -o global.token=aT0k3n==
66 0c24b26b Stavros Sachtouris
67 329753ae Stavros Sachtouris
will invoke *kamaki store list* with the specified options, but the initial global.account and global.token values will be restored to initial values afterwards.
68 0c24b26b Stavros Sachtouris
69 7ae842c2 Stavros Sachtouris
.. note:: on-the-fly calls to store require users to explicetely provide the account uuid corresponding to this token. The account is actually the uuid field at the response of the following call::
70 7ae842c2 Stavros Sachtouris
71 7ae842c2 Stavros Sachtouris
    $kamaki astakos authenticate aT0k3n==
72 7ae842c2 Stavros Sachtouris
73 0c24b26b Stavros Sachtouris
Editing options
74 0c24b26b Stavros Sachtouris
^^^^^^^^^^^^^^^
75 0c24b26b Stavros Sachtouris
76 0c24b26b Stavros Sachtouris
Kamaki config command allows users to see and manage all configuration options.
77 0c24b26b Stavros Sachtouris
78 0c24b26b Stavros Sachtouris
* kamaki config list
79 0c24b26b Stavros Sachtouris
    lists all configuration options currently used by a Kamaki installation
80 0c24b26b Stavros Sachtouris
81 0c24b26b Stavros Sachtouris
* kamaki config get <group.option>
82 0c24b26b Stavros Sachtouris
    show the value of a specific configuration option. Options must be of the form group.option
83 0c24b26b Stavros Sachtouris
84 0c24b26b Stavros Sachtouris
* kamaki config set <group.option> <value>
85 0c24b26b Stavros Sachtouris
    set the group.option to value
86 0c24b26b Stavros Sachtouris
87 329753ae Stavros Sachtouris
* kamaki config delete <group.option>
88 0c24b26b Stavros Sachtouris
    delete a configuration option
89 0c24b26b Stavros Sachtouris
90 0c24b26b Stavros Sachtouris
The above commands cause option values to be permanently stored in the Kamaki configuration file.
91 0c24b26b Stavros Sachtouris
92 0c24b26b Stavros Sachtouris
Editing the configuration file
93 0c24b26b Stavros Sachtouris
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
94 0c24b26b Stavros Sachtouris
95 329753ae Stavros Sachtouris
The configuration file is a simple text file that can be created by the user.
96 0c24b26b Stavros Sachtouris
97 03d661d8 Stavros Sachtouris
A simple way to create the configuration file is to set a configuration option using the kamaki config command. For example:
98 03d661d8 Stavros Sachtouris
99 03d661d8 Stavros Sachtouris
.. code-block:: console
100 0c24b26b Stavros Sachtouris
101 7ae842c2 Stavros Sachtouris
    $ kamaki config set token myT0k3N==
102 0c24b26b Stavros Sachtouris
103 7ae842c2 Stavros Sachtouris
In the above example, if the kamaki configuration file does not exist, it will be created with all the default values plus the *global.token* option set to *myT0k3n==* value.
104 0c24b26b Stavros Sachtouris
105 7536c9bf Stavros Sachtouris
The configuration file is formatted so that it can be parsed by the python ConfigParser module. It consists of command sections that are denoted with brackets. Every section contains variables with values. For example::
106 0c24b26b Stavros Sachtouris
107 7536c9bf Stavros Sachtouris
    [store]
108 7536c9bf Stavros Sachtouris
    url=https://okeanos.grnet.gr/pithos
109 7ae842c2 Stavros Sachtouris
    token=my0th3rT0k3n==
110 0c24b26b Stavros Sachtouris
111 7ae842c2 Stavros Sachtouris
two configuration options are created: *store.url* and *store.token*. These values will be loaded at every future kamaki execution.
112 0c24b26b Stavros Sachtouris
113 0c24b26b Stavros Sachtouris
Available options
114 0c24b26b Stavros Sachtouris
^^^^^^^^^^^^^^^^^
115 0c24b26b Stavros Sachtouris
116 7ae842c2 Stavros Sachtouris
The [global] group is treated by kamaki as a generic group for arbitrary options, and it is used as a super-group for vital Kamaki options, namely token, url, cli. In case of conflict, the most specific options overrides the global ones.
117 0c24b26b Stavros Sachtouris
118 0c24b26b Stavros Sachtouris
* global.colors <on|off>
119 7536c9bf Stavros Sachtouris
    enable / disable colors in command line based uis. Requires ansicolors, otherwise it is ignored
120 0c24b26b Stavros Sachtouris
121 85e3803d Stavros Sachtouris
* global.token <user authentication token>
122 0c24b26b Stavros Sachtouris
123 0c24b26b Stavros Sachtouris
* store.cli <UI command specifications for store>
124 0c24b26b Stavros Sachtouris
    a special package that is used to load storage commands to kamaki UIs. Don't touch this unless if you know what you are doing.
125 0c24b26b Stavros Sachtouris
126 0c24b26b Stavros Sachtouris
* store.url <OOS storage or Pithos+ service url>
127 0c24b26b Stavros Sachtouris
    the url of the OOS storage or Pithos+ service. Set to Okeanos.grnet.gr Pithos+ storage service by default. Users should set a different value if they need to use a different storage service.
128 0c24b26b Stavros Sachtouris
129 f5d9bc54 Stavros Sachtouris
* store.token <token>
130 f5d9bc54 Stavros Sachtouris
    it set, it overrides possible global.token option for store level commands
131 f5d9bc54 Stavros Sachtouris
132 0c24b26b Stavros Sachtouris
* compute.url <OOS compute or Cyclades service url>
133 0c24b26b Stavros Sachtouris
    the url of the OOS compute or Cyclades service. Set to Okeanos.grnet.gr Cyclades IaaS service by default. Users should set a different value if they need to use a different IaaS service.
134 0c24b26b Stavros Sachtouris
135 0c24b26b Stavros Sachtouris
* cyclades.cli <UI command specifications for cyclades>
136 0c24b26b Stavros Sachtouris
    a special package that is used to load cyclades commands to kamaki UIs. Don't touch this unless you know what you are doing.
137 0c24b26b Stavros Sachtouris
138 0c24b26b Stavros Sachtouris
* flavor.cli <UI command specifications for VM flavors>
139 0c24b26b Stavros Sachtouris
    a special package that is used to load cyclades VM flavor commands to kamaki UIs. Don't touch this unless you know what you are doing.
140 0c24b26b Stavros Sachtouris
141 0c24b26b Stavros Sachtouris
* network.cli <UI command specifications for virtual networks>
142 0c24b26b Stavros Sachtouris
    a special package that is used to load cyclades virtual network commands to kamaki UIs. Don't touch this unless you know what you are doing.
143 0c24b26b Stavros Sachtouris
144 d88ba587 Stavros Sachtouris
* image.url <Plankton image service url>
145 573be34f Stavros Sachtouris
    the url of the Plankton service. Set to Okeanos.grnet.gr Plankton service by default. Users should set a different value if they need to use a different service. Note that the *image compute* commands are depended on the compute.url instead.
146 0c24b26b Stavros Sachtouris
147 573be34f Stavros Sachtouris
* image.cli <UI command specifications for Plankton (and Compute) image service>
148 0c24b26b Stavros Sachtouris
    a special package that is used to load image-related commands to kamaki UIs. Don't touch this unless you know what you are doing.
149 0c24b26b Stavros Sachtouris
150 0c24b26b Stavros Sachtouris
* astakos.url <Astakos authentication service url>
151 0c24b26b Stavros Sachtouris
    the url of the Astakos authentication service. Set to the Okeanos.grnet.gr Astakos service by default. Users should set a different value if they need to use a different service.
152 0c24b26b Stavros Sachtouris
153 0c24b26b Stavros Sachtouris
* astakos.cli <UI command specifications for Astakos authentication service>
154 329753ae Stavros Sachtouris
    a special package that is used to load astakos-related commands to kamaki UIs. Don't touch this unless you know what you are doing.
155 329753ae Stavros Sachtouris
156 a6370d73 Stavros Sachtouris
* history.file <history file path>
157 7536c9bf Stavros Sachtouris
    the path of a simple file for inter-session kamaki history. Make sure kamaki is executed in a context where this file is accessible for reading and writing. Kamaki automatically creates the file if it doesn't exist
158 a6370d73 Stavros Sachtouris
159 c5b9380c Stavros Sachtouris
Additional features
160 c5b9380c Stavros Sachtouris
^^^^^^^^^^^^^^^^^^^
161 c5b9380c Stavros Sachtouris
162 c5b9380c Stavros Sachtouris
Richer connection logs
163 c5b9380c Stavros Sachtouris
""""""""""""""""""""""
164 c5b9380c Stavros Sachtouris
165 c5b9380c Stavros Sachtouris
Kamaki logs down the http requests and responses in /var/log/kamaki/clients.log (make sure it is accessible). The request and response data and user authentication information is excluded from the logs be default. The former may render the logs unreadable and the later are sensitive information. Users my activate data and / or token logging my setting the global options log_data and log_token respectively::
166 c5b9380c Stavros Sachtouris
167 c5b9380c Stavros Sachtouris
    $ kamaki config set log_data on
168 c5b9380c Stavros Sachtouris
    $ kamaki config set log_token on
169 c5b9380c Stavros Sachtouris
170 c5b9380c Stavros Sachtouris
Either or both of these options may be switched off either by setting them to ``off`` or by deleting them.
171 c5b9380c Stavros Sachtouris
172 c5b9380c Stavros Sachtouris
    $ kamaki config set log_data off
173 c5b9380c Stavros Sachtouris
    $ kamaki config delete log_token
174 c5b9380c Stavros Sachtouris
175 c5b9380c Stavros Sachtouris
Set custom thread limit
176 c5b9380c Stavros Sachtouris
"""""""""""""""""""""""
177 c5b9380c Stavros Sachtouris
178 c5b9380c Stavros Sachtouris
Some operations (e.g. download and upload) may use threaded http connections for better performance. Kamaki.clients utilizes a sophisticated mechanism for dynamically adjusting the number of simultaneous threads running, but users may wish to enforce their own upper thread limit. In that case, the max_threads option may be set to the configuration file::
179 c5b9380c Stavros Sachtouris
180 c5b9380c Stavros Sachtouris
    $ kamaki config set max_threads 3
181 c5b9380c Stavros Sachtouris
182 c5b9380c Stavros Sachtouris
If the value is not a positive integer, kamaki will ignore it and a warning message will be logged.
183 329753ae Stavros Sachtouris
184 f5f2dc53 Stavros Sachtouris
The livetest suite
185 f5f2dc53 Stavros Sachtouris
""""""""""""""""""
186 329753ae Stavros Sachtouris
187 f5f2dc53 Stavros Sachtouris
Kamaki contains a live test suite for the kamaki.clients API, where "live" means that the tests are performed against active services that up and running. The live test package is named "livetest", it is accessible as kamaki.clients.livetest and it is designed to check the actual relation between kamaki and synnefo services.
188 329753ae Stavros Sachtouris
189 f5f2dc53 Stavros Sachtouris
The livetest suite can be activated with the following option on the configuration file::
190 f5d9bc54 Stavros Sachtouris
191 f5f2dc53 Stavros Sachtouris
    [livetest]
192 f5f2dc53 Stavros Sachtouris
    cli=livetest_cli
193 f5f2dc53 Stavros Sachtouris
194 f5f2dc53 Stavros Sachtouris
In most tests, livetest will run as long as an Astakos identity manager service is accessible and kamaki is set up to authenticate a valid token on this server.
195 f5f2dc53 Stavros Sachtouris
196 f5f2dc53 Stavros Sachtouris
In specific, a setup file needs at least the following mandatory settings in the configuration file:
197 f5f2dc53 Stavros Sachtouris
198 f5f2dc53 Stavros Sachtouris
* If authentication information is used for default kamaki clients::
199 f5f2dc53 Stavros Sachtouris
200 f5f2dc53 Stavros Sachtouris
    [astakos]
201 f5f2dc53 Stavros Sachtouris
    url=<Astakos Identity Manager URL>
202 f5f2dc53 Stavros Sachtouris
    token=<A valid user token>
203 f5f2dc53 Stavros Sachtouris
204 f5f2dc53 Stavros Sachtouris
* else if this authentication information is only for testing add this under [livetest]::
205 f5f2dc53 Stavros Sachtouris
206 f5f2dc53 Stavros Sachtouris
    astakos_url=<Astakos Identity Manager URL>
207 f5f2dc53 Stavros Sachtouris
    astakos_token=<A valid user token>
208 f5f2dc53 Stavros Sachtouris
209 f5f2dc53 Stavros Sachtouris
Each service tested in livetest might need some more options under the [livetest] label, as shown bellow:
210 f5f2dc53 Stavros Sachtouris
211 f5f2dc53 Stavros Sachtouris
* kamaki livetest astakos::
212 f5f2dc53 Stavros Sachtouris
213 f5f2dc53 Stavros Sachtouris
    astakos_email = <The valid email of testing user>
214 f5f2dc53 Stavros Sachtouris
    astakos_name = <The exact "real" name of testing user>
215 f5f2dc53 Stavros Sachtouris
    astakos_username = <The username of the testing user>
216 f5f2dc53 Stavros Sachtouris
    astakos_uuid = <The valid unique user id of the testing user>
217 f5f2dc53 Stavros Sachtouris
218 f5f2dc53 Stavros Sachtouris
* kamaki livetest pithos::
219 f5f2dc53 Stavros Sachtouris
220 f5f2dc53 Stavros Sachtouris
    astakos_uuid = <The valid unique user id of the testing user>
221 f5f2dc53 Stavros Sachtouris
222 f5f2dc53 Stavros Sachtouris
* kamaki livetest cyclades / image::
223 f5f2dc53 Stavros Sachtouris
224 f5f2dc53 Stavros Sachtouris
    image_id = <A valid image id used for testing>
225 f5f2dc53 Stavros Sachtouris
    image_local_path = <The local path of the testing image>
226 f5f2dc53 Stavros Sachtouris
    image_details = <A text file containing testing image details in a python dict>
227 f5f2dc53 Stavros Sachtouris
228 f5f2dc53 Stavros Sachtouris
    - example image.details content:
229 f5f2dc53 Stavros Sachtouris
    {
230 f5f2dc53 Stavros Sachtouris
        u'id': u'b3e68235-3abd-4d60-adfe-1379a4f8d3fe',
231 f5f2dc53 Stavros Sachtouris
        u'metadata': {
232 f5f2dc53 Stavros Sachtouris
            u'values': {
233 f5f2dc53 Stavros Sachtouris
                u'description': u'Debian 6.0.6 (Squeeze) Base System',
234 f5f2dc53 Stavros Sachtouris
                u'gui': u'No GUI',
235 f5f2dc53 Stavros Sachtouris
                u'kernel': u'2.6.32',
236 f5f2dc53 Stavros Sachtouris
                u'os': u'debian',
237 f5f2dc53 Stavros Sachtouris
                u'osfamily': u'linux',
238 f5f2dc53 Stavros Sachtouris
                u'root_partition': u'1',
239 f5f2dc53 Stavros Sachtouris
                u'sortorder': u'1',
240 f5f2dc53 Stavros Sachtouris
                u'users': u'root'
241 f5f2dc53 Stavros Sachtouris
            }
242 f5f2dc53 Stavros Sachtouris
        },
243 f5f2dc53 Stavros Sachtouris
        u'name': u'Debian Base',
244 f5f2dc53 Stavros Sachtouris
        u'progress': u'100',
245 f5f2dc53 Stavros Sachtouris
        u'status': u'ACTIVE',
246 f5f2dc53 Stavros Sachtouris
        u'created': u'2012-11-19T14:54:57+00:00',
247 f5f2dc53 Stavros Sachtouris
        u'updated': u'2012-11-19T15:29:51+00:00'
248 f5f2dc53 Stavros Sachtouris
    }
249 f5f2dc53 Stavros Sachtouris
250 f5f2dc53 Stavros Sachtouris
    flavor_details = <A text file containing the testing images' flavor details in a python dict>
251 f5f2dc53 Stavros Sachtouris
252 f5f2dc53 Stavros Sachtouris
    - example flavor.details content:
253 f5f2dc53 Stavros Sachtouris
    {
254 f5f2dc53 Stavros Sachtouris
        u'name': u'C1R1drbd',
255 f5f2dc53 Stavros Sachtouris
        u'ram': 1024,
256 f5f2dc53 Stavros Sachtouris
        u'id': 1,
257 f5f2dc53 Stavros Sachtouris
        u'SNF:disk_template': u'drbd',
258 f5f2dc53 Stavros Sachtouris
        u'disk': 20,
259 f5f2dc53 Stavros Sachtouris
        u'cpu': 1
260 f5f2dc53 Stavros Sachtouris
    }
261 f5f2dc53 Stavros Sachtouris
262 f5f2dc53 Stavros Sachtouris
After setup, kamaki can run all tests::
263 f5f2dc53 Stavros Sachtouris
264 f5f2dc53 Stavros Sachtouris
    $ kamaki livetest all
265 f5f2dc53 Stavros Sachtouris
266 f5f2dc53 Stavros Sachtouris
a specific test (e.g. astakos)::
267 f5f2dc53 Stavros Sachtouris
268 f5f2dc53 Stavros Sachtouris
    $ kamaki livetest astakos
269 f5f2dc53 Stavros Sachtouris
270 f5f2dc53 Stavros Sachtouris
or a specific method from a service (e.g. astakos authenticate)::
271 f5f2dc53 Stavros Sachtouris
272 f5f2dc53 Stavros Sachtouris
    $ kamaki livetest astakos authenticate
273 f5f2dc53 Stavros Sachtouris
274 f5f2dc53 Stavros Sachtouris
The quotaholder client
275 f5f2dc53 Stavros Sachtouris
""""""""""""""""""""""
276 f5f2dc53 Stavros Sachtouris
277 f5f2dc53 Stavros Sachtouris
A quotaholder client is introduced as an advanced feature. Quotaholder client is mostly used as a client library for accessing a synnefo quota service, but it can also be allowed as a kamaki command set, but setting the quotaholder.cli and quotaholder.url methods::
278 f5d9bc54 Stavros Sachtouris
279 f5d9bc54 Stavros Sachtouris
    [quotaholder]
280 f5d9bc54 Stavros Sachtouris
    cli=quotaholder_cli
281 f5d9bc54 Stavros Sachtouris
    url=<URL of quotaholder service>
282 f5f2dc53 Stavros Sachtouris
283 f5f2dc53 Stavros Sachtouris
Quotaholder is not tested in livetest
284 4054c46d Stavros Sachtouris
285 4054c46d Stavros Sachtouris
The unit testing system
286 4054c46d Stavros Sachtouris
"""""""""""""""""""""""
287 4054c46d Stavros Sachtouris
288 4054c46d Stavros Sachtouris
Kamaki container a set of finegrained unit tests for the kamaki.clients package. This set is not used when kamaki is running. Instead, it is aimed to developers who debug or extent the kamaki clients library. For more information, check the `Going Agile <developers/extending-clients-api.html#going-agile>`_ entry at the `developers section <developers/extending-clients-api.html>`_.