Example helloworld test web application

This uses the helloworld example included with the Signal Sciences Golang module as a test web application named helloworld.

See main.go in the sigsci-module-golang helloworld example.

Dockerfile

Dockerfile to build the signalsciences/example-helloworld container:

$ docker build . -t signalsciences/example-helloworld:latest
1FROM golang:1.13
2
3# Image metadata
4LABEL com.signalsciences.sigsci-module-golang.examples="helloworld"
5LABEL maintainer="Signal Sciences <support@fastly.com>"
6
7# Install sigsci golang module (with examples)
8RUN go get github.com/signalsciences/sigsci-module-golang
9
10# Use the helloworld example as the test app
11WORKDIR /go/src/github.com/signalsciences/sigsci-module-golang/examples
12
13ENTRYPOINT [ "go", "run", "./helloworld" ]

Kubernetes deployment file

Kubernetes example-helloworld deployment file (without the Signal Sciences Agent):

$ kubectl apply -f example-helloworld.yaml
1apiVersion: v1
2kind: Service
3metadata:
4 name: helloworld
5 labels:
6 app: helloworld
7spec:
8 ports:
9 - name: http
10 port: 8000
11 targetPort: 8000
12 selector:
13 app: helloworld
14 type: LoadBalancer
15---
16apiVersion: apps/v1
17kind: Deployment
18metadata:
19 name: helloworld
20 labels:
21 app: helloworld
22spec:
23 replicas: 2
24 selector:
25 matchLabels:
26 app: helloworld
27 template:
28 metadata:
29 labels:
30 app: helloworld
31 spec:
32 containers:
33 - name: helloworld
34 image: signalsciences/example-helloworld:latest
35 imagePullPolicy: IfNotPresent
36 args:
37 # Address for the app to listen on
38 - localhost:8000
39 ports:
40 - containerPort: 8000
Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support. This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.