waypoint wip

This commit is contained in:
marcel-dempers 2020-10-23 21:04:56 +11:00
parent 60c5f6062c
commit b40c6bde5c
6 changed files with 112 additions and 1 deletions

5
.gitignore vendored
View File

@ -8,4 +8,7 @@ __pycache__/
.terraform
*.tfstate
*.tfstate.*
security/letsencrypt/introduction/certs/**
security/letsencrypt/introduction/certs/**
hashicorp/waypoint/*/data.db*
hashicorp/waypoint/*/.waypoint

View File

@ -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
```

View File

@ -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

View File

@ -0,0 +1 @@
Flask == 1.0.3

View File

@ -0,0 +1,6 @@
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"

View File

@ -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
}
}
}