Deploy your first application
This tutorial guides you through the steps to deploy your first application on the Avassa Platform. It assumes that you have set up an environment as described in the first environment tutorial.
Avassa supports different tenants with different roles. If you are running through this tutorial and have logged in as an application owner tenant you will see slightly different information
We have also made all the code and artifacts used in the example available in our public gitlab repository.
Check the status of the sites
This scenario includes four sites Electric Cinema - London
and Metrograph - New York
that have been pre-provisioned, have called home and are available to receive scheduled applications.
.
To inspect the status of a site, click Sites
in the sidebar and select any site in the list. In the site list you have a circle indicating the overall health of the site and a number indicating how many hosts are running on the site.
In the top section of the site details window you will see information regarding the edge site such as: how many hosts have called home? do we have connection to the site and host state information. You also see labels such as system/type
. The Avassa system automatically assigns labels, you can configure labels, and you can define rules that will set labels based on discovered devices such as cameras. Labels are used to control the application placement.
Further down in the window you see the list of hosts that have called home from the site. You can inspect host details by clicking a host in the table.
This gives an overview of the host health like disc, memory and load. You will also see platform details.
In all views in the Avassa system you will have </>
button: this will show even more details on the selected object in YAML (or JSON).
Register the application
To deploy an application using the Avassa Platform, you need to register an application specification that defines the structure and content of the application, and a deployment specification that defines where the application shall be deployed, (based on labels).
In this tutorial you will define a very simple application popcorn-controller
consisting of a single container kettle-popper-manager
that manages all the popcorn machines in the theaters it is deployed in.
Click Applications
in the sidebar, then click Add
.
Name the application popcorn-controller
, and add a service popcorn-service
. Click New container
, name it kettle-popper-manager
and add the the following path for the image: registry.gitlab.com/avassa-public/movie-theaters-demo/kettle-popper-manager
.
A service is a way to partition your application into groups of containers. A service is also the granularity of the scheduler at edge sites, services can be scheduled across hosts.
Click Submit new application
.
You want to make sure that the image has been found, and has been made available to the internal registry before deploying it. Control Tower loads the images from external registries into an internal registry. When deploying to the edge sites, the images are then distributed to those as well in order for them to manage a restart without connection to Control Tower or external registries.
Click the View
button for the application. You will see that the Control Tower is pulling the container image.
Use the refresh button (circled arrow) in the application view to refresh the state.
The Status
field for the container tells you that the image has been found and has been successfully pulled into the local registry. You can also inspect the image hash.
Deploy the application
Since you have popcorn machines in all theaters, you want the system to create a deployment that places the popcorn-controller
application in all sites of type edge
. As mentioned above the system assigns labels to sites, and you can add your own labels as well. This will be shown later.
Click Deployments
in the sidebar, then click Add
.
Name the deployment popcorn-deployment
, add popcorn-controller
as the application, select Match site labels
, add system/type = edge
as the label expression. You will now see the list of sites that match the label and that the application will be deployed on.
Click Submit new deployment
to start the deployment process.
Check the status of the application deployment
To inspect the status of the deployed application, click View
button top right.
Before moving on let us elaborate on the state of a deployment versus the state of an application. Deployments are limited in time, they have an end-state Deployed
. Applications on the other hand do not have an end state, they have a current operational state. So that the application was deployed indicates that it started at the time of the deployment. If you would like to inspect the current operational state of the application on a specific site, you can click the site link in the deployment view above.
This will navigate to the application view for that site:
.
That same view is also available by navigating the applications menu:
You can also inspect the events leading up to the successful deployment. Select Events
in the deployment and enter a search back in time
You will now see the deployment events leading up to a complete and successful deployment.
This shows events propagated from the site to the Control Tower. You can also drill down to the site to get even more fine-grained deployment information.
Pick the site and select the topics tab. This will show available topics on the Avassa built-in pub/sub bus, pick the system:scheduler-events
topic and perform a search.
Undeploying the applications
In order to remove the applications from the site, you just delete the deployment.
This is done by selecting Delete
on the configuration tab for the deployment.
In order to clean up the system you can also delete the application specification in the same way.
Conclusion
You have now deployed a single-container application with images from a remote registry, across four sites using label-matching for placement.