Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions charts/shopware/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,23 @@ secretAccessKeyRef:
{{ $fluentBitCaddyInputPath }}
{{- end -}}

{{- define "storeCaddyLogConfig" -}}
{{- if hasKey .Values.store "sidecarLogging" -}}
log {
output stdout
format json

output file {{ include "caddyLogPath" . }} {
roll_size 10MB
roll_keep 5
roll_keep_for 24h
}
}
{{- else -}}
log
{{- end -}}
{{- end -}}

{{ define "fluentBitConfigmap" -}}
{{- if hasKey .Values.store "sidecarLogging" }}
{{- $fluentBitShopwareInputPath := printf "Path %s/%s" (.Values.store.sidecarLogging.logFolder | default "/var/log") (.Values.store.sidecarLogging.logFile | default "shopware.log") -}}
Expand Down
71 changes: 59 additions & 12 deletions charts/shopware/templates/store_caddy_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,67 @@ metadata:
namespace: '{{ .Release.Namespace }}'
data:
Caddyfile: |
:8000
{{- if hasKey .Values.store "sidecarLogging" }}
log {
output stdout
format json
{{- if .Values.store.frankenphp.enabled }}
{
skip_install_trust

{$CADDY_GLOBAL_OPTIONS}

output file {{ include "caddyLogPath" . }} {
roll_size 10MB
roll_keep 5
roll_keep_for 24h
servers {
trusted_proxies static private_ranges
}
}
{{ else }}
log

frankenphp {
{{- if hasKey .Values.store.frankenphp "maxThreads" }}
max_threads {{ .Values.store.frankenphp.maxThreads }}
{{- end }}
{{- if hasKey .Values.store.frankenphp "maxWaitTime" }}
max_wait_time {{ .Values.store.frankenphp.maxWaitTime }}
{{- end }}
{$FRANKENPHP_CONFIG}
}
}

{$CADDY_EXTRA_CONFIG}

:8000 {
{{- include "storeCaddyLogConfig" . | trim | nindent 6 }}
tracing {
span caddy
}
header {
X-Trace-Id {http.vars.trace_id}
}
request_header X-Trace-Id {http.vars.trace_id}
root * /var/www/html/public
encode gzip

@theme path /theme/*
@phpRoute {
not path /theme/* /media/* /thumbnail/* /bundles/*
not file {path}
}

rewrite @phpRoute index.php

@frontController path index.php
php @frontController

handle @theme {
@theme_file file
handle @theme_file {
file_server
}
respond 410
}

file_server {
hide *.php
}
}
{{- else }}
:8000
{{- include "storeCaddyLogConfig" . | trim | nindent 4 }}
route {
tracing {
span caddy
Expand All @@ -40,3 +86,4 @@ data:
encode gzip
file_server
}
{{- end }}
5 changes: 5 additions & 0 deletions charts/shopware/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ store:
# Disables mounting the kubernetes service account token
automountServiceAccountToken: false

frankenphp:
enabled: false
# maxThreads: 40
# maxWaitTime: 10s

caddy:
# This is the read timeout for the caddy server. Default is 60s.
readTimeout: 60s
Expand Down
Loading