»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/nomad/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 = "1"
            local = true
          }
      }
  }

    deploy {
      use "nomad" {
        datacenter = "dc1"
      }
    }

  }

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 nomad and datacenter fields tell Waypoint to deploy the application to Nomad to the dc1 datacenter.

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