File: use_cli.rst

package info (click to toggle)
murano 1%3A6.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,644 kB
  • sloc: python: 34,127; sh: 717; pascal: 269; makefile: 83
file content (587 lines) | stat: -rw-r--r-- 19,413 bytes parent folder | download | duplicates (3)
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
.. _use-cli:

=========
Using CLI
=========

This section provides murano end users with information on how they can use
the Application Catalog through the command-line interface (CLI).

Using python-muranoclient, the CLI client for murano, you can easily manage
your environments, packages, categories, and deploy environments.

.. toctree::
   :maxdepth: 1

   install_client

Manage environments
~~~~~~~~~~~~~~~~~~~

An environment is a set of logically connected applications that are grouped
together for an easy management. By default, each environment has a single
network for all its applications, and the deployment of the environment is
defined in a single heat stack. Applications in different environments are
always independent from one another.

An environment is a single unit of deployment. This means that you deploy not
an application but an environment that contains one or multiple applications.

Using CLI, you can easily perform such actions with an environment as
creating, renaming, editing, viewing, and others.

Create an environment
---------------------

To create an environment, use the following command specifying the
environment name:

.. code-block:: console

   $ murano environment-create <NAME>

Rename an environment
---------------------

To rename an environment, use the following command specifying the old name of
the environment or its ID and the new name:

.. code-block:: console

   $ murano environment-rename <OLD_NAME_OR_ID> <NEW_NAME>

Delete an environment
---------------------

To delete an environment, use the following command specifying the
environment name or ID:

.. code-block:: console

   $ murano environment-delete <NAME_OR_ID>

List deployments for an environment
-----------------------------------

To get a list of deployments for a particular environment, use the following
command specifying the environment name or ID:

.. code-block:: console

   $ murano deployment-list <NAME_OR_ID>

List the environments
---------------------

To get a list of all existing environments, run:

.. code-block:: console

   $ murano environment-list

Show environment object model
-----------------------------

To get a complete object model of the environment, run:

.. code-block:: console

   $ murano environment-model-show <ID>

To get some part of the environment model, run:

.. code-block:: console

   $ murano environment-model-show <ID> --path <PATH>

For example:

   $ murano environment-model-show 534bcf2f2fc244f2b94ad55ff0f24a42 --path /defaultNetworks/environment

To get a draft of an object model of environment in pending state, also
specify id of the session:

.. code-block:: console

   $ murano environment-model-show <ID> --path <PATH> --session-id <SESSION_ID>

Edit environment object model
-----------------------------

To edit an object model of the environment, run:

.. code-block:: console

   $ murano environment-model-edit <ID> <FILE> --session-id <SESSION_ID>

<FILE> is the path to the file with the JSON-patch to modify the object model.

JSON-patch is a valid JSON that contains a list of changes to be applied to
the current object. Each change contains a dictionary with three keys: ``op``,
``path`` and ``value``. ``op`` (operation) can be one of the three values:
`add`, `replace` or remove`.

Allowed operations for paths:

* "" (model root): no operations
* "defaultNetworks": "replace"
* "defaultNetworks/environment": "replace"
* "defaultNetworks/environment/?/id": no operations
* "defaultNetworks/flat": "replace"
* "name": "replace"
* "region": "replace"
* "?/type": "replace"
* "?/id": no operations

For other paths any operation (add, replace or remove) is allowed.

Example of JSON-patch:

.. code-block:: javascript

   [{
     "op": "replace",
     "path": "/defaultNetworks/flat",
     "value": true
   }]

The patch above changes the value of the ``flat`` property of the
environment's ``defaultNetworks`` property to `true`.

Manage packages
~~~~~~~~~~~~~~~

This section describes how to manage packages using the command line
interface. You can easily:

* :ref:`import a package <cli_import>` or :ref:`bundles of packages <cli_bundles>`
* :ref:`list the existing packages <cli_list>`
* :ref:`display details for a package <cli_display>`
* :ref:`download a package <cli_download>`
* :ref:`delete a package <cli_delete>`
* :ref:`create a package <cli_create>`

.. _cli_import:

Import a package
----------------

With the :command:`package-import` command you can import packages
into murano in several different ways:

* :ref:`from a local .zip file <cli_zip>`
* :ref:`from murano app repository <cli_repo>`
* :ref:`from an http URL <cli_url>`

.. _cli_zip:

**From a local .zip file**

To import a package from a local .zip file, run:

.. code-block:: console

  $ murano package-import /path/to/PACKAGE.zip

where ``PACKAGE`` is the name of the package stored on your
computer.

For example:

.. code-block:: console

  $ murano package-import /home/downloads/mysql.zip
  Importing package com.example.databases.MySql
  +---------------------------------+------+----------------------------+--------------+---------+
  | ID                              | Name | FQN                        | Author       |Is Public|
  +---------------------------------+------+----------------------------+--------------+---------+
  | 83e4038885c248e3a758f8217ff8241f| MySQL| com.example.databases.MySql| Mirantis, Inc|         |
  +---------------------------------+------+----------------------------+--------------+---------+

To make the package available for users from other projects (tenants), use the
``--is-public`` parameter. For example:

.. code-block:: console

   $ murano package-import --is-public mysql.zip

.. note::

   The :command:`package-import` command supports multiple positional
   arguments. This means that you can import several packages at once.

.. _cli_repo:

**From murano app repository**

.. |link_location| raw:: html

   <a href="http://apps.openstack.org/#tab=murano-apps" target="_blank">murano applications repository</a>

To import a package from murano applications repository, specify
the URL of the repository with ``--murano-repo-url`` and a fully
qualified package name. For package names, go to |link_location|,
and click on the desired package to see its full name.

.. note::

   You can also specify the URL of the repository with the
   corresponding MURANO_REPO_URL environment variable.


The following example shows how to import the MySQL package from the
murano applications repository:

.. code-block:: console

   $ murano --murano-repo-url=http://storage.apps.openstack.org \
   package-import com.example.databases.MySql

This command supports an optional ``--package-version`` parameter that instructs
murano client to download a specified package version.

The :command:`package-import` command inspects package requirements
specified in the package's manifest under the *Require* section, and
attempts to import them from murano repository. The :command:`package-import`
command also inspects any image prerequisites mentioned in the
:file:`images.lst` file in the package. If there are any image
requirements, client would inspect images already present in the image
database. Unless image with the specific name is present, client would
attempt to download it.

.. TODO: Add a ref link to step-by-step (on specifying images and requirements
   for packages).


If any of the packages being installed is already registered in murano,
the client asks you what to do with it. You can specify the default action
with ``--exists-action``, passing ``s`` - for skip, ``u`` - for update, and
``a`` - for abort.

.. _cli_url:

**From an URL**

To import an application package from an URL, use the following command:

.. code-block:: console

  $ murano package-import http://example.com/path/to/PACKAGE.zip

The example below shows how to import a MySQL package from the
murano applications repository using the package URL:

.. code-block:: console

  $ murano package-import http://storage.apps.openstack.org/apps/com.example.databases.MySql.zip
  Inspecting required images
  Importing package com.example.databases.MySql
  +----------------------------------+-------+----------------------------+--------------+--------+----------+------------+
  | ID                               | Name  | FQN                        | Author       | Active | Is Public| Type       |
  +----------------------------------+-------+----------------------------+--------------+--------+----------+------------+
  | 1aa62196595f411399e4e48cc2f6a512 | MySQL | com.example.databases.MySql| Mirantis, Inc| True   |          | Application|
  +----------------------------------+-------+----------------------------+--------------+--------+----------+------------+

.. _cli_bundles:

Import bundles of packages
--------------------------

With the :command:`bundle-import` command you can install packages in
several different ways:

* :ref:`from a local bundle <cli_local_bundle>`
* :ref:`from an URL <cli_bundle_url>`
* :ref:`from murano app repository <cli_bundle_repo>`

When importing bundles, you can set their publicity with ``--is-public``.

.. _cli_local_bundle:

**From a local bundle**

To import a bundle from the a local file system, use the following
command:

.. code-block:: console

  $ murano bundle-import /path/to/bundle/BUNDLE_NAME

This command imports all the requirements of packages and
images.

When importing a bundle from a file system, the murano client
searches for packages in a directory relative to the bundle location
before attempting to download a package from repository. This facilitates
cases with no Internet access.

The following example shows the import of a monitoring bundle:

.. code-block:: console

 $ murano bundle-import /home/downloads/monitoring.bundle
 Inspecting required images
 Importing package com.example.ZabbixServer
 Importing package com.example.ZabbixAgent
 +----------------------------------+---------------+--------------------------+---------------+--------+----------+------------+
 | ID                               | Name          | FQN                      | Author        | Active | Is Public| Type       |
 +----------------------------------+---------------+--------------------------+---------------+--------+----------+------------+
 | fb0b35359e384fe18158ff3ed8f969b5 | Zabbix Agent  | com.example.ZabbixAgent  | Mirantis, Inc | True   |          | Application|
 | 00a77e302a65420c8080dc97cc0f2723 | Zabbix Server | com.example.ZabbixServer | Mirantis, Inc | True   |          | Application|
 +----------------------------------+---------------+--------------------------+---------------+--------+----------+------------+

.. note::

   The :command:`bundle-import` command supports multiple positional
   arguments. This means that you can import several bundles at once.

.. _cli_bundle_url:

**From an URL**

To import a bundle from an URL, use the following command:

.. code-block:: console

  $ murano bundle-import http://example.com/path/to/bundle/BUNDLE_NAME

Where ``http://example.com/path/to/bundle/BUNDLE_NAME`` is any external http/https
URL to load the bundle from.

For example:

.. code-block:: console

  $ murano bundle-import http://storage.apps.openstack.org/bundles/monitoring.bundle

.. _cli_bundle_repo:

**From murano applications repository**

To import a bundle from murano applications repository, use the
following command, where ``bundle_name`` stands for the bundle name:

.. code-block:: console

  $ murano bundle-import BUNDLE_NAME

For example:

.. code-block:: console

  $ murano bundle-import monitoring

.. |location| raw:: html

   <a href="http://apps.openstack.org/#tab=murano-apps" target="_blank">murano applications repository</a>

.. note::

   For bundle names, go to |location|, click the
   **Format** tab to show bundles first, and then click on
   the desired bundle to see its name.

.. _cli_list:

List packages
-------------

To list all the existing packages you have, use the
:command:`package-list` command. The result will show you the package
ID, name, author and if it is public or not. For example:

.. code-block:: console

 $ murano package-list
 +----------------------------------+--------------------+-------------------------------------+---------------+--------+----------+------------+
 | ID                               | Name               | FQN                                 | Author        | Active | Is Public| Type       |
 +----------------------------------+--------------------+-------------------------------------+---------------+--------+----------+------------+
 | daa46cfd78c74c11bcbe66d3239e546e | Apache HTTP Server | com.example.apache.ApacheHttpServer | Mirantis, Inc | True   |          | Application|
 | 5252c9897e864c9f940e08500056f155 | Cloud Foundry      | com.example.paas.CloudFoundry       | Mirantis, Inc | True   |          | Application|
 | 1aa62196595f411399e4e48cc2f6a512 | MySQL              | com.example.databases.MySql         | Mirantis, Inc | True   |          | Application|
 | 11d73cfdc6d7447a910984d95090463b | SQL Library        | com.example.databases               | Mirantis, Inc | True   |          | Application|
 | fb0b35359e384fe18158ff3ed8f969b5 | Zabbix Agent       | com.example.ZabbixAgent             | Mirantis, Inc | True   |          | Application|
 | 00a77e302a65420c8080dc97cc0f2723 | Zabbix Server      | com.example.ZabbixServer            | Mirantis, Inc | True   |          | Application|
 +----------------------------------+--------------------+-------------------------------------+---------------+--------+----------+------------+

.. _cli_display:

Show packages
-------------

To get full information about a package, use the :command:`package-show`
command. For example:

.. code-block:: console

 $ murano package-show 1aa62196595f411399e4e48cc2f6a512
 +----------------------+-----------------------------------------------------+
 | Property             | Value                                               |
 +----------------------+-----------------------------------------------------+
 | categories           |                                                     |
 | class_definitions    | com.example.databases.MySql                         |
 | description          | MySql is a relational database management system    |
 |                      | (RDBMS), and ships with no GUI tools to administer  |
 |                      | MySQL databases or manage data contained within the |
 |                      | databases.                                          |
 | enabled              | True                                                |
 | fully_qualified_name | com.example.databases.MySql                         |
 | id                   | 1aa62196595f411399e4e48cc2f6a512                    |
 | is_public            | False                                               |
 | name                 | MySQL                                               |
 | owner_id             | 1ddb2c610d4e4c5dab5185e32554560a                    |
 | tags                 | Database, MySql, SQL, RDBMS                         |
 | type                 | Application                                         |
 +----------------------+-----------------------------------------------------+

.. _cli_delete:

Delete a package
----------------

To delete a package, use the following command:

.. code-block:: console

  $ murano package-delete PACKAGE_ID

.. _cli_download:

Download a package
------------------

With the following command you can download a .zip archive
with a specified package:

.. code-block:: console

  $ murano package-download PACKAGE_ID > FILE.zip

You need to specify the package ID and enter the .zip file name
under which to save the package.

For example:

.. code-block:: console

  $ murano package-download e44a3f526dfb4e08b3c1018c9968d911 > Wordpress.zip

.. _cli_create:

Create a package
----------------

With the murano client you can create application packages from package
source files or directories. The :command:`package-create` command is
useful when application package files are spread across several directories.
This command has the following required parameters::

 -r RESOURCES_DIRECTORY
 -c CLASSES_DIRECTORY
 --type TYPE
 -o PACKAGE_NAME.zip
 -f FULL_NAME
 -n DISPLAY_NAME

Example:

.. code-block:: console

  $ murano package-create -c Downloads/Folder1/Classes -r Downloads/Folder2/Resources \
  -n mysql -f com.example.MySQL -d Package -o MySQL.zip --type Library
  Application package is available at /home/Downloads/MySQL.zip

After this, the package is ready to be imported to the application
catalog.

The :command:`package-create` command is also useful for autogenerating
packages from heat templates. In this case you do not need to manually
specify so many parameters. For more information on automatic package
composition, please see :ref:`Automatic package composing <compose_package>`.

Manage categories
~~~~~~~~~~~~~~~~~

In murano, applications can belong to a category or multiple categories.
Administrative users can create and delete a category as well as list
available categories and view details for a particular category.

Create a category
-----------------

To create a category, use the following command specifying the category name:

.. code-block:: console

   $ murano category-create <NAME>

List available categories
-------------------------

To get a list of all existing categories, run:

.. code-block:: console

   $ murano category-list

Show category details
---------------------

To see packages that belong to a particular category, use the following
command specifying the category ID:

.. code-block:: console

   $ murano category-show <ID>

Delete a category
-----------------

To delete a category, use the following command specifying the ID of a
category or multiple categories to delete:

.. code-block:: console

   $ murano category-delete <ID> [<ID> ...]

.. note::

   Verify that no packages belong to the category to be deleted, otherwise an
   error appears. For this, use the :command:`murano category-show <ID>`
   command.

Manage environment templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To manage environment templates, use the following commands specifying
appropriate values:

:command:`murano env-template-create <ENV_TEMPLATE_NAME>`
 Creates an environment template.

:command:`murano env-template-clone <ID> <NEW_ENV_TEMPLATE_NAME>`
 Creates a new template, cloned from an existing template.

:command:`murano env-template-create-env <ID> <ENV_TEMPLATE_NAME>`
 Creates a new environment from template.

:command:`murano env-template-add-app <ENV_TEMPLATE_ID> <FILE>`
 Adds an application or multiple applications to the environment template.

:command:`murano env-template-del-app <ENV_TEMPLATE_ID> <ENV_TEMPLATE_APP_ID>`
 Deletes an application from the environment template.

:command:`murano env-template-list`
 Lists the environments templates.

:command:`murano env-template-show <ID>`
 Displays environment template details.

:command:`murano env-template-update <ID> <ENV_TEMPLATE_NAME>`
 Updates an environment template.

:command:`murano env-template-delete <ID>`
 Deletes an environment template.

.. seealso::
   `Application Catalog service command-line client <http://docs.openstack.org/cli-reference/murano.html>`_.