heat/doc/source/getting_started/create_a_stack.rst
Rodolfo Alonso Hernandez 4254db1c61 Update the "Creating your first stack" document
This patch updates:
* The fedora cloud image used (the previous one is not longer
  available)
* The image name, to match the name used in the "stack create"
  command.
* The link to the "WordPress_Native.yaml"

Trivial-Fix

Change-Id: I845cb19ecc70467606d336850e7154a68208c896
2023-04-12 16:09:33 +02:00

4.2 KiB

Creating your first stack

Confirming you can access a Heat endpoint

Before any Heat commands can be run, your cloud credentials need to be sourced:

$ source openrc

You can confirm that Heat is available with this command:

$ openstack stack list

This should return an empty line

Preparing to create a stack

Download and register the image:

$ wget https://download.fedoraproject.org/pub/fedora/linux/releases/37/Cloud/x86_64/images/Fedora-Cloud-Base-37-1.7.x86_64.qcow2
$ openstack image create \
                      --disk-format=qcow2 \
                      --container-format=bare \
                      --file=Fedora-Cloud-Base-37-1.7.x86_64.qcow2 \
                      my-fedora-image

Your cloud will have different flavors and images available for launching instances, you can discover what is available by running:

$ openstack flavor list
$ openstack image list

To allow you to SSH into instances launched by Heat, a keypair will be generated:

$ openstack keypair create heat_key > heat_key.priv
$ chmod 600 heat_key.priv

Launching a stack

Now lets launch a stack, using an example template from the heat-templates repository:

$ openstack stack create -t https://opendev.org/openstack/heat-templates/src/branch/master/hot/F20/WordPress_Native.yaml --parameter key_name=heat_key --parameter image_id=my-fedora-image --parameter instance_type=m1.small teststack

Which will respond:

+--------------------------------------+-----------+--------------------+----------------------+
| ID                                   | Name      | Status             | Created              |
+--------------------------------------+-----------+--------------------+----------------------+
| 718a712a-2571-4eac-aa03-426de00ecb43 | teststack | CREATE_IN_PROGRESS | 2017-04-11T03:06:24Z |
+--------------------------------------+-----------+--------------------+----------------------+

Note

Link on Heat template presented in command above should reference on RAW template. In case if it be a "html" page with template, Heat will return an error.

Note

You cannot rename a stack after it has been launched.

List stacks

List the stacks in your tenant:

$ openstack stack list

List stack events

List the events related to a particular stack:

$ openstack stack event list teststack

Describe the wordpress stack

Show detailed state of a stack:

$ openstack stack show teststack

Note: After a few seconds, the stack_status should change from IN_PROGRESS to CREATE_COMPLETE.

Verify instance creation

Because the software takes some time to install from the repository, it may be a few minutes before the Wordpress instance is in a running state.

Point a web browser at the location given by the WebsiteURL output as shown by openstack stack output show:

$ WebsiteURL=$(openstack stack output show teststack WebsiteURL -c output_value -f value)
$ curl $WebsiteURL

Delete the instance when done

Note: The list operation will show no running stack.:

$ openstack stack delete teststack
$ openstack stack list

You can explore other heat commands by referring to the Heat command reference <cli/> for the OpenStack Command-Line Interface <>; then read the template-guide and start authoring your own templates.