»Initializing and Configuring Waypoint for Your App

Before you can build and deploy your application, you must initialize it with Waypoint.

When you initialize Waypoint for your application, Waypoint first looks to see if there is a Waypoint configuration file (waypoint.hcl) for the app in the directory.

»Waypoint Configuration

The waypoint.hcl configuration file gives Waypoint instructions for how to build, deploy, and release your application.

If Waypoint cannot find the app's configuration file when you run waypoint init, Waypoint will create a starter waypoint.hcl file that you can then customize for your application.

»Examine the Waypoint.hcl File

The remainder of this walkthrough uses the example NodeJS application to show how to initialize an app and then build, deploy, and release it with Waypoint.

We will now view the waypoint.hcl file to learn more about the app's configuration.

In the /waypoint-examples/kubernetes/nodejs/ directory, run the following command:

$ cat waypoint.hcl

The Terminal will output the contents of the waypoint.hcl file.

project = "example-nodejs"

  app "example-nodejs" {

    build {
      use "pack" {}
      registry {
          use "docker" {
            image = "nodejs-example"
            tag = "latest"
            local = true
          }
      }
   }

    deploy {
      use "kubernetes" {
      probe_path = "/"
      }
    }

    release {
      use "kubernetes" {
      }
    }
  }

The build clause defines how Waypoint will build the app. The pack option tells Waypoint to use the most relevant Cloud Native Buildpack to build the application. Since this example app is written for NodeJS, Waypoint will use NodeJS Buildpacks.

The deploy clause defines where Waypoint will deploy the app. The kubernetes option tells Waypoint to deploy the application to Kubernetes.

The release clause defines how our application will be released to our environment. For example, in the case of external Kubernetes clusters this would be where you would configure a load_balanacer on a specific port.

With these configurations in place, execute the following command in order to initialize Waypoint with this configuration.

$ waypoint init

»Next Step

Getting Started: Building and Deploying