Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: HTTP reverse proxy cache #3610

Merged
merged 98 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
ec47483
initial Varnish setup
usu Jun 29, 2023
b44d9af
enable xkey purger
usu Jun 29, 2023
99c3723
add resources used in security voters to cache tags; ensures cache is…
usu Jun 30, 2023
6fbecb3
copy PurgeHttpCacheListener from ApiPlatform
usu Jun 30, 2023
ccced29
POC: camp specific URL for category collection
usu Jun 30, 2023
3dbbd5d
fix docker startup sequence
usu Jul 2, 2023
2353348
2nd example for camp specific URL (deeply nested entity)
usu Jul 18, 2023
4b1f3c6
adjust RelatedCollectionLinkNormalizer to use camp specific route if …
usu Jul 18, 2023
c359c19
use new TagCollector service
usu Aug 27, 2023
ec7d36a
use id instead of IRI
usu Aug 27, 2023
2ea5d0c
purge subresources
usu Aug 27, 2023
ece1c18
switch to FosHttpCacheBundle
usu Oct 2, 2023
c809117
merge devel
usu Oct 3, 2023
07962c4
add e2e tests for http cache
usu Oct 7, 2023
617b7e9
merge devel
usu Oct 7, 2023
79e312c
test: invalidate cache on campCollaboration update
usu Oct 8, 2023
9d2f865
implement: invalidate cache on campCollaboration update
usu Oct 8, 2023
0653aab
merge devel
usu Dec 29, 2023
f230aee
fix dependencies from devel merge
usu Dec 29, 2023
285115d
upgrade to api-platform/core main branch (pre-3.3)
usu Dec 29, 2023
a0bc285
fix array access
usu Dec 29, 2023
05262ca
fix end2end-tests
usu Jan 1, 2024
d79ffa0
remove composer-dependency from varnish VCL
usu Jan 1, 2024
3e68564
disable cache purge during unit tests
usu Jan 1, 2024
c762edf
merge devel
usu Jan 1, 2024
da7e085
enable mail and http-cache in CI e2e tests
usu Jan 1, 2024
9737750
remove ScheduleEntry from PR scope + fix API tests
usu Jan 1, 2024
cee4832
fix e2e lint
usu Jan 1, 2024
3bc83d2
only generate tags for routes with caching enabled
usu Jan 2, 2024
4a36fc2
enable cached-API for print
usu Jan 2, 2024
8b48975
only generate tags for routes with caching enabled (refactor)
usu Jan 3, 2024
7bd9bcb
add additional test coverage
usu Jan 3, 2024
afe1a6d
configure deployment for varnish
usu Jan 6, 2024
1195ebd
allow purge requests on port 8081 only
usu Jan 7, 2024
1710525
reset cache-control header after varnish
usu Jan 7, 2024
b3b6dc3
change api-platform/core back to main branch
usu Jan 9, 2024
60ce02f
use COOKIE_PREFIX in JWT cookie extraction
usu Jan 14, 2024
60cc980
same port config on localhost as on deployment
usu Jan 14, 2024
eb3210b
allow enabling/disabling caching via environment variables
usu Jan 14, 2024
2a63d18
disable caching for requests with query params
usu Jan 14, 2024
a806c73
allow enabling/disabling caching in deploymet (default:disabled)
usu Jan 14, 2024
4fa3b28
enable cache again (for the purpose of testing this PR)
usu Jan 14, 2024
64c651c
upgrade to http-cache-bundle/3.x-dev
usu Jan 23, 2024
417441d
merge devel
usu Jan 23, 2024
562041d
use use_symfony_listeners for backwards compatibility
usu Jan 23, 2024
8c4aaca
fix API tests (after upgrade to api-platform 3.3)
usu Jan 23, 2024
9921354
fix e2e tests
usu Jan 23, 2024
7703e00
use new enable_link_security to protect subresources
usu Jan 23, 2024
b68c6ba
fix tests
usu Jan 24, 2024
b76ae5b
merge devel
usu Mar 30, 2024
c13290a
fix cs & psalm
usu Mar 30, 2024
ed26dc7
fix e2e tests
usu Mar 31, 2024
5745469
merge devel
usu Mar 31, 2024
5192278
deployment sidecar for logging & prometheus metrics
usu Mar 31, 2024
ac67488
fix deployment: reduce port name length
usu Mar 31, 2024
aa6401a
improve logging format and try fixing user permission
usu Apr 1, 2024
4419f41
merge devel
usu Apr 28, 2024
de2c216
use own Dockerfile for varnish
usu Apr 28, 2024
547bb02
copy PurgeHttpCacheListenerTest from ApiPlatform
usu Apr 28, 2024
27f9450
remove unnecessary test entities
usu Apr 28, 2024
ec122df
fix & adapt legacy tests
usu Apr 28, 2024
d846b19
fix phpstan
usu Apr 28, 2024
7be7027
fix e2e test
usu Apr 28, 2024
1152865
merge devel
usu May 4, 2024
ff3d262
upgrade to api-platform 3.3.2
usu May 4, 2024
04c764e
extend e2e tests by comparing response body
usu May 4, 2024
d4d1a25
update snapshots
usu May 4, 2024
1aaab39
take over changes from upstream PurgeHttpCacheListener (compatibility…
usu May 4, 2024
75ad228
extend PurgeHttpCacheListenerTest
usu May 4, 2024
4d8c949
add tests for TagCollector
usu May 4, 2024
9ada6e8
fix eslint
usu May 4, 2024
3e38717
varnishncsa: also log backend errors
usu May 4, 2024
4ace13c
fix psalm
usu May 4, 2024
eb4d98c
utilize ApiProperty uriTemplate
usu May 4, 2024
288220d
merge devel
usu May 4, 2024
3a8b16b
upgrade http-cache and http-cache-bundle to 3.0.0
usu May 4, 2024
df27b33
adjust number of queries
usu May 4, 2024
a532c21
revert dry-run on deploy-to-cluster.sh
usu May 4, 2024
ae74c7b
use MailDev REST Api
usu May 13, 2024
ad6cabc
merge devel
usu May 13, 2024
a05fdec
revert changes to nuxtPrint.cy.js
usu May 13, 2024
c04ebb7
use parameter for path match regex
usu May 13, 2024
e851ff4
improve header & license information
usu May 13, 2024
73b4d1e
remove duplicate package symfony/http-client
usu May 13, 2024
a3318ab
merge devel
usu May 15, 2024
7353997
merge chore/performance-period-endpoint-2
usu May 15, 2024
d7212f3
remove tmpfs
usu May 15, 2024
459f198
update snapshots
usu May 15, 2024
8e146b3
apiCache.enabled now defaults to false
usu May 15, 2024
6805865
composer update
usu May 15, 2024
51788fd
merge devel
usu May 15, 2024
3f604db
delete: use orignal entity data to generate collection rotues; update…
usu May 18, 2024
fd99973
merge devel
usu May 18, 2024
dd199d7
don't catch InvalidArgumentException|OperationNotFoundException in Pu…
usu May 21, 2024
5c82d0c
merge devel
usu May 21, 2024
81509a7
fix psalm
usu May 25, 2024
f0c9260
merge devel
usu May 25, 2024
fac40ca
fix test
usu May 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .docker-hub/varnish/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG VERSION=7.5.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly copied from https://github.com/softonic/varnish/blob/master/Dockerfile

As an alternative, we could also set this up as an independent package outside of this repository (e.g. ecamp/varnish) and regularly build/deploy on docker hub. Both is ok for me.


FROM varnish:${VERSION}

USER root

RUN set -e; \
apt-get update; \
apt-get -y install prometheus-varnish-exporter;

RUN rm -rf /var/lib/apt/lists/*;

USER varnish
12 changes: 12 additions & 0 deletions .github/workflows/reusable-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ jobs:
cache-from: type=gha,scope=print
cache-to: type=gha,scope=print,mode=max

- name: Build and push varnish docker image
uses: docker/build-push-action@v5
with:
push: true
file: .docker-hub/varnish/Dockerfile
tags: |
${{ ((inputs.tag != '') && format('{0}/ecamp3-varnish:{1}', vars.DOCKER_HUB_USERNAME, inputs.tag) || '') }}
${{ vars.DOCKER_HUB_USERNAME }}/ecamp3-varnish:${{ inputs.sha }}
context: .
cache-from: type=gha,scope=print
cache-to: type=gha,scope=print,mode=max

- name: Build and push db-backup-restore docker image
uses: docker/build-push-action@v5
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reusable-dev-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
--set ingress.basicAuth.enabled=${{ vars.BASIC_AUTH_ENABLED || false }} \
--set ingress.basicAuth.username=${{ secrets.BASIC_AUTH_USERNAME }} \
--set ingress.basicAuth.password='${{ secrets.BASIC_AUTH_PASSWORD }}' \
--set apiCache.enabled=${{ vars.API_CACHE_ENABLED || false }} \
--set mail.dummyEnabled=true \
--set postgresql.url='${{ secrets.POSTGRES_URL }}/ecamp3${{ inputs.name }}?sslmode=require' \
--set postgresql.adminUrl='${{ secrets.POSTGRES_ADMIN_URL }}/ecamp3${{ inputs.name }}?sslmode=require' \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-e2e-tests-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
docker-compose-

# start necessary containers
- run: docker compose up -d php caddy frontend pdf print browserless database docker-host
- run: docker compose up -d php caddy frontend pdf print browserless database docker-host http-cache mail

- uses: cypress-io/github-action@v5
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reusable-stage-prod-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
--set ingress.basicAuth.enabled=${{ vars.BASIC_AUTH_ENABLED || false }} \
--set ingress.basicAuth.username=${{ secrets.BASIC_AUTH_USERNAME }} \
--set ingress.basicAuth.password='${{ secrets.BASIC_AUTH_PASSWORD }}' \
--set apiCache.enabled=${{ vars.API_CACHE_ENABLED || false }} \
--set mail.dsn=${{ secrets.MAILER_DSN }} \
--set postgresql.url='${{ secrets.POSTGRES_URL }}/${{ secrets.DB_NAME }}?sslmode=require' \
--set postgresql.dropDBOnUninstall=false \
Expand Down
2 changes: 2 additions & 0 deletions .helm/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ domain=ecamp3.ch
POSTGRES_URL=
POSTGRES_ADMIN_URL=

API_CACHE_ENABLED=false

BASIC_AUTH_ENABLED=false
BASIC_AUTH_USERNAME=test
BASIC_AUTH_PASSWORD=test
Expand Down
4 changes: 4 additions & 0 deletions .helm/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ print_image_tag="${docker_hub_account}/ecamp3-print:${version}"
docker build "$REPO_DIR" -f "$REPO_DIR"/.docker-hub/print/Dockerfile $print_sentry_build_args -t "$print_image_tag"
docker push "$print_image_tag"

varnish_image_tag="${docker_hub_account}/ecamp3-varnish:${version}"
docker build "$REPO_DIR" -f "$REPO_DIR"/.docker-hub/varnish/Dockerfile -t "$varnish_image_tag"
docker push "$varnish_image_tag"

export REPO_OWNER=${docker_hub_account}
export VERSION=${version}
db_backup_restore_docker_compose_path="$REPO_DIR"/.helm/ecamp3/files/db-backup-restore-image/docker-compose.yml
Expand Down
3 changes: 3 additions & 0 deletions .helm/deploy-to-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ for i in 1; do
values="$values --set ingress.basicAuth.enabled=$BASIC_AUTH_ENABLED"
values="$values --set ingress.basicAuth.username=$BASIC_AUTH_USERNAME"
values="$values --set ingress.basicAuth.password=$BASIC_AUTH_PASSWORD"
values="$values --set apiCache.enabled=$API_CACHE_ENABLED"
values="$values --set postgresql.enabled=false"
values="$values --set postgresql.url=$POSTGRES_URL/ecamp3$instance_name-"$i"?sslmode=require"
values="$values --set postgresql.adminUrl=$POSTGRES_ADMIN_URL/ecamp3$instance_name-"$i"?sslmode=require"
Expand Down Expand Up @@ -98,6 +99,8 @@ for i in 1; do
values="$values --set $imagespec.image.repository=docker.io/${docker_hub_account}/ecamp3-api-$imagespec"
done

values="$values --set apiCache.image.repository=docker.io/${docker_hub_account}/ecamp3-varnish"

values="$values --set postgresql.dbBackupRestoreImage.pullPolicy=$pull_policy"
values="$values --set postgresql.dbBackupRestoreImage.repository=docker.io/${docker_hub_account}/ecamp3-db-backup-restore"

Expand Down
1 change: 1 addition & 0 deletions .helm/ecamp3/files/vcl
21 changes: 21 additions & 0 deletions .helm/ecamp3/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- end }}
{{- end }}

{{/*
Name for all HTTP cache-related resources.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "apiCache.name" -}}
{{- $name := default .Chart.Name .Values.chartNameOverride }}
{{- if contains $name (include "app.name" .) }}
{{- printf "%s-api-cache" (include "app.name" .) | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s-api-cache" (include "app.name" .) $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}

{{/*
Name for all db_backup_job releated resources.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down Expand Up @@ -227,6 +240,14 @@ app.kubernetes.io/name: {{ include "chart.name" . }}-browserless
{{ include "app.commonSelectorLabels" . }}
{{- end }}

{{/*
Selector labels for HTTP Cache
*/}}
{{- define "apiCache.selectorLabels" -}}
app.kubernetes.io/name: {{ include "chart.name" . }}-api-cache
{{ include "app.commonSelectorLabels" . }}
{{- end }}

{{/*
Selector labels for db-backup-job
*/}}
Expand Down
116 changes: 116 additions & 0 deletions .helm/ecamp3/templates/api_cache_deployment.yaml
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The varnish deployment setup is mostly copied from https://github.com/softonic/varnish-chart/blob/master/templates/deployment.yaml

However, I made some simplifications. And there were some missing things, that prevented me, from directly using their chart.

Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{{- if .Values.apiCache.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "apiCache.name" . }}
labels:
{{- include "apiCache.selectorLabels" . | nindent 4 }}
{{- include "app.commonLabels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "apiCache.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "apiCache.selectorLabels" . | nindent 8 }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could add an annotation with the shasum of the confimap.
Then the deployment is recreated on config changes.
checksum/config: {{ include (print $.Template.BasePath "/api_cache_vcl_configmap.yaml") . | sha256sum }}
(except if varnish supports hot reloading of the config)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with 5192278

Probably this line is obsolete, because I also included rollme (=pod is recreated for each new imageTag/commit). But bether to include both and to be on the safe side.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you only change the config after some problem and then redeploy with the same image tag.
-> checksum/vclConfigmap is needed, the imageTag should anyway be in the image

annotations:
checksum/vclConfigmap: {{ include (print $.Template.BasePath "/api_cache_vcl_configmap.yaml") . | sha256sum }}
rollme: {{ .Values.imageTag | quote }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "app.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
enableServiceLinks: false
containers:
- name: {{ .Chart.Name }}-api-cache-varnishd
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.apiCache.image.repository }}:{{ .Values.apiCache.image.tag | default .Values.imageTag }}"
imagePullPolicy: {{ .Values.apiCache.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.apiCache.varnishHttpPort }}
protocol: TCP
- name: purge
containerPort: {{ .Values.apiCache.varnishPurgePort }}
protocol: TCP
env:
- name: VARNISH_SIZE
value: "{{ .Values.apiCache.varnishSize }}"
- name: VARNISH_HTTP_PORT
value: "{{ .Values.apiCache.varnishHttpPort }}"
- name: COOKIE_PREFIX
value: {{ include "api.cookiePrefix" . | quote }}
args:
- -a
- {{ printf ":%d,HTTP" (.Values.apiCache.varnishPurgePort | int) }}
- -p
- http_max_hdr=96
resources:
{{- toYaml .Values.apiCache.resources | nindent 12 }}
volumeMounts:
- name: vcl-configmap
mountPath: /etc/varnish
- name: vsm
mountPath: /var/lib/varnish
{{- if .Values.apiCache.logging.enabled }}
- name: {{ .Chart.Name }}-api-cache-varnishncsa
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.apiCache.image.repository }}:{{ .Values.apiCache.image.tag | default .Values.imageTag }}"
imagePullPolicy: {{ .Values.apiCache.image.pullPolicy }}
command:
- varnishncsa
- -b
- -c
{{- if .Values.apiCache.logging.customOutputJsonFormat }}
- -j
{{- end }}
{{- if .Values.apiCache.logging.customOutput }}
- -F
- {{ .Values.apiCache.logging.customOutput | squote }}
{{- end }}
- -t
- {{ .Values.apiCache.logging.timeout | quote }}
resources:
{{- toYaml .Values.apiCache.logging.resources | nindent 12 }}
volumeMounts:
- name: vsm
mountPath: /var/lib/varnish
{{- end }}
{{- if .Values.apiCache.prometheus.enabled }}
carlobeltrame marked this conversation as resolved.
Show resolved Hide resolved
- name: {{ .Chart.Name }}-api-cache-prometheus-exporter
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.apiCache.image.repository }}:{{ .Values.apiCache.image.tag | default .Values.imageTag }}"
imagePullPolicy: {{ .Values.apiCache.image.pullPolicy }}
ports:
- name: metrics
containerPort: {{ .Values.apiCache.prometheus.port }}
protocol: TCP
resources:
{{- toYaml .Values.apiCache.prometheus.resources | nindent 12 }}
command:
- prometheus-varnish-exporter
- -web.telemetry-path
- "{{ .Values.apiCache.prometheus.path }}"
- -web.listen-address
- ":{{ .Values.apiCache.prometheus.port }}"
volumeMounts:
- name: vsm
mountPath: /var/lib/varnish
{{- end }}
volumes:
- name: vcl-configmap
configMap:
name: {{ include "apiCache.name" . }}-vcl-configmap
- name: vsm
emptyDir:
medium: Memory
{{- end }}
26 changes: 26 additions & 0 deletions .helm/ecamp3/templates/api_cache_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if .Values.apiCache.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "apiCache.name" . }}
labels:
{{- include "apiCache.selectorLabels" . | nindent 4 }}
{{- include "app.commonLabels" . | nindent 4 }}
spec:
type: {{ .Values.apiCache.service.type }}
ports:
- port: {{ .Values.apiCache.service.ports.http }}
targetPort: http
protocol: TCP
name: http
- port: {{ .Values.apiCache.service.ports.purge }}
targetPort: purge
protocol: TCP
name: purge
- port: {{ .Values.apiCache.prometheus.port }}
targetPort: metrics
protocol: TCP
name: metrics
selector:
{{- include "apiCache.selectorLabels" . | nindent 4 }}
{{- end }}
18 changes: 18 additions & 0 deletions .helm/ecamp3/templates/api_cache_vcl_configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.apiCache.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "apiCache.name" . }}-vcl-configmap
labels:
{{- include "apiCache.selectorLabels" . | nindent 4 }}
{{- include "app.commonLabels" . | nindent 4 }}
data:
# includes all files except the ones starting with _
{{ (.Files.Glob "files/vcl/[!_]*").AsConfig | indent 2 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this also excludes any hidden files (files starting with a period .). That's fine I guess, but maybe we want to document this in the comment as well?

# override backend config
_config.vcl: |-
backend default {
.host = "{{ include "api.name" .}}";
.port = "{{ .Values.api.service.port }}";
}
{{- end }}
6 changes: 6 additions & 0 deletions .helm/ecamp3/templates/api_configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ data:
SENTRY_API_DSN: {{ "" | quote }}
{{- end }}
FRONTEND_BASE_URL: {{ include "frontend.url" . | quote }}
API_CACHE_ENABLED: {{ .Values.apiCache.enabled | quote }}
{{- if .Values.apiCache.enabled }}
VARNISH_API_URL: {{ printf "%s:%d" (include "apiCache.name" .) (.Values.apiCache.service.ports.purge | int) | quote }}
{{- else }}
VARNISH_API_URL: {{ "" | quote }}
{{- end}}
6 changes: 6 additions & 0 deletions .helm/ecamp3/templates/api_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ spec:
pathType: Prefix
backend:
service:
{{- if .Values.apiCache.enabled }}
name: {{ include "apiCache.name" . }}
port:
number: {{ .Values.apiCache.service.ports.http }}
{{- else }}
name: {{ include "api.name" . }}
port:
number: {{ .Values.api.service.port }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions .helm/ecamp3/templates/print_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
{{- end }}
{{- include "ingress.basicAuth.annotations" . | nindent 4 }}
{{- if not (.Values.print.ingress.readTimeoutSeconds | empty) }}
nginx.ingress.kubernetes.io/use-regex: "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

nginx.ingress.kubernetes.io/proxy-read-timeout: {{ .Values.print.ingress.readTimeoutSeconds | quote }}
{{- end }}
spec:
Expand Down
43 changes: 42 additions & 1 deletion .helm/ecamp3/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,48 @@ ingress:
className: nginx
tls:


apiCache:
enabled: false
image:
repository: "docker.io/ecamp/ecamp3-varnish"
pullPolicy: IfNotPresent
# Overrides the image tag whose shared default is .Values.imageTag
tag:
service:
type: ClusterIP
ports:
http: 3000
purge: 3001
varnishSize: 50M
varnishHttpPort: 8080
varnishPurgePort: 8081
resources:
requests:
cpu: 10m
memory: 100Mi
logging:
enabled: true
customOutput: '{ "received_at": "%t", "varnish_side": "%{Varnish:side}x", "method": "%m", "url": "%U", "query": "%q", "response_bytes": %b, "time_taken": %D, "status": %s, "handling": "%{Varnish:handling}x", "response_reason": "%{VSL:RespReason}x", "fetch_error": "%{VSL:FetchError}x" }'
customOutputJsonFormat: true
# Timeout before returning error on initial VSM connection.
# If set the VSM connection is retried every 0.5 seconds for this many seconds.
# If zero the connection is attempted only once and will fail immediately if unsuccessful.
# If set to "off", the connection will not fail, allowing the utility to start and wait indefinetely for the Varnish instance to appear.
# Defaults to "off" in this case.
timeout: "off"
resources:
requests:
cpu: 10m
memory: 20Mi
prometheus:
enabled: true
path: "/metrics"
port: 9131
resources:
requests:
cpu: 10m
memory: 20Mi

autoscaling:
enabled: false
minReplicas: 1
Expand Down
10 changes: 10 additions & 0 deletions .ops/observability/prometheus-values-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ prometheus:
- default
endpoints:
- port: "api-metrics"
- name: "varnish"
selector:
matchLabels:
app.kubernetes.io/instance: ecamp3-dev
app.kubernetes.io/name: ecamp3-api-cache
namespaceSelector:
matchNames:
- default
endpoints:
- port: "api-cache-metrics"
prometheusSpec:
storageSpec:
volumeClaimTemplate:
Expand Down
Loading
Loading