Onboard a Service in your Environment

Deploy a sample application from your Control Plane

Overview

The aim of this document is to guide the user in developing a sample application and deploying it in their Control Plane.

Choosing a sample Application

Here, we will utilize the simple Hello World spring boot application from dstar55 to demonstrate how to onboard a service.

How to Test the Application

Using the application Dockerfile, you can build and run a container in any environment.

The application can be queried on port 8080 and will simply respond with "Hello World".

You can use the below command to test the output of the application.

$ curl <generated_ingress_domain_name>/
Hello World

This is how we will test if the application was deployed and is live from the Facets Control Plane.

Push the Artifact to the Facets Control plane

Let's manually build, execute, test, and push to the Facets Control Plane.

You can refer to Facets Command Line Tool documentation for more details on the command line tool.

📘

In this example, we are manually deploying the build. If you would want more information on automating build deployment to the Facets Control Plane, refer to the Integrating with CI documentation.

Onboarding a Service

Step 1: Create a named Ingress

We need an Ingress to expose the deployed pod to the outside world.

  1. Create a directory named ingress/instances.
  2. Create a file named appingress.json.
  3. Paste the below code inside appingress.json and commit your changes.
{
  "$schema": "https://facets-cloud.github.io/facets-schemas/schemas/loadbalancer/loadbalancer.schema.json",
  "flavor": "nlb_nginx",
  "version": "0.1",
  "kind": "ingress",
  "disabled": false,
  "metadata": {
    "name": "appingress",
  },
  "spec": {
    "basicAuth": false,
    "private": false,
    "domains": {
    },
    "rules": {
      "rule-1": {
        "service_name": "backend",
        "path": "/",
        "port_name": "http",
        "port": 8080,
        "domain_prefix": ""
      }
    },
    "force_ssl_redirection": true
  },
  "advanced": {
  }
}

Step 2: Create a Service of a type Application blueprint

  1. Create a directory named service/instances.
  2. Create a file named backend.json.
  3. Paste the below code inside backend.json and commit your changes.
{
  "$schema": "https://facets-cloud.github.io/facets-schemas/schemas/service/service.schema.json",
    "flavor": "default",
    "metadata": {
        "name": "backend"
    },
    "kind": "service",
    "disabled": false,
    "version": "0.1",
    "spec": {
        "type": "application",
        "enable_host_anti_affinity": true,
        "runtime": {
            "size": {
                "cpu": "1",
                "memory": "250Mi"
            },
            "health_checks": {
                "liveness_url": "/",
                "readiness_url": "/",
                "start_up_time": 10,
                "port": 8080,
                "timeout": 30,
                "period": 10
            },
            "ports": {
                "http": {
                    "port": 8080,
                    "protocol": "tcp"
                }
            }
        },
        "release": {
            "strategy": {
                "type": "RollingUpdate",
                "max_available": 1,
                "max_unavailable": 0
            },
            "image": "313496281593.dkr.ecr.us-east-1.amazonaws.com/facets/springbootsample/springboot-backend:latest"
        },
        "env": {}
    }
}

📘

In this example we didn't need additional environment variables. Refer to Environment Variables documentation for more details on additional variables.

Step 3: Perform a Release

Now, perform a Full Release from the Releases tab.

📘

For more information on Releases, refer to Performing a Release.

Step 4: Test the application

  1. Navigate to Environment > Resources. To know more about Resources, refer to the Resource Center documentation.
Resources tab in left Navigation menu

Resources tab in left Navigation menu

  1. Click on backend under the resource type Service.
  2. In the Resource Details page, find the generated Ingress domain name under the Ingress Rules widget.
Application Details Screen

Application Details Screen

  1. Execute the below command to test the output after deploying the application.
$ curl <generated_ingress_domain_name>/
Hello World

You have successfully onboarded an application to your environment.