Deploy your first cloud application using cloud web UI

This section aims to help you build your first cloud application and onboard it to a MOSK cloud. It will guide you through the process of deploying a simple application using the cloud web UI (OpenStack Horizon).

The section will also introduce you into the fundamental OpenStack primitives that are commonly used to create virtual infrastructures for cloud applications.

Sample application

The sample application in the context of this tutorial is a typical web-based application consisting of Wordpress, a popular web content management system, and a database that stores Wordpress data in the cloud block storage (OpenStack Cinder volume).


You can extend the sample application to make use of advanced features offered by MOSK, for example:

  • Add an HTTPS-terminating load balancer that stores its certificate in the Key Manager service (OpenStack Barbican)

  • Make the public endpoint accessible by the domain name with the help of the DNS service (OpenStack Designate)


You can run the sample application on any OpenStack cloud. It can be a private MOSK cluster of your company, a public OpenStack cloud, or even your own tiny TryMOSK instance spinned up in an AWS tenant as described in the Try Mirantis OpenStack for Kubernetes on AWS article.

To deploy the sample application, you need:

  • Access to your cloud web UI with the credentails obtained from your cloud administator:

    • The URL of the cloud web UI (OpenStack Horizon)

    • The login, password, and, optionally, authentication method that you need to use to log in to the MOSK cloud

    • The name of the OpenStack project with enough resources available

  • Connectivity from the MOSK cluster to the Internet to be able to download the components of the sample application. If needed, consult with your cloud administrator.

  • A local machine with the SSH client installed and connectivity to the cloud public address (floating IP) space.


The sample cloud application deployment has been verified in the following environment:

  • OpenStack Yoga

  • Ubuntu 18.04 LTS (Bionic Beaver) as guest operating system

Deploy sample application using the web UI

  1. Log in to the cloud web UI:

    1. Open your favorite web browser and navigate to the URL of the cloud web UI.

    2. Use the access credentials to log in.

    3. Select the appropriate project from the drop-down menu at the top left.

  2. Create a dedicated private network for your application:


    Virtual networks in OpenStack are used for isolated communication between instances (virtual machines) within the cloud. Instances get plugged into networks to communicate with any virtual networking entities, such as virtual routers and load balancers as well as the outside world.

    1. Navigate to Network > Networks.

    2. Click Create Network. The Create Network dialog box opens.

    3. In the Network tab, specify a name for the new network. Select the Enable Admin State and Create Subnet check boxes.

    4. In the Subnet tab, specify a name for the subnet and network address, for example,

    5. In the Subnet Details tab, keep the preset configuration.

    6. Click Create.

  3. Create and connect a network router.


    A virtual router, just like its physical counterpart, is used to pass the layer 3 network traffic between two or more networks. Also, a router performs the network address translation (NAT) for instances to be able to communicate with the outside world through the external networks.

    To create the network router:

    1. Navigate to Network > Routers.

    2. Click Create Router. The Create Router dialog box opens.

    3. Specify a meaningful name for the new router and select the external network it needs to be plugged in. If you do not know which external network to select, consult your cloud administator.

    Now, when the router is up and running, you need to plug it into the application private network, so it can forward the packets between your local machine and the instance, which you will create later.

    To connect the network router:

    1. Navigate to Network > Routers.

    2. Find the router you have just created and click on its name.

    3. Open the Interfaces tab and click Add Interface. The Add Interface dialog box opens.

    4. Select the subnetwork that you provided in the first step.

    5. Click Add Interface.

  4. Create an instance:


    A virtual machine, or an instance in the OpenStack terminology, is the machine where your application processes will be effectively running.

    1. Navigate to Compute > Instances.

    2. Click Launch Instance. The Launch Instance dialog box opens.

    3. In the Details tab, specify a meaningful name for the new instance, so that you can easily identify it among others later.

    4. In the Source tab, select the Image boot source. MOSK comes with a few prebuilt images, we will be using the one with the Ubuntu Bionic Server image for the sample application.

    5. In the Flavor tab, pick the m1.small size for the instance, which provides just enough resources for the application to run.

    6. In the Networks tab, select the previously created private network to plug the instance into.

    7. In the Security Groups tab, verify that the default security group is selected and it allows the ingress HTTP, HTTPs, and SSH traffic.

    8. In the Key Pair tab, create or import a new key pair to be able to log in to the instance securily through the SSH protocol. Make sure to have a copy of the private key on your local machine to pass to the SSH client.

    9. Now all the needed settings have been made, click Launch Instance.

      Wait for the new instance to get shown in the Active state in the Instances dashboard.

  5. Attach a volume to the instance.


    Volumes in OpenStack provide persistent storage for applications, allowing the data, which is placed on them, to exist independently from the instances, as opposed to the data written to ephemeral storage, which automatically gets terminated together with its instance.

    To create the volume:

    1. Navigate to Volumes > Volumes.

    2. Click Create Volume. The Create Volume dialog box opens.

    3. Specify a meaningful name for the new volume.

    4. Leave all fields with the default values. A 1 GiB volume will be enough for the sample application.

    Once the volume is allocated, it shows up in the same Volumes dashboard. Now, you can attach the new volume to your running instance:

    1. In the Volumes dashboard, select the volume to add to the instance.

    2. Click Manage Attachments. The Manage Volume Attachments dialog box opens.

    3. Select the required instance.

    4. Click Attach Volume.

    Now, the Attached To column in the Volumes dashboard will display your volume device name as the volume attached to your instance. Also, you can view the status of a volume that can be either Available or In-Use.

  6. Expose the instance outside:


    A floating IP address in OpenStack is an abstraction over a publicly routable IP address that allows an instance to be accessed from outside the cloud. Floating IPv4 addresses are typically scarce and expensive resources and, so they need to be explicitly allocated and assigned to selected instances.

    1. Navigate to Compute > Instances.

    2. From the Actions drop-down list next to your instance, select Associate Floating IP. The Manage Floating IP Associations dialog box opens.

    3. Allocate a new floating IP address using the + button.

      The Port to be associated should be already filled in with the instance private port.

    4. Click Associate.

    The Compute > Instances dashboard will display the instance floating IP address along with the private one. Write down the floating IP address as you will need it in the next step.

  7. Access the instance through SSH.

    On your local machine use the SSH client to log in to the instance by its floating IP address. Ensure the 0600 permission on the private key file.

    ssh -i <path-to-your-private-key> ubuntu@<floating-IP>

    All operations on the instance listed below must be performed by the superuser, as root:

    sudo su -
  8. Initialize persistent storage for the application data.

    A newly created volume is always an empty block device that needs to be provisioned before the application can write or read any data.

    Use the device name under which the volume got attached to the instance to create a file system on the block device:

    mkfs.ext4 <volume-device-name> -q

    Create a mount point and mount the newly provisioned block device into the guest operating system:

    mkdir /mnt/data && mount <volume-device-name> /mnt/data
  9. Start the application components.

    We will run the application components as Docker containers to simplify their provisioning and configuration and isolate them from each other.

    The common Ubuntu cloud image does not have Docker engine preinstalled, so you need to install it manually:

    sudo apt-get update && sudo apt-get install -y

    Our sample application consists of two Docker containers:

    • MySQL database server

    • Wordpress instance

    First, we create a new Docker network so that both containers can communicate with each other:

    docker network create samplenet

    Now, let’s spin up the MySQL database. We will place all its data in a separate directory on the mounted volume. You can find more information about the parameters of MySQL image on its DockerHub page.

    mkdir /mnt/data/db
    docker run -d --name db --network samplenet --volume /mnt/data/db:/var/lib/mysql -e MYSQL_DATABASE=exampledb -e MYSQL_USER=exampleuser -e MYSQL_PASSWORD=examplepass -e MYSQL_RANDOM_ROOT_PASSWORD=1 mysql:5.7

    It is time to start the Wordpress Docker container. Its data will be also hosted on the volume.

    mkdir /mnt/data/wordpress
    docker run -d --name wordpress --network samplenet --publish 80:80 --volume /mnt/data/wordpress:/var/www/html -e WORDPRESS_DB_HOST=db -e WORDPRESS_DB_USER=exampleuser -e WORDPRESS_DB_PASSWORD=examplepass -e WORDPRESS_DB_NAME=exampledb wordpress

Now, the sample application is up and running.

Verify application functioning

Use the web browser on you local machine to navigate to the application endpoint http://<instance-floating-IP-address>. If you have followed all the steps accurately, your browser should now display the Wordpress Getting Started dialog.

Feel free to provide the necessary parameters and proceed with the initialization. Once it finishes, you proceed with building your own cloud-hosted website and start serving the users. Congratulations!