Skip to content

Nginx Docker App

In this example, we will create an "App SKU" for Nginx distributed as a Docker Container via DockerHub. The app itself is available via DockerHub at "https://hub.docker.com/_/nginx"


Prerequisites

As a service provider, you already have completed the following:

  1. Provisioned a Kubernetes cluster (e.g. Rafay MKS)
  2. Deployed a cluster blueprint with critical addons
  3. Ingress Controller
  4. Have access to a domain (e.g. paas.demo.gorafay.net) with TLS certificates to support https based access
  5. Your Kubernetes cluster has connectivity to the Internet to download container images from DockerHub

--

Create Nginx SKU

  • Login into the "Default Org" and navigate to the PaaS Studio
  • Click on Service Profiles and click on "New Service Profile"

This will launch a wizard to create a new service profile.

  • Provide a unique name (e.g. nginx-docker)
  • Provide an optional Display Name
  • Provide an optional description (This will be presented to the end user when they select and launch the card for the SKU)

Create Service SKU

  • For Environment Template, select "system-serverless-pods"
  • For version, select the latest version (e.g. v6)
  • For Service Type, select from the dropdown list (managed by the super admin role)
  • Enable the toggle for auto creation of compute
  • Save & Continue

Profile Configuration

General

Update the fields in the "general" section if needed


Card Design

  • Provide the URL for an image which will be presented to the user as an Icon when they select the SKU (e.g. https://commons.wikimedia.org/wiki/File:Nginx_logo.svg)

  • Update the readme field with a description which will be presented to the end user when they select the SKU (e.g. Nginx App)

Card Design

Info

Click on "Preview" to view what the readme will look like for the end user.


Input Settings

In this section, you get to specify

  • Default values for required inputs
  • Which inputs can be overriden by end users
  • How the inputs can be selected by end users (e.g. dropdown list, text box etc)

The docker command to run a simple nginx container from DockerHub is

docker run -d -p 8080:80 --name my-nginx nginx

What it does: - -d runs the container in detached mode - -p 8080:80 maps container port 80 to host port 8080 - --name my-nginx names the container - nginx is the image pulled from Docker Hub

You can access it at: http://localhost:8080. Due to security considerations, service providers will prefer to have web apps be accessed on "port 443" (https).


User Overrides

Disable "Allow Overrides for All" This disables all overrides for end users when they use it. We will selectively enable some fields in the subsequent steps.


Default Inputs

In this step, you will customize the standard profile with "default" values that are relevant for your deployment.

Name Value Override
Container Port 80 NO
CPU 500 YES
Enable Web Access true NO
Hostname Suffix paas.demo.gorafay.net NO
Ingress Class Name nginx NO
Kubeconfig Copy/Paste NO
Memory 512 NO
Pod Image nginx NO

Hostname Suffix

Specify the DNS hostname that you intend to use to serve the web applications. In our example, we are using "paas.demo.gorafay.net". Every instance of the web app can be acccessed on a dynamically generated URL pattern that will look like "https://random prefix.paas.demo.gorafay.net"

Kubeconfig

  • In the Infrastructure portal, click on the "gear" symbol on the far right of the target Kubernetes cluster
  • Select "Download ZTKA Kubeconfig"
  • Open the downloaded file with an IDE
  • Copy the content and paste it into the Kubeconfig field in the above step.

Download Kubeconfig


User Overrides

The only user override we want to provide is a selector for CPU resources. The default input type is a text field which means the user can type "anything". Instead, we want to provide the user with a drop down list with 2-3 options.

  • Click on Edit display config
  • For type, select "dropdown"
  • In dropdown options, add two entries: Label (500), value (500) and label (1000) and value (1000)
  • Click on "Update and Continue"
  • Save the profile

You should see something like the image shown below.

Dropdown


Output Settings

Once the web application has been successfully deployed, we need to help user quickly find the URL for the app.

  • Click on "Add Output"
  • Under name, enter "Host Name"
  • Under label, enter "URL for Nginx App"

Outputs

Info

The name "Host Name" will dynamically retrieve the https URL for the deployed web app.


Schedules & Actions

Skip these


Click on "Save" to save the profile. Now, we have a ready to use Nginx App SKU. It should look like the following

Saved SKU


Test Nginx SKU

Now, we are ready to test our newly created Nginx SKU.

  • In the SKU Studio, click on "Service Instances"
  • Ensure the "system-catalog" project is selected
  • Click on New Service Instance

You should now see your newly created "Nginx App". Now, enter a name for the instance and click on Deploy. In ~50-60 seconds, you should see a successfully deployed instance. See example below.

Successful Instance

Now, click on the URL and you should be taken to your Nginx App. You should see something like the image below.

Successful Access


Share SKU with Customer Orgs

At this point, although the SKU works, it is not available to Customer Orgs automatically. Service Providers need to perform the following to make the SKU available to customer orgs

  • Login into the Rafay Ops Console
  • Click on System Resources
  • Click on Service Profiles

You should now see the newly created SKU (e.g. nginx-docker-app).

  • Click on Actions to initiate SKU sharing
  • You will be presented with the option to share the SKU with "Select Orgs" or "All Orgs"
  • Select one of these options and the SKU will now be immediately available and usable by the selected customer orgs.

Share SKU