Link Search Menu Expand Document

Deploying a custom application

Deploying applications in the NAPPTIVE playground can be done by two different methods: using the catalog as a specification repository or directly with the CLI with local files. The following sections describe how to deploy your own application both ways.

Pre-requirements

Deploying a custom application with CLI from local files

The first step is to create a YAML file with the Application to be deployed. For more information on syntax and supported extensions check Applications and OAM definitions. For this example we will use a simple mono-component application to deploy Nginx. The application can be easily defined leveraging the webservice component type as we are interesting in having a service for the deployed component, and the napptive-ingress trait to expose a public endpoint.

Copy the following application and save it in a YAML file named custom-app.yaml.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: custom-app
  annotations: # include optional annotations and/or labels.
    version: v1.0.0
    description: "Customized version of nginx"
spec:
  components:
    - name: nginx # an nginx component exposing port 80
      type: webservice
      properties:
        image: nginx:1.20.0
        ports:
        - port: 80
          expose: true
      traits:
      - type: napptive-ingress # a napptive-ingress trait to get a public endpoint
        properties:
          name: nginx
          port: 80
          path: /

Now proceed with the deployment by first login into the platform if you have not done so.

playground login

And now deploy your application with

playground apps create <path>/custom-app.yaml

Now check the status and open the public endpoint

playground apps info custom-app

and to open the endpoints:

playground apps open custom-app

Deploying a custom application leveraging the Catalog

Another method to deploy a custom application is to upload its specification first to the public catalog and then deployed from it using the same approach as shown in Deploy your first application and Starting with the CLI sections of the Getting started guide.

For this example, we will use the same nginx application and it the first section with the addition of a metadata entity for the catalog. First, create a new folder named custom-app and copy the following files to it.

custom-app.yaml

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: custom-app
  annotations: # include optional annotations and/or labels.
    version: v1.0.0
    description: "Customized version of nginx"
spec:
  components:
    - name: nginx # an nginx component exposing port 80
      type: webservice
      properties:
        image: nginx:1.20.0
        ports:
        - port: 80
          expose: true
      traits:
      - type: napptive-ingress # a napptive-ingress trait to get a public endpoint
        properties:
          name: nginx
          port: 80
          path: /

custom-app-metadata.yaml

apiVersion: core.napptive.com/v1alpha1
kind: ApplicationMetadata
name: "My custom NGINX server"
version: 1.20.0
description: Example of a custom application
keywords: # Optional
  - "server"
license: "Apache License Version 2.0" # Optional
url: "https://www.nginx.com/" # Optional
doc: "http://nginx.org/" # Optional

and now, upload the application to the catalog using:

playground catalog push <your_user>/my-custom-app:v1.0 /path/to/custom-app

and deploy it with:

playground catalog deploy <your_user>/custom-app:v1.0

Alternatively, the application can also be deployed through the Web UI as shown in the Deploy your first application guide. If you want to remove the application from the catalog use:

playground catalog remove <your_user>/custom-app:v1.0

What’s next