Part 1 - Write and Deploy the App

Step 1: Create a blueprint directory and files.

The starting point of interacting with Facets Control Plane is the creation of a blueprint. A blueprint is a git version controlled collection of json files. Each of this json files represents an intent and defines the resources required and their configurations and dependencies.

For our demo application, we only need an application instance and an ingress to access the application from the outside world. There are 2 parts to creating a blueprint in Facets Control Plane.

  1. First is the creation of json files in a pre-defined directory structure and pushing it to a git repository.
  2. The second part is using this git repository to create a blueprint on Facets console.

📘

The directory structure and directory names have to be in pre-defined format. Each resource type has a directory named after it. Each resource is defined by a JSON file, usually placed in the instances directory of a resource type. For example, if an application instance is needed, the directory name should be application and its json file would be placed in instances directory inside application directory

Our directory structure would look like below

480480

Create features.json and stack.json as described in Bootstrap a Blueprint.

  1. app.json - Create a file named app.json at application/instances the following content in it. This file defines all the application resource related configurations like sizing, autoscaling, load balancing etc.
{
    "$schema": "https://docs.facets.cloud/schemas/application/instances/application.schema",
     "kind": "facets.modules.common.application",
     "disabled": false,
     "apiVersion": "v2",
     "metadata": {
   
     },
     "spec": {
   
      "env": {
   
      },
      "loadbalancing": {
       "rules": [
        {
         "ingress": "ingress",
         "path": "/",
         "portName" : "port5000"
        }
       ]
      },
      "permission": [],
      "release": {
       "strategy": "RollingUpdate",
       "build": {
        "image": "313496281593.dkr.ecr.us-east-1.amazonaws.com/facets/springbootsample/springboot-backend:latest"
       }
      },
      "runtime": {
       "size": {
        "value": "small",
        "namespace": "GP"
       },
       "autoscaling": {
        "cpuThreshold": "50",
        "max": 1,
        "min": 1
       },
       "ports": [{
        "name": "port5000",
        "port": 5000
       }]
      }
  1. sizing.GP.json - Create a file named sizing.GP.json inside the application/ and put the following content in it. This file provides T-Shirt sizing options that can be used in app.json.
{
    "$schema": "https://docs.facets.cloud/schemas/application/sizing.schema",
 
    "small": {
      "podCPULimit": 1,
      "podMemoryLimit": 2
    }
  }
  1. ingress.json - Create a directory named ingress/instances. Place ingress.json with the following content in it. This file defines all the ingress related resource configurations.
{
    "$schema": "https://docs.facets.cloud/schemas/ingress/instances/ingress.schema",
    "apiVersion": "v2",
    "subdomains" : []
}

Step 2: Launch the App

  1. Push all the files to a git repository and register the blueprint in the control plane
  2. Push the built using :point-down:
  1. Launch an environment
  2. Test the application using the steps here

Did this page help you?