Waypoint with Docker!

Mehmet Ali Baykara
3 min readOct 20, 2020

Currently, the DevOps landscape is growing extremely fast and there are a lot of tools appearing newly. Lastly, Hashicorp comes up with a new tool called Waypoint and I do believe the Waypoint will have a huge effect on the deployment and as well as the development process of many corporations. To be honest, Waypoint is simply awesome!

https://github.com/hashicorp/waypoint

Waypoint is definitely easy to start and it has comprehensive documentation to start with immediately. It is working perfectly with cloud providers such as AWS, Azure, GKE, and as well as well integrated with GitLab and GitHub.

Entire CI/CD with one tool/file :) Everything is a file :)

I will demonstrate how to simply launch your application with Waypoint using Docker.

Before we move further if you do not have the Docker on machine, please install it! From here

0. Step: Waypoint installation

You can run the script that I provided or run the commands below respectively: script

 $ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -$ sudo apt-add-repository “deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main”$ sudo apt-get update && sudo apt-get install waypoint

You verify the installation by hitting waypoint version.

Waypoint v0.1.3 (cf5706e9) #current version

We’ve installed Docker and Waypoint! Let’s take a look at the awesome part!

  1. Step: Setting up Waypoint Server

This will also run in docker, therefore we have to pull the official image provided by Hashicorp from DockerHub.

$ docker pull hashicorp/waypoint:latest

From now on the image has been pulled can move to the next step by starting the server. Run the command below: According to the official documentation: ‘The -accept-tos flag confirms that you accept the terms of service for our application URL service.”

$ waypoint install -platform=docker -accept-tos

2. Step: Cloning the repository for the demo and create waypoint.hcl` file

I will use my GitHub Page for this demo. Simply cloning on my local machine:

$ git clone https://github.com/mbaykara/mbaykara.github.io.git
$ cd mbaykara.github.com.io
#see is a really simple website, btw I have no time to make my own cv :)
$ tree
├── css
│ └── background.css
├── Dockerfile
├── index.html
├── install.sh
├── js
│ └── script.js
├── LICENSE
├── README.md

Now we can create waypoint.hcl file by hitting terminal in your directory:

$ waypoint init
$ tree
├── css
│ └── background.css
├── Dockerfile
├── index.html
├── install.sh
├── js
│ └── script.js
├── LICENSE
├── README.md
└── waypoint.hcl

So the configuration file is created by waypoint. As you see there is only one single file waypoint.hclbeside Dockerfile, which contains the entire deployment.

Our focus is on the magical waypoint.hcl` file. The .hcl` extension stand for HashiCorp Configuration Language built by HashiCorp. The Visual Studio Code extension is available.

The waypoint.hcl looks like below:

Hence I would like to deploy my website via Nginx, I added additionally service_port=80.

#The unique project name that i gave
project = “mbaykara.github.io”
# An application to deploy.I called it resume
app “resume” {
build {
use “docker” {} #we'll use docker, but could be AWS,GKE etc.
}
# Deploy to Docker
deploy {
use “docker” {
service_port=80
}
}
}

Finally, run thewaypoint up command from CLI:

The CLI should look like:

The notice that is building the docker image and then deploy it. The see the application click the Deployment URLhttps://barely-secure-shrew--v6.waypoint.run/`

Lastly, do tidy up waypoint destroy will remove container and clean up.

To be honest I am really excited to work with waypoint. It is a simply clever solution DevOps.

Note that this was a really short introduction based on Docker. There are lots of examples provided by HashiCorp. Please check out from here.

Resources:https://learn.hashicorp.com/waypoint

--

--