Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waypoint #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ __pycache__/
.terraform
*.tfstate
*.tfstate.*
security/letsencrypt/introduction/certs/**
security/letsencrypt/introduction/certs/**

hashicorp/waypoint/*/data.db*
hashicorp/waypoint/*/.waypoint
58 changes: 58 additions & 0 deletions hashicorp/waypoint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Introduction to Waypoint

I will do the following: <br/>

* Run a local Kubernetes cluster with [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/)
* Run a container to extract the windows `waypoint` binary + move it to $PATH


## We need a Kubernetes cluster

Lets create a Kubernetes cluster to play with using [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/)

```
kind create cluster --name waypoint --image kindest/node:v1.19.1
```

## Get the Waypoint binary for Windows

<br/>
Feel free to follow the official install guide using the [docs](https://learn.hashicorp.com/tutorials/waypoint/get-started-install) <br/>

<br/>

Use a container to download and extract the binary:

```
docker run -it --rm -v ${PWD}:/work -w /work alpine sh -c 'apk add --no-cache curl unzip && curl -LO https://releases.hashicorp.com/waypoint/0.1.3/waypoint_0.1.3_windows_amd64.zip && unzip waypoint_0.1.3_windows_amd64.zip && rm waypoint_0.1.3_windows_amd64.zip'

```

I've setup my Windows $PATH environment to point to a folder `C:\kubectl\`

```
mv waypoint.exe C:\kubectl\waypoint.exe

#open new powershell terminal

waypoint --help
```

<br/>

## Install Waypoint server

```
kubectl port-forward svc/waypoint 9701:9701
waypoint install --platform=kubernetes -accept-tos
```


## Waypoint Kubernetes + Python example

```
cd hashicorp/waypoint/python/

waypoint init
waypoint up
```
12 changes: 12 additions & 0 deletions hashicorp/waypoint/python/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.7.3-alpine3.9 as base

RUN mkdir /work/
WORKDIR /work/

COPY requirements.txt /work/requirements.txt
RUN pip install -r requirements.txt

COPY server.py /work/server.py

ENV FLASK_APP=server.py
CMD flask run -h 0.0.0.0 -p 5000
1 change: 1 addition & 0 deletions hashicorp/waypoint/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask == 1.0.3
6 changes: 6 additions & 0 deletions hashicorp/waypoint/python/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
return "Hello World!"
31 changes: 31 additions & 0 deletions hashicorp/waypoint/python/waypoint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
project = "example-nodejs"

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

build {
use "pack" {}
registry {
use "docker" {
image = "aimvector/waypoint-python-example"
tag = "1"
local = false
}
}
}

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

release {
use "kubernetes" {
port = 5000
}
}
}