5.9 KiB
Deploying environments using CLI
The main tool for deploying murano environments is murano-dashboard.
It is designed to be easy-to-use and intuitive. But it is not the only
tool you can use to deploy a murano environment, murano CLI client also
possesses required functionality for the task. This is an advanced
scenario, however, that requires knowledge of internal murano workflow <murano-workflow>
,
murano object model <object-model>
, and murano environment <environment>
life cycle.
This scenario is suitable for deployments without horizon or deployment
automation.
Note
This is an advanced mechanism and you should use it only when you are confident in what you are doing. For everyday use it is recommended to use murano-dashboard.
Create environment
This command creates a new murano environment, ready for
configuration. For convenience this guide will refer to environment ID
as $ENV_ID
from now on.
murano environment-create deployed_from_cli
+----------------------------------+-------------------+---------------------+---------------------+
| ID | Name | Created | Updated |
+----------------------------------+-------------------+---------------------+---------------------+
| a66e5ea35e9d4da48c2abc37b5a9753a | deployed_from_cli | 2015-10-06T13:50:45 | 2015-10-06T13:50:45 |
+----------------------------------+-------------------+---------------------+---------------------+
Create configuration session
Murano uses configuration sessions to allow several users to edit and
configure the same environment concurrently. Most of environment-related
commands require --session-id
parameter. For convenience this guide
will refer to session ID as $SESS_ID
from now on.
murano environment-session-create $ENV_ID
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| id | 5cbe7e561ffc484ebf11aabf83f9f4c6 |
+----------+----------------------------------+
Add apps to environment
To manipulate environments object model from CLI you can use the
environment-apps-edit
command.
murano environment-apps-edit --session-id $SESS_ID $ENV_ID object_model_patch.json
The object_model_patch.json
contains the
jsonpatch
object. This object is applied to the
/services
key of the environment in question. Here is the
example of the object_model_patch.json
file content:
[
{ "op": "add", "path": "/-", "value":
{
"instance": {
"availabilityZone": "nova",
"name": "xwvupifdxq27t1",
"image": "fa578106-b3c1-4c42-8562-4e2e2d2a0a0c",
"keyname": "",
"flavor": "m1.small",
"assignFloatingIp": false,
"?": {
"type": "io.murano.resources.LinuxMuranoInstance",
"id": "===id1==="
}
},
"name": "ApacheHttpServer",
"enablePHP": true,
"?": {
"type": "io.murano.apps.apache.ApacheHttpServer",
"id": "===id2==="
}
}
}
]
For convenience, the murano client replaces "===id1==="
,
"===id2==="
(and so on) strings with UUIDs. This way you
can ensure, that object IDs inside your object model are unique. To
learn more about jsonpatch consult jsonpatch.com and RFC 6902. The murano-environment-edit
command fully supports jsonpatch. This means that you can alter, add, or
remove parts of your apps object model.
Verify your object model
To verify whether your object model is correct, check the environment
by running the environment-show
command with the --session-id
parameter
murano environment-show $ENV_ID --session-id $SESS_ID --only-apps
[
{
"instance": {
"availabilityZone": "nova",
"name": "xwvupifdxq27t1",
"assignFloatingIp": false,
"keyname": "",
"flavor": "m1.small",
"image": "fa578106-b3c1-4c42-8562-4e2e2d2a0a0c",
"?": {
"type": "io.murano.resources.LinuxMuranoInstance",
"id": "fc4fe975f5454bab99bb0e309249e2d2"
}
},
"?": {
"status": "pending",
"type": "io.murano.apps.apache.ApacheHttpServer",
"id": "69cdf10d31e64196b4de894e7ea4f1be"
},
"enablePHP": true,
"name": "ApacheHttpServer"
}
]
Deploy your environment
To deploy session $SESS_ID
of your environment use the
murano environment-deploy
command.
murano environment-deploy $ENV_ID --session-id $SESS_ID
You can later use the murano environment-show
command to track
deployment status.