This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ykyuen@camus:~# boatswain --help | |
Usage: boatswain [options] | |
Options: | |
-f string | |
boatswain configuration file. | |
-v Show boatswain version and exit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Please register and get the token from https://app.boatswain.io/ | |
token: token_here | |
# Period is the collection time interval of the host and docker metrics. | |
# CPU load could be reduced by using longer period. | |
# - short = 10s | |
# - default = 30s | |
# - long = 60s | |
period: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ykyuen@camus ~]$ kubectl get ds -n boatswain | |
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE | |
boatswain 1 1 1 1 1 kubernetes.io/hostname=gke-boatswain-default-pool-v2-1234abcd-5678 52s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: DaemonSet | |
metadata: | |
name: boatswain | |
namespace: boatswain | |
spec: | |
selector: | |
matchLabels: | |
name: boatswain | |
template: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handling-http-request-in-go-echo-example-2/ | |
├── api/ # folder of api endpoints | |
│ ├── get_full_name.go # api for get full name | |
│ ├── post_full_name.go # api for post full name | |
├── handler/ # folder of request handlers | |
│ ├── home_handler.go # handler for home page | |
│ └── about_handler.go # handler for about page | |
├── model/ # folder of custom struct types | |
│ ├── example_request.go # struct type of get_full_name request | |
│ └── example_response.go # hstruct type of get_full_name response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{define "base.html"}} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>{{template "title" .}}</title> | |
<!-- jQuery --> | |
<script | |
src="https://code.jquery.com/jquery-3.3.1.min.js" | |
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" | |
crossorigin="anonymous"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{define "title"}} | |
Boatswain Blog | {{index . "name"}} | |
{{end}} | |
{{define "body"}} | |
<h1>{{index . "msg"}}</h1> | |
<h2>This is the about page.</h2> | |
<!-- HTML form --> | |
<form id="post-full-name-form"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
func main() { | |
// Echo instance | |
e := echo.New() | |
// Instantiate a template registry with an array of template set | |
// Ref: https://gist.github.com/rand99/808e6e9702c00ce64803d94abff65678 | |
templates := make(map[string]*template.Template) | |
templates["home.html"] = template.Must(template.ParseFiles("view/home.html", "view/base.html")) | |
templates["about.html"] = template.Must(template.ParseFiles("view/about.html", "view/base.html")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"net/http" | |
"github.com/labstack/echo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handling-http-request-in-go-echo-example-1/ | |
├── api/ # folder of api endpoints | |
│ ├── get_full_name.go # api for get full name | |
├── handler/ # folder of request handlers | |
│ ├── home_handler.go # handler for home page | |
│ └── about_handler.go # handler for about page | |
├── model/ # folder of custom struct types | |
│ ├── example_request.go # struct type of get_full_name request | |
│ └── example_response.go # hstruct type of get_full_name response | |
├── vendor/ # dependencies managed by dep |
NewerOlder