Statistics
| Branch: | Tag: | Revision:

root / docs / setup.rst @ 904091dd

History | View | Annotate | Download (18.8 kB)

1
Setup
2
=====
3

    
4
Kamaki is easy to install from source or as a package. Some advanced or ui features
5
are optional and can be installed separately. Kamaki behavior can be configured in
6
the kamaki config file.
7

    
8
Quick Setup
9
-----------
10

    
11
Existing kamaki users should consult the
12
`migration guide <#migrating-from-kamaki-0-8-x-to-0-9>`_ first.
13

    
14
Kamaki has to be configured to use a specific Synnefo deployment url and a user
15
token.
16

    
17
.. code-block:: console
18
    
19
    $ kamaki config set remote.default.url <cloud-authentication-URL>
20
    $ kamaki config set remote.default.token myt0k3n==
21

    
22
Since Synnefo version 0.14, a synnefo cloud remote UI offers a single
23
authentication URL, which can to be set as the default URL for kamaki. All
24
service-specific URLs are now retrieved and handled automatically. Users of
25
synnefo clouds >= 0.14 are advised against using any service-specific URLs.
26

    
27
Migrating from kamaki 0.8.X to 0.9
28
----------------------------------
29

    
30
This section refers to running installations of kamaki version <= 0.8.X
31
To check the current kamaki version:
32

    
33
.. code-block:: console
34

    
35
    $ kamaki -V
36

    
37
Existing kamaki users should convert their configuration files to v3. To do
38
that, kamaki 0.9 inspects the configuration file and suggests a list of config
39
file transformations, which are performed automatically on user permission.
40
This mechanism is invoked when the first API-related kamaki command is fired.
41
We suggest the `user authenticate` command, as shown on example 2.1.
42

    
43
.. code-block:: console
44
    :emphasize-lines: 1
45

    
46
    Example 2.1: Convert config file while authenticating user "exampleuser"
47

    
48
    $ kamaki user authenticate
49
    Config file format version >= 3.0 is required
50
    Configuration file "/home/exampleuser/.kamakirc" format is not up to date
51
    but kamaki can fix this:
52
    Calculating changes while preserving information
53
    ... rescue global.token => remote.default.token
54
    ... rescue config.cli => global.config_cli
55
    ... rescue history.file => global.history_file
56
    ... DONE
57
    The following information will NOT be preserved:
58
        global.account = 
59
        global.data_log = on
60
        user.account = exampleuser@example.com
61
        user.url = https://accounts.okeanos.grnet.gr
62
        compute.url = https://cyclades.okeanos.grnet.gr/api/v1.1
63
        file.url = https://pithos.okeanos.grnet.gr/v1
64
        image.url = https://cyclades.okeanos.grnet.gr/plankton
65

    
66
    Kamaki is ready to convert the config file to version 3.0
67
    Overwrite file /home/exampleuser/.kamakirc ? [Y, y]
68

    
69
At this point, we should examine the kamaki output. Most options are renamed to
70
be understood by the new kamaki.
71

    
72
Let's take a look at the discarded options:
73

    
74
* `global.account` and `user.account` are not used anymore.
75
    The same is true for the synonyms `store.account` and `pithos.account`.
76
    These options were used to explicitly set a user account or uuid to a
77
    pithos call. In the latest Synnefo version (>= 0.14), these features are
78
    meaningless and therefore omitted.
79

    
80
* `global.data_log` option has never been a valid kamaki config option.
81
    In this example, the user accidentally misspelled the terms `log_data`
82
    (which is a valid kamaki config option) as `data_log`. To fix this, the
83
    user should set the correct option after the conversion is complete
84
    (Example 2.2).
85

    
86
Users should press *y* when they are ready. Kamaki has now modified the default
87
config file to conform with kamaki config file v3. Now users should rescue
88
unrescued information (if any).
89

    
90
.. code-block:: console
91
    :emphasize-lines: 1
92

    
93
    Example 2.2: Rescue misspelled log_data option
94

    
95
    $ kamaki config set log_data on
96

    
97
In order to convert more files, users may run kamaki with the -c option, which
98
runs kamaki with a different configuration file (Example 2.3) and apply the
99
steps described above.
100

    
101
.. code-block:: console
102
    :emphasize-lines: 1
103

    
104
    Example 2.3: Use kamaki to update a configuration file called ".myfilerc"
105

    
106
    $ kamaki -c .myfilerc user authenticate
107

    
108
Multiple cloud remotes
109
----------------------
110

    
111
The following refers to users of multiple Synnefo and/or Open Stack
112
deployments. In the following, a Synnefo or Open Stack cloud deployment will
113
frequently be called as a **remote** or a **cloud remote**.
114

    
115
Kamaki supports accessing multiple cloud remotes from the same kamaki setup.
116
Bofore kamaki 0.9, this was possible only by using multiple config files. Since
117
0.9, kamaki supports multiple cloud remotes in the same configuration.
118

    
119
Each cloud remote corresponds to a Synnefo (or Open Stack) cloud deployment.
120
Since Synnefo version 0.14, each deployment offers a single point of
121
authentication, as an **authentication URL** and **token** pair. Users can
122
retrieve this information through the cloud UI.
123

    
124
Once a user has retrieved one URL/token pair per cloud remote, it is time to
125
assign a name to each cloud and let kamaki know about them.
126

    
127
For example, let the user have access to two remote clouds with the following authentication information ::
128

    
129
    cloud alias: devel
130
    authentication URL: https://devel.example.com/astakos/identity/v2.0/
131
    authentication token: myd3v3170k3n==
132

    
133
    cloud alias: testing
134
    autentication URL: https://testing.example.com/astakos/identity/v2.0/
135
    authentication token: my73571ng70k3n==
136

    
137
.. note:: the cloud alias is arbitrary and decided by the user. It is just a
138
    name to call a cloud setup in the kamaki context.
139

    
140
The user should let kamaki know about these setups:
141

    
142
.. code-block:: console
143

    
144
    $ kamaki config set remote.devel.url https://devel.example.com/astakos/identity/v2.0/
145
    $ kamaki config set remote.devel.token myd3v3170k3n==
146
    $
147
    $ kamaki config set remote.testing.url https://testing.example.com/astakos/identity/v2.0/
148
    $ kamaki config set remote.testing.token my73571ng70k3n==
149
    $
150

    
151
To check if all settings are loaded, a user may list all remotes, as shown
152
bellow:
153

    
154
.. code-block:: console
155

    
156
    $ kamaki config get remote
157
     remote.default.url = https://example.com/astakos.identity/v2.0/
158
     remote.default.url = myd3f4u1770k3n==
159
     remote.devel.url = https://devel.example.com/astakos/identity/v2.0/
160
     remote.devel.token = myd3v3170k3n==
161
     remote.testing.url = https://testing.example.com/astakos/identity/v2.0/
162
     remote.testing.token = my73571ng70k3n==
163
    $
164

    
165
or query kamaki for a specific cloud remote:
166

    
167
.. code-block:: console
168

    
169
    $ kamaki config get remote.devel
170
     remote.devel.url = https://devel.example.com/astakos/identity/v2.0/
171
     remote.devel.token = myd3v3170k3n==
172
    $
173

    
174
Now kamaki can use any of there remotes, with the **- - cloud** attribute. If
175
the **- - cloud** option is ommited, kamaki will query the `default` cloud remote.
176

    
177
One way to test this, is the `user athenticate` command:
178

    
179
.. code-block:: console
180

    
181
    $ kamaki --cloud=devel user authenticate
182
     ...
183
     user          : 
184
        id         :  725d5de4-1bab-45ac-9e98-38a60a8c543c
185
        name       :  Devel User
186
    $
187
    $ kamaki --cloud=testing user authenticate
188
     ...
189
     user          : 
190
        id         :  4ed5d527-bab1-ca54-89e9-c345c8a06a83
191
        name       :  Testing User
192
    $
193
    $ kamaki --cloud=default user authenticate
194
     ...
195
     user          : 
196
        id         :  4d3f4u17-u53r-4u7h-451n-4u7h3n7ic473
197
        name       :  Default User
198
    $
199
    $ kamaki user authenticate
200
     ...
201
     user          : 
202
        id         :  4d3f4u17-u53r-4u7h-451n-4u7h3n7ic473
203
        name       :  Default User
204
    $
205

    
206
In interactive cell, the cloud remote is picked when invoking the shell, with
207
the **- - cloud** option.
208

    
209
Optional features
210
-----------------
211

    
212
For installing any or all of the following, consult the
213
`kamaki installation guide <installation.html#install-ansicolors>`_
214

    
215
* ansicolors
216
    * Make command line / console user interface responses prettier with text formating (colors, bold, etc.)
217
    * Can be switched on/off in kamaki configuration file: colors=on/off
218
    * Has not been tested on non unix / linux based platforms
219

    
220
* mock 
221
    * For kamaki contributors only
222
    * Allow unittests to run on kamaki.clients package
223
    * Needs mock version 1.X or better
224

    
225
* astakosclient
226
    * For advanced users mostly
227
    * Allows the use of a full astakos command line client
228

    
229
Any of the above features can be installed at any time before or after kamaki installation.
230

    
231
Configuration options
232
---------------------
233

    
234
There are two kinds of configuration options:
235

    
236
* kamaki-related (global)
237
    interface settings and constants of the kamaki internal mechanism, e.g.
238
    colors in the output, maximum threads per connection, custom logging or
239
    history files, etc.
240

    
241
* cloud-related (remote.XXX)
242
    information needed to connect and use one or more remote clouds. There are
243
    some mandatory options (url, token) and some advanced / optional (e.g.
244
    service-specific url overrides or versions)
245

    
246
Kamaki comes with preset default values to all kamaki-releated configuration
247
options. Cloud-related information is not included in presets and should be
248
provided. Kamaki-related options can also be modified.
249

    
250
There are two ways of managing configuration options: edit the config file or
251
use the kamaki config command.
252

    
253
Using multiple configuration files
254
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
255

    
256
Kamaki setups are stored in configuration files. By default, a Kamaki
257
installation stores options in *.kamakirc* file located at the user home
258
directory.
259

    
260

    
261
If a user needs to switch between different kamaki-related setups, Kamaki can
262
explicitly load configuration files with the **- - config** (or **- c**)
263
option:
264

    
265
.. code-block:: console
266

    
267
    $ kamaki --config <custom_config_file_path> [other options]
268

    
269
.. note:: For access to multiple cloud remotes, users do NOT need to create
270
    multiple configuration files. Instead, we suggest using a single
271
    configuration file with multiple remote setups. More details can be found
272
    at the `multiple remotes guide <#multiple-cloud-remotes>`_.
273

    
274
Modifying options at runtime
275
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
276

    
277
All kamaki commands can be used with the -o option in order to override configuration options at runtime. For example::
278

    
279
.. code-block:: console
280

    
281
    $ kamaki file list -o global.pithos_container=anothercontainer
282

    
283
will invoke *kamaki file list* with the specified options, but the initial
284
global.pithos_container values will not be modified.
285

    
286
Editing options
287
^^^^^^^^^^^^^^^
288

    
289
Kamaki config command allows users to see and manage all configuration options.
290

    
291
* kamaki config list
292
    lists all configuration options currently used by a Kamaki installation
293

    
294
* kamaki config get <group.option>
295
    show the value of a specific configuration option. Options must be of the
296
    form *group.option*. The term *option* is equivalent to *global.option*
297

    
298
* kamaki config set <group.option> <value>
299
    set the group.option to value. If no group is given, the defaults to
300
    *global*
301

    
302
* kamaki config delete <group.option>
303
    delete a configuration option. If no group is given, the defaults to
304
    *global*
305

    
306
The above commands cause option values to be permanently stored in the Kamaki configuration file.
307

    
308
The commands above can also be used for **cloud remotes** handling, using the
309
`remote.` prefix. The remote handling cases are similar but with slightly
310
different semantics:
311

    
312
* kamaki config get remote[.<cloud alias>[.option]]
313
    * remote
314
        list all cloud remotes (including `default`) and their settings
315
    * remote.<cloud alias>
316
        list settings of the cloud remote aliased as <cloud alias>. If no
317
        special is configured, use the term `remote.default`
318
    * remote.<cloud alias>.<option>
319
        show the value of the specified option. If no special alias is
320
        configured, use `remote.default.<option>`
321

    
322
* kamaki config set remote.<cloud alias>.<option> <value>
323
    If the remote alias <cloud alias> does not exist, create it. Then, create
324
    (or update) the option <option> of this cloud remote, by setting its value
325
    to <value>.
326

    
327
* kamaki config delete remote.<cloud alias>[.<option>]
328
    * remote.<cloud alias>
329
        delete the cloud alias <cloud alias> and all its options
330
    * remote.<cloud alias>.<option>
331
        delete the <option> and its value from the cloud remote aliased as
332
        <cloud alias>
333

    
334
Editing the configuration file
335
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336

    
337
The configuration file is a simple text file that can be created by the user.
338

    
339
.. note:: users of kamaki < 0.9 can use kamaki 0.9.X to automatically convert
340
    their old configuration files to the new config file version (>= 3.0). To
341
    do this, follow `these instructions <#migrating-from-kamaki-0-8-x-to-0-9>`_
342
    
343
A simple way to create the configuration file is to set a configuration option
344
using the kamaki config command. For example:
345

    
346
.. code-block:: console
347

    
348
    $ kamaki config set global.log_file /home/exampleuser/logs/kamaki.log
349

    
350
In the above example, if the kamaki configuration file does not exist, it will
351
be created with all the default values plus the *global.log_file* option set to
352
`/home/exampleuser/logs/kamaki.log`
353

    
354
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::
355

    
356
    [global]
357
    log_file = /home/exampleuser/logs/kamaki.log
358
    max_threads = 7
359
    colors = off
360

    
361
    [remote "default"]
362
    url =
363
    token =
364

    
365
A bunch of configuration options are created and set to their default options,
366
except the log_file option which is set to whatever the specified value.
367

    
368
The [remote "default"] section is special and is used to configure the default
369
cloud remote. Kamaki will not be able to run without setting the url and token
370
values to that section.
371

    
372
More cloud remotes can be created  on the side of the default remote, e.g
373
using the examples at the `multiple remotes guide <#multiple-cloud-remotes>`_::
374

    
375
    [remote "devel"]
376
    url = https://devel.example.com/astakos/identity/v2.0/
377
    token = myd3v3170k3n==
378

    
379
    [remote "testing"]
380
    url = https://testing.example.com/astakos/identity/v2.0/
381
    token = my73571ng70k3n==
382

    
383
Available options
384
^^^^^^^^^^^^^^^^^
385

    
386
The [global] group is treated by kamaki as a generic group for kamaki-related
387
settings, namely command cli specifications, the thread limit, console colors,
388
history and log files, log detail options and pithos-specific options.
389

    
390
* global.colors <on|off>
391
    enable / disable colors in command line based uis. Requires ansicolors, otherwise it is ignored
392

    
393
* global.log_file <logfile full path>
394
    set a custom location for kamaki logging. Default value is ~/.kamaki.log
395

    
396
* global.log_token <on|off>
397
    allow kamaki to log user tokens
398

    
399
* global.log_data <on|off>
400
    allow kamaki to log http data (by default, it logs only method, URL and
401
    headers)
402

    
403
* global.file_cli <UI command specifications for file>
404
    a special package that is used to load storage commands to kamaki UIs.
405
    Don't touch this unless if you know what you are doing.
406

    
407
* global.cyclades_cli <UI command specifications for cyclades>
408
    a special package that is used to load cyclades commands to kamaki UIs.
409
    Don't touch this unless you know what you are doing.
410

    
411
* global.flavor_cli <UI command specifications for VM flavors>
412
    a special package that is used to load cyclades VM flavor commands to
413
    kamaki UIs. Don't touch this unless you know what you are doing.
414

    
415
* global.network_cli <UI command specifications for virtual networks>
416
    a special package that is used to load cyclades virtual network commands to
417
    kamaki UIs. Don't touch this unless you know what you are doing.
418

    
419
* global.image_cli <UI command specs for Plankton or Compute image service>
420
    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.
421

    
422
* global.user_cli <UI command specs for Astakos authentication service>
423
    a special package that is used to load astakos-related commands to kamaki
424
    UIs. Don't touch this unless you know what you are doing.
425

    
426
* global.history_file <history file path>
427
    the path of a simple file for inter-session kamaki history. Make sure
428
    kamaki is executed in a context where this file is accessible for reading
429
    and writing. Kamaki automatically creates the file if it doesn't exist
430

    
431
Additional features
432
^^^^^^^^^^^^^^^^^^^
433

    
434
The livetest suite
435
""""""""""""""""""
436

    
437
Kamaki contains a live test suite for the kamaki.clients API, where "live"
438
means that the tests are performed against active services that up and running.
439
The live test package is named "livetest", it is accessible as kamaki.clients.
440
livetest and it is designed to check the actual relation between kamaki and
441
synnefo services.
442

    
443
The livetest suite can be activated with the following option on the configuration file::
444

    
445
    [global]
446
    livetest_cli=livetest
447

    
448
or with this kamaki command::
449

    
450
    kamaki config set livetest_cli livetest
451

    
452
In most tests, livetest will run as long as the default remote is configured
453
correctly. Some commands, though, need some extra settings related to the cloud
454
the test is performed against, or the example files used in kamaki.
455

    
456
Here is a list of settings needed:
457

    
458
* for all tests::
459
    * livetest.testremote = <the cloud alias this test will run against>
460

    
461
* for astakos client::
462
    * livetest.astakos_details = <A file with an authentication output>
463
        To create this file, pipeline the output of an authentication command
464
        with the -j option for raw jason output
465

    
466
        .. code-block:: console
467

    
468
            $ kamaki user authenticate -j > astakos.details
469

    
470
    * livetest.astakos_name = <The exact "real" name of testing user>
471
    * livetest.astakos_id = <The valid unique user id of the testing user>
472

    
473
* for image client:
474
    * livetest.image_details = <A file with the image's metadata>
475
        To create this file, pipeline the output of an image metadata command
476
        with the -j option for raw jason output
477

    
478
        .. code-block:: console
479

    
480
            $ kamaki image meta <img id> -j > img.details
481

    
482
    * livetest.image_id = <A valid image id used for testing>
483
    * livetest.image_local_path = <The local path of the testing image>
484

    
485
* for flavors (part of the compute client):
486
    * livetest.flavor_details = <A file with the flavor details>
487
        To create this file, pipeline the output of a flavor info command
488
        with the -j option for raw jason output
489

    
490
        .. code-block:: console
491

    
492
            $ kamaki flavor info <flavor id> -j > flavor.details
493

    
494

    
495
After setup, kamaki can run all tests::
496

    
497
    $ kamaki livetest all
498

    
499
a specific test (e.g. astakos)::
500

    
501
    $ kamaki livetest astakos
502

    
503
or a specific method from a service (e.g. astakos authenticate)::
504

    
505
    $ kamaki livetest astakos authenticate
506

    
507
The unit testing system
508
"""""""""""""""""""""""
509

    
510
Kamaki container a set of finegrained unit tests for the kamaki.clients
511
package. This set is not used when kamaki is running. Instead, it is aimed to
512
developers who debug or extent the kamaki clients library. For more
513
information, check the
514
`Going Agile <developers/extending-clients-api.html#going-agile>`_ entry at the
515
`developers section <developers/extending-clients-api.html>`_.