HelloWorld テスト用 Web アプリケーションの例

ここでは、Next-Gen WAF Golang モジュールに含まれる helloworld の例を、helloworld という名前のテスト Web アプリケーションとして使用します。

main.gosigsci-module-golanghelloworldで参照してください。

Dockerfile

signalsciences/example-helloworld コンテナをビルドするための Dockerfile :

$ docker build . -t signalsciences/example-helloworld:latest
FROM golang:latest
# Image metadata
LABEL com.signalsciences.sigsci-module-golang.examples="helloworld"
LABEL maintainer="Signal Sciences <support@fastly.com>"
# Install sigsci golang module example
RUN go install github.com/signalsciences/sigsci-module-golang/examples/helloworld@latest
ENTRYPOINT [ "helloworld" ]

Kubernetes デプロイファイル

Kubernetes example-helloworld デプロイファイル (Next-Gen WAF エージェントなし):

$ kubectl apply -f example-helloworld.yaml
apiVersion: v1
kind: Service
metadata:
name: helloworld
labels:
app: helloworld
spec:
ports:
- name: http
port: 8000
targetPort: 8000
selector:
app: helloworld
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: helloworld
labels:
app: helloworld
spec:
replicas: 2
selector:
matchLabels:
app: helloworld
template:
metadata:
labels:
app: helloworld
spec:
containers:
- name: helloworld
image: signalsciences/example-helloworld:latest
imagePullPolicy: IfNotPresent
args:
# Address for the app to listen on
- localhost:8000
ports:
- containerPort: 8000