Statistics
| Branch: | Tag: | Revision:

root / docs / setup.rst @ fa479dc3

History | View | Annotate | Download (16.2 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.
15

    
16
Since Synnefo version 0.14, each deployment offers a single authentication
17
url, which has to be set as the default url for kamaki (Example 1.1).
18

    
19
.. code-block:: console
20
    :emphasize-lines: 1, 2
21

    
22
    Example 1.1: Set https://astakos.example.com/astakos/identity/v2.0/ as the
23
    default single authentication url 
24
    
25
    $ kamaki config set remote.default.url https://astakos.example.com/astakos/identity/v2.0/
26

    
27
Kamaki also needs a user authentication token (Example 1.2).
28

    
29
.. code-block:: console
30
    :emphasize-lines: 1
31

    
32
    Example 1.2: Set user token to myt0k3n==
33

    
34
    $ kamaki config set remote.default.token myt0k3n==
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
40
To 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 v3. To do
47
that, kamaki 0.9 inspects the configuration file and suggests a list of config
48
file transformations, which are performed automatically on user permission.
49
This mechanism is invoked when the first API-releated kamaki command is fired.
50
We suggest the command of the example 2.1.
51

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

    
55
    Example 2.1: Try to authenticate user but convert config file instead
56

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

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

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

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

    
83
* global.account and user.account are not used anymore. The same is true for
84
    store.account and pithos.account which were ways to explicitly set a user
85
    account name to a pithos call. After the latest Synnefo evolutions, these
86
    features are meaningless and therefore omitted.
87

    
88
* global.data_log option has never been a valid kamaki config option. In this
89
    example, the user accidentally mixed the terms "log_data" (which is a valid
90
    kamaki config option) with "data_log". To fix this, the user should set the
91
    correct option after the conversion is complete (Example 2.2)
92

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

    
97
.. code-block:: console
98
    :emphasize-lines: 1
99

    
100
    Example 2.2: Rescue misspelled log_data option
101

    
102
    $ kamaki config set log_data on
103

    
104
In order to convert more files, users may run kamaki with the -c option
105
(Example 2.3) and apply the steps described above.
106

    
107
.. code-block:: console
108
    :emphasize-lines: 1
109

    
110
    Example 2.3: Use kamaki to update a configuration file called ".myfilerc"
111

    
112
    $ kamaki -c .myfilerc user authenticate
113

    
114
Optional features
115
-----------------
116

    
117
For installing any or all of the following, consult the
118
`kamaki installation guide <installation.html#install-ansicolors>`_
119

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

    
125
* mock 
126
    * For kamaki contributors only
127
    * Allow unittests to run on kamaki.clients package
128
    * Needs mock version 1.X or better
129

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

    
132
Configuration options
133
---------------------
134

    
135
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.
136

    
137
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.
138

    
139
Using multiple setups
140
^^^^^^^^^^^^^^^^^^^^^
141

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

    
144
If a user needs to switch between different setups, Kamaki can explicitly load configuration files with the --config option:
145

    
146
.. code-block:: console
147

    
148
    $ kamaki --config <custom_config_file_path> [other options]
149

    
150
Using many different configuration files for different cloud services is encouraged.
151

    
152
Modifying options at runtime
153
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154

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

    
157
.. code-block:: console
158

    
159
    $ kamaki file list -o global.account=anotheraccount -o global.token=aT0k3n==
160

    
161
will invoke *kamaki file list* with the specified options, but the initial global.account and global.token values will be restored to initial values afterwards.
162

    
163
.. note:: on-the-fly calls to file 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::
164

    
165
    $kamaki user authenticate aT0k3n==
166

    
167
Editing options
168
^^^^^^^^^^^^^^^
169

    
170
Kamaki config command allows users to see and manage all configuration options.
171

    
172
* kamaki config list
173
    lists all configuration options currently used by a Kamaki installation
174

    
175
* kamaki config get <group.option>
176
    show the value of a specific configuration option. Options must be of the form group.option
177

    
178
* kamaki config set <group.option> <value>
179
    set the group.option to value
180

    
181
* kamaki config delete <group.option>
182
    delete a configuration option
183

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

    
186
Editing the configuration file
187
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
188

    
189
The configuration file is a simple text file that can be created by the user.
190

    
191
A simple way to create the configuration file is to set a configuration option using the kamaki config command. For example:
192

    
193
.. code-block:: console
194

    
195
    $ kamaki config set token myT0k3N==
196

    
197
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.
198

    
199
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::
200

    
201
    [file]
202
    url=https://okeanos.grnet.gr/pithos
203
    token=my0th3rT0k3n==
204

    
205
two configuration options are created: *file.url* and *file.token*. These values will be loaded at every future kamaki execution.
206

    
207
Available options
208
^^^^^^^^^^^^^^^^^
209

    
210
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.
211

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

    
215
* global.token <user authentication token>
216

    
217
* global.log_file <logfile full path>
218
    set a custom location for kamaki logging. Default value is ~/.kamaki.log
219

    
220
* global.log_token <on|off>
221
    allow kamaki to log user tokens
222

    
223
* global.log_data <on|off>
224
    allow kamaki to log http data (by default, it logs only method, URL and headers)
225

    
226
* file.cli <UI command specifications for file>
227
    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.
228

    
229
* file.url <OOS storage or Pithos+ service url>
230
    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.
231

    
232
* file.token <token>
233
    it set, it overrides possible global.token option for file level commands
234

    
235
* compute.url <OOS compute or Cyclades service url>
236
    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.
237

    
238
* cyclades.cli <UI command specifications for cyclades>
239
    a special package that is used to load cyclades commands to kamaki UIs. Don't touch this unless you know what you are doing.
240

    
241
* flavor.cli <UI command specifications for VM flavors>
242
    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.
243

    
244
* network.cli <UI command specifications for virtual networks>
245
    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.
246

    
247
* image.url <Plankton image service url>
248
    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.
249

    
250
* image.cli <UI command specifications for Plankton (and Compute) image service>
251
    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.
252

    
253
* user.url <Astakos authentication service url>
254
    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.
255

    
256
* user.cli <UI command specifications for Astakos authentication service>
257
    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.
258

    
259
* history.file <history file path>
260
    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
261

    
262
Additional features
263
^^^^^^^^^^^^^^^^^^^
264

    
265
Log file location
266
"""""""""""""""""
267

    
268
Kamaki log file path is set by the following command::
269

    
270
    $ kamaki config set log_file <logfile path>
271

    
272
By default, kamaki logs at ~/.kamaki.log
273

    
274
When initialized, kamaki attempts to open one of these locations for writing, in the order presented above and uses the first accessible for appending logs. If the log_file option is set, kamaki prepends the value of this option to the logfile list, so the custom location will be the first one kamaki will attetmpt to log at.
275

    
276
Kamaki will not crush if the logging location is not accessible.
277

    
278
Richer connection logs
279
""""""""""""""""""""""
280

    
281
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::
282

    
283
    $ kamaki config set log_data on
284
    $ kamaki config set log_token on
285

    
286
Either or both of these options may be switched off either by setting them to ``off`` or by deleting them.
287

    
288
    $ kamaki config set log_data off
289
    $ kamaki config delete log_token
290

    
291
Set custom thread limit
292
"""""""""""""""""""""""
293

    
294
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::
295

    
296
    $ kamaki config set max_threads 3
297

    
298
If the value is not a positive integer, kamaki will ignore it and a warning message will be logged.
299

    
300
The livetest suite
301
""""""""""""""""""
302

    
303
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.
304

    
305
The livetest suite can be activated with the following option on the configuration file::
306

    
307
    [livetest]
308
    cli=livetest
309

    
310
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.
311

    
312
In specific, a setup file needs at least the following mandatory settings in the configuration file:
313

    
314
* If authentication information is used for default kamaki clients::
315

    
316
    [user]
317
    url=<Astakos Identity Manager URL>
318
    token=<A valid user token>
319

    
320
* else if this authentication information is only for testing add this under [livetest]::
321

    
322
    user_url=<Astakos Identity Manager URL>
323
    user_token=<A valid user token>
324

    
325
Each service tested in livetest might need some more options under the [livetest] label, as shown bellow:
326

    
327
* kamaki livetest astakos::
328

    
329
    astakos_email = <The valid email of testing user>
330
    astakos_name = <The exact "real" name of testing user>
331
    astakos_username = <The username of the testing user>
332
    astakos_uuid = <The valid unique user id of the testing user>
333

    
334
* kamaki livetest pithos::
335

    
336
    astakos_uuid = <The valid unique user id of the testing user>
337

    
338
* kamaki livetest cyclades / image::
339

    
340
    image_id = <A valid image id used for testing>
341
    image_local_path = <The local path of the testing image>
342
    image_details = <A text file containing testing image details in a python dict>
343

    
344
    - example image.details content:
345
    {
346
        u'id': u'b3e68235-3abd-4d60-adfe-1379a4f8d3fe',
347
        u'metadata': {
348
            u'values': {
349
                u'description': u'Debian 6.0.6 (Squeeze) Base System',
350
                u'gui': u'No GUI',
351
                u'kernel': u'2.6.32',
352
                u'os': u'debian',
353
                u'osfamily': u'linux',
354
                u'root_partition': u'1',
355
                u'sortorder': u'1',
356
                u'users': u'root'
357
            }
358
        },
359
        u'name': u'Debian Base',
360
        u'progress': u'100',
361
        u'status': u'ACTIVE',
362
        u'created': u'2012-11-19T14:54:57+00:00',
363
        u'updated': u'2012-11-19T15:29:51+00:00'
364
    }
365

    
366
    flavor_details = <A text file containing the testing images' flavor details in a python dict>
367

    
368
    - example flavor.details content:
369
    {
370
        u'name': u'C1R1drbd',
371
        u'ram': 1024,
372
        u'id': 1,
373
        u'SNF:disk_template': u'drbd',
374
        u'disk': 20,
375
        u'cpu': 1
376
    }
377

    
378
After setup, kamaki can run all tests::
379

    
380
    $ kamaki livetest all
381

    
382
a specific test (e.g. astakos)::
383

    
384
    $ kamaki livetest astakos
385

    
386
or a specific method from a service (e.g. astakos authenticate)::
387

    
388
    $ kamaki livetest astakos authenticate
389

    
390
The unit testing system
391
"""""""""""""""""""""""
392

    
393
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>`_.