Deploy an App Using a Manifest File

This tutorial shows how to deploy an app and create services using a manifest file.

A manifest is a static plain text file named continuum.conf that you create and place into the root level of the working directory of your app. You use a manifest file in place of some or all of the flags you would otherwise specify on the command line when you create or deploy an app.

Using a manifest is the preferred approach for deploying apps because it allows you to script and save repeatable deployment parameters for your apps.

Prerequisite

Instructions

Complete the steps that follow.

1. Explore the use and structure of an Apcera manifest file.

The manifests documentation describes the syntax of a manifest file and describes the set of application attributes that can be specified. Manifest files can be used with the apc app create and apc app deploy commands (with some limitations in the latter case). Example manifests are also provided in the manifests documentation.

2. Create a copy of the demo-node-todo app directory.

To avoid confusion between the web app you created manually and the one you are creating here using a manifest file, create a new directory named demo-node-todo-manifest and copy to it the contents of the demo-node-todo directory.

From your home directory, issue the following set of commands:

mkdir demo-node-todo-manifest

cd demo-node-todo

cp -R * $HOME/sample-apps/demo-node-todo-manifest

You copy the contents recursively since the source directory contains subfolders.

cd demo-node-todo-manifest

Use ls to verify that the files were copied.

3. Create a manifest file for scripted app deployment.

  • Using a plain text editor, create a manifest file as described below.
  • Name the file continuum.conf.
  • Save the manifest to directory demo-node-todo-manifest.

Be sure to use a plain text editor. Do not create a manifest file using a common word processing application. Such programs often use non-standard characters (such as Smart Quotes) that can get included in the app or service names. Good plain text editors are Atom and Sublime.

# App name is required and must be in quotes
name: "my-node-app-manifest"

# Create 2 instances instead of 1 (default)
instances: 2

# Cutom resource allocation
resources {
  cpu: "200"
  disk_space: "768MB"
  memory: "256MB"
  network_bandwidth: "10Mbps"
}

# Create DB services and bind the app to them
# Providers must be registered prior to app creation
services [
  {
    provider_name: "/apcera/providers::postgres",
    type: "postgres",
    service_name: "mydb1",
  },
  {
    provider_name: "/apcera/providers::mysql",
    type: "mysql",
    service_name: "mydb2",
  }
]

# App startup timeout
timeout: 10

# Start the app on deploy
start: true

4. Create the app using the manifest script file.

From the demo-node-todo-manifest directory, issue the following command to create the app using the manifest file.

apc app create

All parameters for creating the app are read from the manifest file. The app is created as well as the services and bindings, and both app instances are started on deployment.

Any parameters you provide on the command line take precedence over those parameters in the manifest file.

5. Verify successful app deployment.

Access the web interface for the app using the route URL, which is available from the app creation output. For example:

App should be accessible at "http://my-node-app-manifest.training.sandbox.skanderna.io"

You should see the web interface for your app.

Select the databases. You should not receive an error because the manifest created the services and bound the app to them.

6. Verify your deployed app using APC.

apc app list

You should have 2 running instances of the app.

apc service list

You should see the services created with the manifest are listed.

7. Manage the app using the web console.

Log in to the Apcera Web Console for your cluster.

Select your namespace and search your jobs. You should see that the my-node-app-manifest is deployed in your namespace.

Select the my-node-app-manifest app and verify that 2 instances are running. Click the plus sign (+) next to the Instances label. Change the number of instances from 2 to 3 and click the checkmark button to save your changes. Momentarily, you should see the console display that the number of running instances for your app is now 3.

Verify the update using APC:

apc app list or app job list or apc app show

You should see that you now have 3 running instances of my-node-app-manifest.

Return to the web console and select your app. Click the plus sign (+) next to the Started label. Click the checkmark button to stop the app. Momentarily you should see that the job is stopped.

Verify the update using APC:

apc app list or app job list or apc app show

You should see that my-node-app-manifest is "stopped" and has no running instances. To verify, navigate to the app web page. It is not available because the app is stopped.