feat: enable metrics

This commit is contained in:
Peter Kurfer 2022-12-29 11:46:05 +01:00
parent 6c791e0492
commit 9a0fbaadce
No known key found for this signature in database
4 changed files with 51 additions and 10 deletions

View file

@ -1,12 +1,24 @@
FROM docker.io/alpine:latest as builder FROM docker.io/alpine:latest as builder
WORKDIR /tmp
RUN apk add -U --no-cache hugo curl tar jq && \
export CADDY_VERSION=$(curl https://api.github.com/repos/caddyserver/caddy/releases/latest | jq -r '.tag_name | (sub("v";""))') && \
curl -L https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz | tar -xvz caddy
WORKDIR /src WORKDIR /src
COPY . /src/ COPY . /src/
RUN apk add -U hugo && \ RUN hugo --minify --environment production --config config.toml
hugo --minify --environment production --config config.toml
FROM docker.io/caddy:2-alpine FROM gcr.io/distroless/static as final
COPY --from=builder /tmp/caddy /bin
COPY --from=builder /src/public /usr/share/caddy COPY --from=builder /src/public /usr/share/caddy
COPY deploy/caddy/caddy.json /etc/caddy/caddy.json
EXPOSE 3000
ENTRYPOINT [ "/bin/caddy" ]
CMD [ "run", "--config=/etc/caddy/caddy.json" ]

30
deploy/caddy/caddy.json Normal file
View file

@ -0,0 +1,30 @@
{
"apps": {
"http": {
"servers": {
"blog": {
"listen": [
":3000"
],
"routes": [
{
"handle": [
{
"handler": "file_server",
"root": "/usr/share/caddy",
"index_names": [
"index.html"
],
"pass_thru": true
},
{
"handler": "metrics"
}
]
}
]
}
}
}
}
}

View file

@ -34,15 +34,15 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: 3000
protocol: TCP protocol: TCP
livenessProbe: livenessProbe:
httpGet: httpGet:
path: / path: /metrics
port: http port: http
readinessProbe: readinessProbe:
httpGet: httpGet:
path: / path: /metrics
port: http port: http
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}

View file

@ -10,8 +10,7 @@ image:
# Overrides the image tag whose default is the chart appVersion. # Overrides the image tag whose default is the chart appVersion.
tag: "latest" tag: "latest"
imagePullSecrets: imagePullSecrets: []
- name: ghcr-login-secret
nameOverride: "" nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
@ -30,7 +29,7 @@ securityContext: {}
service: service:
type: ClusterIP type: ClusterIP
port: 80 port: 3000
ingress: ingress:
enabled: true enabled: true