Getting Started with HashiCorp Waypoint: How to deploy a python app using flask & Docker

Waypoint is a new software delivery tool made by HashiCorp, released last week. It’s a new abstraction layer over the build-deploy-release pipeline which provides an ‘infrastructure as code’ like approach to the entire delivery flow.

In this post we’ll cover a couple of introductory operations:

  • Build & deploy a Docker image containing a python flask application
  • Push the docker image into a Docker registry

Build a docker image containing a flask application

Install Waypoint CLI for Mac OS X (for others see here):

brew tap hashicorp/tapbrew install hashicorp/tap/waypoint

Assuming you already have Docker for desktop, install a Docker image of Waypoint’s server:

docker pull hashicorp/waypoint:latest

Using the downloaded CLI, start a Waypoint server over a Docker container:

waypoint install -platform=docker -accept-tos

Using git, clone the example flask project (inspired by Waypoint’s python project) containing a flask application, a Docker image and a Waypoint configuration file:

git clone https://github.com/michaelloewenstein/waypoint.git

Initialise and run the flask application using Waypoint CLI:

waypoint init
waypoint up

The application is now running, deployed over our local Docker environment!

Push the docker image into a Docker registry

Let’s customize the delivery flow and add an update into our Docker repository; we’ll use a Docker Hub repository. Notice we’ve added a new registry component as part of our .hcl configuration:

project = "example-python"

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

build {
use "docker" {}
registry {
use "docker" {
image = "michaelloewensteinandco/waypoint"
tag = "latest"
}
}
}

deploy {
use "docker" {
service_port = 8080
}
}
}

Make sure you are logged in into Docker hub (docker login) as Waypoint doesn’t support authentication as part of it’s workflow.

Now let’s re-run Waypoint and see the addition:

The application is not only deployed but also pushed our latest Docker image into the repository.

What’s next ?

There are many other features that Waypoint provides and I encourage you to check out the docs. Overall it’s an interesting new tool and mostly a new approach for abstracting software delivery.

What do you think? let me know what you think on this new approach; comment here or send me a message!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michael Loewenstein

Michael Loewenstein

8 Followers

👨🏻‍💻 Engineering Leader ⛰️ Software Developer ☁️ Cloud Solution Architect