Statistics
| Branch: | Tag: | Revision:

root / docs / setup.rst @ ef04bdeb

History | View | Annotate | Download (19.1 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 for a specific Synnefo deployment, with an
15
authentication url and user token pair. Users should also pick an alias to name
16
the cloud configuration. This can be any single word, e.g. "default", "mycloud"
17
or whatever suits kamaki users.
18

    
19
.. code-block:: console
20
    
21
    $ kamaki config set cloud.<cloud alias>.url <cloud-authentication-URL>
22
    $ kamaki config set cloud.<cloud alias>.token myt0k3n==
23

    
24
If only one cloud is configured, kamaki automatically picks it as the default.
25
Otherwise, a default cloud should be specified:
26

    
27
.. code-block:: console
28

    
29
    $ kamaki config set default_cloud <cloud alias>
30

    
31
Since Synnefo version 0.14, a synnefo cloud UI offers a single authentication
32
URL, which should be set as the cloud URL for kamaki. All service-specific URLs
33
are retrieved and handled automatically by kamaki, through this URL. Users of
34
synnefo clouds >=0.14 are advised against using any service-specific URLs.
35

    
36
Migrating from kamaki 0.8.X to 0.9
37
----------------------------------
38

    
39
This section refers to running installations of kamaki version <= 0.8.X To
40
check the current kamaki version:
41

    
42
.. code-block:: console
43

    
44
    $ kamaki -V
45

    
46
Existing kamaki users should convert their configuration files to v9. To do
47
that, kamaki 0.9 can inspect the configuration file and suggests a list of
48
config file transformations, which are performed automatically (after users'
49
permission). This mechanism is invoked when an API-related kamaki command is
50
fired. On example 2.1 we suggest using the `user authenticate` command to fire
51
the kamaki config file conversion mechanism.
52

    
53
.. code-block:: console
54
    :emphasize-lines: 1
55

    
56
    Example 2.1: Convert config file while authenticating user "exampleuser"
57

    
58
    $ kamaki user authenticate
59
    Config file format version >= 9.0 is required
60
    Configuration file: "/home/exampleuser/.kamakirc"
61
    but kamaki can fix this:
62
    Calculating changes while preserving information
63
    ... rescue global.token => cloud.default.token
64
    ... rescue config.cli => global.config_cli
65
    ... rescue history.file => global.history_file
66
    ... DONE
67
    The following information will NOT be preserved:
68
        global.account = 
69
        global.data_log = on
70
        user.account = exampleuser@example.com
71
        user.url = https://accounts.okeanos.grnet.gr
72
        compute.url = https://cyclades.okeanos.grnet.gr/api/v1.1
73
        file.url = https://pithos.okeanos.grnet.gr/v1
74
        image.url = https://cyclades.okeanos.grnet.gr/plankton
75

    
76
    Kamaki is ready to convert the config file to version 9.0
77
    Overwrite file /home/exampleuser/.kamakirc ? [Y, y]
78

    
79
At this point, we should examine the kamaki output. Most options are renamed to
80
be understood by the new kamaki.
81

    
82
Let's take a look at the discarded options:
83

    
84
* `global.account` and `user.account` are not used anymore.
85
    The same is true for the synonyms `store.account` and `pithos.account`.
86
    These options were used to explicitly set a user account or uuid to a
87
    pithos call. In the latest Synnefo version (>= 0.14), these features are
88
    meaningless and therefore omitted.
89

    
90
* `global.data_log` option has never been a valid kamaki config option.
91
    In this example, the user accidentally misspelled the term `log_data`
92
    (which is a valid kamaki config option) as `data_log`. To fix this, the
93
    user should set the correct option after the conversion is complete
94
    (Example 2.2).
95

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

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

    
103
    Example 2.2: Rescue misspelled log_data option
104

    
105
    $ kamaki config set log_data on
106

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

    
111
.. code-block:: console
112
    :emphasize-lines: 1
113

    
114
    Example 2.3: Use kamaki to update a configuration file called ".myfilerc"
115

    
116
    $ kamaki -c .myfilerc user authenticate
117

    
118
Multiple clouds
119
---------------
120

    
121
The following refers to users of multiple Synnefo and/or Open Stack
122
deployments. In the following, a Synnefo or Open Stack cloud deployment will
123
frequently be called as a **cloud**.
124

    
125
Kamaki supports accessing multiple clouds from the same kamaki setup. Before
126
kamaki 0.9, this was possible only by using multiple config files. Since 0.9,
127
kamaki supports multiple clouds in the same configuration.
128

    
129
Each cloud corresponds to a Synnefo (or Open Stack) cloud deployment.
130
Since Synnefo version 0.14, each deployment offers a single point of
131
authentication, as an **authentication URL** and **token** pair. Users can
132
retrieve this information through the cloud UI.
133

    
134
Once a user has retrieved one URL/token pair per cloud, it is time to assign a
135
name to each cloud and let kamaki know about them.
136

    
137
For example, let the user have access to two clouds with the following authentication information ::
138

    
139
    cloud alias: devel
140
    authentication URL: https://devel.example.com/astakos/identity/v2.0/
141
    authentication token: myd3v3170k3n==
142

    
143
    cloud alias: testing
144
    autentication URL: https://testing.example.com/astakos/identity/v2.0/
145
    authentication token: my73571ng70k3n==
146

    
147
.. note:: the cloud alias is arbitrary and decided by the user. It is just a
148
    name to call a cloud setup in the kamaki context.
149

    
150
The user should let kamaki know about these setups:
151

    
152
.. code-block:: console
153

    
154
    $ kamaki config set cloud.devel.url https://devel.example.com/astakos/identity/v2.0/
155
    $ kamaki config set cloud.devel.token myd3v3170k3n==
156
    $
157
    $ kamaki config set cloud.testing.url https://testing.example.com/astakos/identity/v2.0/
158
    $ kamaki config set cloud.testing.token my73571ng70k3n==
159
    $
160

    
161
To check if all settings are loaded, a user may list all clouds, as shown
162
bellow:
163

    
164
.. code-block:: console
165

    
166
    $ kamaki config getcloud 
167
     cloud.default.url = https://example.com/astakos.identity/v2.0/
168
     cloud.default.url = myd3f4u1770k3n==
169
     cloud.devel.url = https://devel.example.com/astakos/identity/v2.0/
170
     cloud.devel.token = myd3v3170k3n==
171
     cloud.testing.url = https://testing.example.com/astakos/identity/v2.0/
172
     cloud.testing.token = my73571ng70k3n==
173
    $
174

    
175
or query kamaki for a specific cloud:
176

    
177
.. code-block:: console
178

    
179
    $ kamaki config get cloud.devel
180
     cloud.devel.url = https://devel.example.com/astakos/identity/v2.0/
181
     cloud.devel.token = myd3v3170k3n==
182
    $
183

    
184
Now kamaki can use any of these clouds, with the **- - cloud** attribute. If
185
the **- - cloud** option is ommited, kamaki will query the `default` cloud.
186

    
187
One way to test this, is the `user athenticate` command:
188

    
189
.. code-block:: console
190

    
191
    $ kamaki --cloud=devel user authenticate
192
     ...
193
     user          : 
194
        id         :  725d5de4-1bab-45ac-9e98-38a60a8c543c
195
        name       :  Devel User
196
    $
197
    $ kamaki --cloud=testing user authenticate
198
     ...
199
     user          : 
200
        id         :  4ed5d527-bab1-ca54-89e9-c345c8a06a83
201
        name       :  Testing User
202
    $
203
    $ kamaki --cloud=default user authenticate
204
     ...
205
     user          : 
206
        id         :  4d3f4u17-u53r-4u7h-451n-4u7h3n7ic473
207
        name       :  Default User
208
    $
209
    $ kamaki user authenticate
210
     ...
211
     user          : 
212
        id         :  4d3f4u17-u53r-4u7h-451n-4u7h3n7ic473
213
        name       :  Default User
214
    $
215

    
216
In interactive cell, the cloud is picked when invoking the shell, with
217
the **- - cloud** option.
218

    
219
Optional features
220
-----------------
221

    
222
For installing any or all of the following, consult the
223
`kamaki installation guide <installation.html#install-ansicolors>`_
224

    
225
* ansicolors
226
    * Add colors to command line / console output
227
    * Can be switched on/off in kamaki configuration file: `colors = on/off`
228
    * Has not been tested on non unix / linux based platforms
229

    
230
* mock 
231
    * For kamaki contributors only
232
    * Allow unit tests to run on kamaki.clients package
233
    * Needs mock version 1.X or better
234

    
235
* astakosclient
236
    * For advanced users mostly
237
    * Allows the use of a full astakos command line client
238

    
239
Any of the above features can be installed at any time before or after kamaki
240
installation.
241

    
242
Configuration options
243
---------------------
244

    
245
There are two kinds of configuration options:
246

    
247
* kamaki-related (global)
248
    interface settings and constants of the kamaki internal mechanism, e.g.
249
    colors in the output, maximum threads per connection, custom logging or
250
    history files, etc.
251

    
252
* cloud-related
253
    information needed to connect and use one or more clouds. There are some
254
    mandatory options (URL, token) and some advanced / optional (e.g.
255
    service-specific URL overrides or versions)
256

    
257
Kamaki comes with preset default values to all kamaki-releated configuration
258
options. Cloud-related information is not included in presets and should be
259
provided by the user. Kamaki-related options can also be modified.
260

    
261
There are two ways of managing configuration options: edit the config file or
262
use the kamaki config command.
263

    
264
Using multiple configuration files
265
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266

    
267
Kamaki setups are stored in configuration files. By default, a Kamaki
268
installation stores options in *.kamakirc* file located at the user home
269
directory.
270

    
271
If a user needs to switch between different kamaki-related setups, Kamaki can
272
explicitly load configuration files with the **- - config** (or **- c**) option
273

    
274
.. code-block:: console
275

    
276
    $ kamaki --config <custom_config_file_path> [other options]
277

    
278
.. note:: For accessing multiple clouds, users do NOT need to create multiple
279
    configuration files. Instead, we suggest using a single configuration file
280
    with multiple cloud setups. More details can be found at the
281
    `multiple clouds guide <#multiple-clouds>`_.
282

    
283
Modifying options at runtime
284
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
285

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

    
288
.. code-block:: console
289

    
290
    $ kamaki file list -o global.pithos_container=anothercontainer
291

    
292
will invoke *kamaki file list* with the specified options, but the initial
293
global.pithos_container values will not be modified.
294

    
295
Editing options
296
^^^^^^^^^^^^^^^
297

    
298
Kamaki config command allows users to see and manage all configuration options.
299

    
300
* kamaki config list
301
    lists all configuration options currently used by a Kamaki installation
302

    
303
* kamaki config get <group.option>
304
    show the value of a specific configuration option. Options must be of the
305
    form *group.option*. The term *option* is equivalent to *global.option*
306

    
307
* kamaki config set <group.option> <value>
308
    set the group.option to value. If no group is given, the defaults to
309
    *global*.
310

    
311
* kamaki config delete <group.option>
312
    delete a configuration option. If no group is given, the defaults to
313
    *global*
314

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

    
317
The commands above can also be used for **clouds** handling, using the `cloud.`
318
prefix. The cloud handling cases are similar but with slightly different
319
semantics:
320

    
321
* kamaki config get cloud[.<cloud alias>[.option]]
322
    * cloud 
323
        list all clouds and their settings
324
    * cloud.<cloud alias>
325
        list settings of the cloud aliased as <cloud alias>. If no
326
        special is configured, use the term `cloud.default`
327
    * cloud.<cloud alias>.<option>
328
        show the value of the specified option. If no special alias is
329
        configured, use `cloud.default.<option>`
330

    
331
* kamaki config set cloud.<cloud alias>.<option> <value>
332
    If the cloud alias <cloud alias> does not exist, create it. Then, create
333
    (or update) the option <option> of this cloud, by setting its value
334
    to <value>.
335

    
336
* kamaki config delete cloud.<cloud alias>[.<option>]
337
    * cloud.<cloud alias>
338
        delete the cloud alias <cloud alias> and all its options
339
    * cloud.<cloud alias>.<option>
340
        delete the <option> and its value from the cloud cloud aliased as
341
        <cloud alias>
342

    
343
.. note:: To see if a default cloud is configured, get the default_cloud value
344

    
345
    .. code-block:: console
346

    
347
        $ kamaki config get default_cloud
348

    
349
Editing the configuration file
350
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
351

    
352
The configuration file is a simple text file that can be created by the user.
353

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

    
361
.. code-block:: console
362

    
363
    $ kamaki config set global.log_file /home/exampleuser/logs/kamaki.log
364

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

    
369
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::
370

    
371
    [global]
372
    log_file = /home/exampleuser/logs/kamaki.log
373
    max_threads = 7
374
    colors = off
375

    
376
    [cloud "default"]
377
    url =
378
    token =
379

    
380
A bunch of configuration options are created and set to their default options,
381
except the log_file option which is set to whatever the specified value.
382

    
383
The [cloud "default"] section is special and is used to configure the default
384
cloud cloud. Kamaki will not be able to run without setting the url and token
385
values to that section.
386

    
387
More clouds can be created  on the side of the default cloud, e.g using the
388
examples at the `multiple clouds guide <#multiple-clouds>`_ ::
389

    
390
    [cloud "devel"]
391
    url = https://devel.example.com/astakos/identity/v2.0/
392
    token = myd3v3170k3n==
393

    
394
    [cloud "testing"]
395
    url = https://testing.example.com/astakos/identity/v2.0/
396
    token = my73571ng70k3n==
397

    
398
Available options
399
^^^^^^^^^^^^^^^^^
400

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

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

    
408
* global.log_file <logfile full path>
409
    set a custom location for kamaki logging. Default value is ~/.kamaki.log
410

    
411
* global.log_token <on|off>
412
    allow kamaki to log user tokens
413

    
414
* global.log_data <on|off>
415
    allow kamaki to log http data (by default, it logs only method, URL and
416
    headers)
417

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

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

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

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

    
434
* global.image_cli <UI command specs for Plankton or Compute image service>
435
    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.
436

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

    
441
* global.history_file <history file path>
442
    the path of a simple file for inter-session kamaki history. Make sure
443
    kamaki is executed in a context where this file is accessible for reading
444
    and writing. Kamaki automatically creates the file if it doesn't exist
445

    
446
Additional features
447
^^^^^^^^^^^^^^^^^^^
448

    
449
The livetest suite
450
""""""""""""""""""
451

    
452
Kamaki contains a live test suite for the kamaki.clients API, where "live"
453
means that the tests are performed against active services that up and running.
454
The live test package is named "livetest", it is accessible as kamaki.clients.
455
livetest and it is designed to check the actual relation between kamaki and
456
synnefo services.
457

    
458
The livetest suite can be activated with the following option on the configuration file::
459

    
460
    [global]
461
    livetest_cli=livetest
462

    
463
or with this kamaki command::
464

    
465
    kamaki config set livetest_cli livetest
466

    
467
In most tests, livetest will run as long as the default cloud is configured
468
correctly. Some commands, though, need some extra settings related to the cloud
469
the test is performed against, or the example files used in kamaki.
470

    
471
Here is a list of settings needed:
472

    
473
* for all tests::
474
    * livetest.testcloud = <the cloud alias this test will run against>
475

    
476
* for astakos client::
477
    * livetest.astakos_details = <A file with an authentication output>
478
        To create this file, pipeline the output of an authentication command
479
        with the -j option for raw jason output
480

    
481
        .. code-block:: console
482

    
483
            $ kamaki user authenticate -j > astakos.details
484

    
485
    * livetest.astakos_name = <The exact "real" name of testing user>
486
    * livetest.astakos_id = <The valid unique user id of the testing user>
487

    
488
* for image client:
489
    * livetest.image_details = <A file with the image's metadata>
490
        To create this file, pipeline the output of an image metadata command
491
        with the -j option for raw jason output
492

    
493
        .. code-block:: console
494

    
495
            $ kamaki image meta <img id> -j > img.details
496

    
497
    * livetest.image_id = <A valid image id used for testing>
498
    * livetest.image_local_path = <The local path of the testing image>
499

    
500
* for flavors (part of the compute client):
501
    * livetest.flavor_details = <A file with the flavor details>
502
        To create this file, pipeline the output of a flavor info command
503
        with the -j option for raw jason output
504

    
505
        .. code-block:: console
506

    
507
            $ kamaki flavor info <flavor id> -j > flavor.details
508

    
509

    
510
After setup, kamaki can run all tests::
511

    
512
    $ kamaki livetest all
513

    
514
a specific test (e.g. astakos)::
515

    
516
    $ kamaki livetest astakos
517

    
518
or a specific method from a service (e.g. astakos authenticate)::
519

    
520
    $ kamaki livetest astakos authenticate
521

    
522
The unit testing system
523
"""""""""""""""""""""""
524

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