Skip to content

Commit 201fcc3

Browse files
Started canary app
1 parent 39c8346 commit 201fcc3

File tree

6 files changed

+143
-0
lines changed

6 files changed

+143
-0
lines changed

source-code-canary/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM golang:1.16-alpine3.13 AS build-env
2+
3+
WORKDIR /tmp/workdir
4+
5+
COPY . .
6+
7+
RUN CGO_ENABLED=0 GOOS=linux go build
8+
9+
FROM alpine:3.13
10+
11+
EXPOSE 8080
12+
13+
RUN apk add --no-cache ca-certificates bash
14+
15+
COPY --from=build-env /tmp/workdir/static /app/static
16+
COPY --from=build-env /tmp/workdir/canary-app /app/canary-app
17+
18+
WORKDIR /app
19+
20+
CMD ["./canary-app"]

source-code-canary/app.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
)
7+
8+
func main() {
9+
10+
version := "1.0"
11+
12+
color := "#44B3C2" //Blue 44B3C2 and Yellow F1A94E
13+
14+
http.HandleFunc("/callme", func(w http.ResponseWriter, r *http.Request) {
15+
fmt.Fprintf(w, "<div class='pod' style='background:%s'> ver: %s\n </div>", color, version)
16+
})
17+
18+
fs := http.FileServer(http.Dir("./static"))
19+
http.Handle("/", fs)
20+
21+
fmt.Println("Listening now at port 8080")
22+
http.ListenAndServe(":8080", nil)
23+
}

source-code-canary/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/codefresh-contrib/gitops-certification-examples/canary-app
2+
3+
go 1.16

source-code-canary/static/favicon.png

771 Bytes
Loading

source-code-canary/static/index.html

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<title>Canary demo</title>
5+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
6+
<link rel="shortcut icon" href="favicon.png" type="image/png" />
7+
<link rel="stylesheet" type="text/css" href="style.css"/>
8+
<title>Rounded Corner Boxes</title>
9+
<script src="https://unpkg.com/[email protected]"></script>
10+
</head>
11+
<body>
12+
<h1> Request dashboard</h1>
13+
<div class="box" hx-get="callme" hx-trigger="every 3s">
14+
<h2>Pod request</h2>
15+
</div>
16+
<div class="box" hx-get="callme" hx-trigger="every 3s">
17+
<h2>Pod request</h2>
18+
</div>
19+
<div class="box" hx-get="callme" hx-trigger="every 3s">
20+
<h2>Pod request</h2>
21+
</div>
22+
<div class="box" hx-get="callme" hx-trigger="every 3s">
23+
<h2>Pod request</h2>
24+
</div>
25+
<div class="box" hx-get="callme" hx-trigger="every 3s">
26+
<h2>Pod request</h2>
27+
</div>
28+
<div class="box" hx-get="callme" hx-trigger="every 3s">
29+
<h2>Pod request</h2>
30+
</div>
31+
<div class="box" hx-get="callme" hx-trigger="every 3s">
32+
<h2>Pod request</h2>
33+
</div>
34+
<div class="box" hx-get="callme" hx-trigger="every 3s">
35+
<h2>Pod request</h2>
36+
</div>
37+
<div class="box" hx-get="callme" hx-trigger="every 3s">
38+
<h2>Pod request</h2>
39+
</div>
40+
<div class="box" hx-get="callme" hx-trigger="every 3s">
41+
<h2>Pod request</h2>
42+
</div>
43+
<div class="box" hx-get="callme" hx-trigger="every 3s">
44+
<h2>Pod request</h2>
45+
</div>
46+
<div class="box" hx-get="callme" hx-trigger="every 3s">
47+
<h2>Pod request</h2>
48+
</div>
49+
<div class="box" hx-get="callme" hx-trigger="every 3s">
50+
<h2>Pod request</h2>
51+
</div>
52+
<div class="box" hx-get="callme" hx-trigger="every 3s">
53+
<h2>Pod request</h2>
54+
</div>
55+
<div class="box" hx-get="callme" hx-trigger="every 3s">
56+
<h2>Pod request</h2>
57+
</div>
58+
<div class="box" hx-get="callme" hx-trigger="every 3s">
59+
<h2>Pod request</h2>
60+
</div>
61+
</body>
62+
</html>
63+

source-code-canary/static/style.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
body {
2+
margin:10px;
3+
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif
4+
}
5+
6+
.box {
7+
width:200px;
8+
height:200px;
9+
margin:10px;
10+
padding:10px;
11+
float: left;
12+
}
13+
14+
.pod
15+
{
16+
width:100%;
17+
height:100%;
18+
border-radius: 2px;
19+
justify-content: center;
20+
align-items: center;
21+
display: flex;
22+
font-size: x-large;
23+
}
24+
25+
.box {
26+
background:rgb(105, 105, 105);
27+
border-radius: 25px;
28+
}
29+
30+
31+
h2, p {
32+
padding:5px;
33+
}
34+

0 commit comments

Comments
 (0)