Super easy deployment of applications using Waypoint

Overview

On October 15, 2020, HashiCorp announced a new product called Waypoint.

Simply put, it's a great tool that allows you to build and deploy to cloud environments such as Amazon EC2, ECS, Google Cloud Run, and Azure Container Instances with a single liner by writing just one deployment configuration file.

function

Cloud-native applications often run on container infrastructure such as ECS and Kubernetes, but deployment configurations and commands often become complicated depending on the service configuration. Waypoint allows you to manage configuration files in one word, allowing applications to run the release cycle with a simpler workflow. great.

Verification

I tried it in a Mac environment. The Manual (https://learn.hashicorp.com/waypoint) also describes how to set up manually or in a Linux environment.

Let's run the sample application published on Waypoint with Docker. First, install Waypoint with brew.

$ brew tap hashicorp/tap
$ brew install hashicorp/tap/waypoint

Take a look at the help.

% waypoint --help
Welcome to Waypoint
Docs: https://waypointproject.io
Version: v0.1.2

Usage: waypoint [-version] [-help] [-autocomplete-(un)install] <command> [args]

Common commands
  build        Build a new versioned artifact from source
  deploy       Deploy a pushed artifact
  release      Release a deployment
  up           Perform the build, deploy, and release steps for the app

Other commands
  artifact        Artifact and build management
  config          Application configuration management
  context         Server access configurations
  deployment      Deployment creation and management
  destroy         Delete all the resources created for an app
  docs            Show documentation for components
  exec            Execute a command in the context of a running application instance
  hostname        Application URLs
  init            Initialize and validate a project
  install         Install the Waypoint server to Kubernetes, Nomad, or Docker
  logs            Show log output from the current application deployment
  runner          Runner management
  server          Server management
  token           Authenticate and invite collaborators
  ui              Open the web UI
  version         Prints the version of this Waypoint CLI

You can see that the waypoint up command introduced earlier is a command that collectively executes waypoint build, waypoint deploy, and waypoint relase.

Then download the sample application. In addition to Docker, the sample contains code to deploy to Amazon ECS and Google Cloud Run.

$ git clone https://github.com/hashicorp/waypoint-examples.git
$ cd waypoint-examples
$ ls
README.md                azure-container-instance google-cloud-run         waypoint.hcl
aws-ecs                  data.db                  kubernetes
aws-eks                  docker                   nomad

#This time Node on Docker.I will move js
$ cd docker/nodejs

Install the Waypoint server. The Waypoint server is the console that manages the workflow of your application.

$ docker pull hashicorp/waypoint:latest
$ waypoint install -platform=docker -accept-tos

A deployment configuration file is required to deploy the application. This can be created with the command waypoint init, but the sample application has created the file.

waypoint.hcl


project = "example-nodejs"

app "example-nodejs" {
  labels = {
    "service" = "example-nodejs",
    "env" = "dev"
  }

  build {
    use "pack" {}
  }

  deploy {
    use "docker" {}
  }
}

Initialize the application.

$ waypoint init
✓ Configuration file appears valid
✓ Connection to Waypoint server was successful
✓ Project "example-nodejs" and all apps are registered with the server.
✓ Plugins loaded and configured successfully
✓ Authentication requirements appear satisfied.

Project initialized!

You may now call 'waypoint up' to deploy your project or
commands such as 'waypoint build' to perform steps individually.

And deploy. As you can see by looking at the directory structure of the application, you will notice that the Dockerfile is missing. The way to build it is that Waypoint automatically detects the application type from the file structure and automatically generates the Dockerfile itself using the optimal build pack. smart.

$ waypoint up

It takes time to build, so let's launch Waypoint's UI during this time.

$ waypoint ui

Your browser launches the Waypoint console.

Screen Shot 2020-10-18 at 23.15.30.png

You will be asked for an authentication token first, so let's issue the token from the CLI. You can be authenticated by pasting the generated value into the form.

$ waypoint token new

ʻThe screen of example-nodejs` opens. From this screen, you can execute the build status, deployment log, and even commands to the container.

Screen Shot 2020-10-18 at 23.17.38.png

Let's go back to the CLI and check the build status.

$ waypoint up

» Building...
Creating new buildpack-based image using builder: heroku/buildpacks:18
✓ Creating pack client
✓ Building image
 │ [exporter] Adding 1/1 app layer(s)
 │ [exporter] Reusing layer 'launcher'
 │ [exporter] Adding layer 'config'
 │ [exporter] Adding label 'io.buildpacks.lifecycle.metadata'
 │ [exporter] Adding label 'io.buildpacks.build.metadata'
 │ [exporter] Adding label 'io.buildpacks.project.metadata'
 │ [exporter] *** Images (e2a2e3a85138):
 │ [exporter]       index.docker.io/library/example-nodejs:latest
 │ [exporter] Reusing cache layer 'heroku/nodejs-engine:nodejs'
 │ [exporter] Reusing cache layer 'heroku/nodejs-engine:toolbox'
✓ Injecting entrypoint binary to image

Generated new Docker image: example-nodejs:latest

» Deploying...
✓ Setting up waypoint network
✓ Starting container

» Releasing...

The deploy was successful! A Waypoint deployment URL is shown below. This
can be used internally to check your deployment and is not meant for external
traffic. You can manage this hostname using "waypoint hostname."

           URL: https://***.waypoint.run
Deployment URL: https://***--v1.waypoint.run

Open the URL written in Deployment URL to start the application. ([^ 3])

Screen Shot 2020-10-18 at 23.21.17.png

Since the deployment was successful, let's rewrite the contents of the displayed template.

views/pages/index.js


<h1>This Node.js app was deployed with Waypoint.</h1>
<h2>Hello world!</h2>

I tried adding <h2> under <h1>. Run the deploy again.

           URL: https://***.waypoint.run
Deployment URL: https://***--v2.waypoint.run

The subdomain contained in the Deployment URL has changed to v2.

Screen Shot 2020-10-18 at 23.38.29.png

The Hello World is displayed correctly! ([^ 4])

When I touched it lightly, I got the impression that it was software that abstracts deployment like AWS Elastic Beanstalk. By introducing Waypoint, the deployment flow can be separated from the application configuration, and it seems that the release status of various services can be centrally managed.

[^ 1]: It seems to be used at build time if Dockerfile is detected in the application directory [^ 2]: You need to build a Waypoint server for team development [^ 3]: waypoint.run is a public host provided by HashiCorp. Since it is a verification environment, it is necessary to prepare a host for production operation. See Waypoint URL Service for more information. [^ 4]: You can also open the previous application by accessing the URL of v1

Recommended Posts

Super easy deployment of applications using Waypoint
Example of using vue.config.js
Summary of using FragmentArgs
Groovy super easy introduction
Summary of using DBFlow
[Ruby on Rails] Easy scroll animation of javascript (using ScrollReveal.js)