File tree Expand file tree Collapse file tree 7 files changed +47
-4
lines changed Expand file tree Collapse file tree 7 files changed +47
-4
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,8 @@ ARG TARGETARCH
118
118
119
119
WORKDIR /srv/app
120
120
121
- # Download Caddy compiled with the Mercure and Vulcain modules
122
- ADD --chmod=500 https://caddyserver.com/api/download?os=linux&arch=$TARGETARCH&p=github.com/dunglas/mercure/caddy&p=github.com/dunglas/vulcain/caddy /usr/bin/caddy
121
+ # Download Caddy compiled with the Mercure, Vulcain and Souin modules
122
+ ADD --chmod=500 https://caddyserver.com/api/download?os=linux&arch=$TARGETARCH&p=github.com/dunglas/mercure/caddy&p=github.com/dunglas/vulcain/caddy&p=github.com/caddyserver/cache-handler /usr/bin/caddy
123
123
124
124
COPY --link docker/caddy/Caddyfile /etc/caddy/Caddyfile
125
125
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ api_platform:
9
9
graphql :
10
10
graphql_playground : false
11
11
mercure : ~
12
+ http_cache :
13
+ public : true
12
14
defaults :
13
15
stateless : true
14
16
cache_headers :
@@ -28,6 +30,23 @@ api_platform:
28
30
scopes :
29
31
openid : (required) Indicates that the application intends to use OIDC to verify the user's identity
30
32
33
+ when@prod :
34
+ parameters :
35
+ # The api url that is called to invalidate cached resources
36
+ # Can't be set in .env file cause it's only available on prod env
37
+ env(SOUIN_API_URL) : http://caddy/souin-api/souin
38
+
39
+ api_platform :
40
+ http_cache :
41
+ invalidation :
42
+ enabled : true
43
+ purger : ' api_platform.http_cache.purger.souin'
44
+ urls : ['%env(SOUIN_API_URL)%']
45
+ defaults :
46
+ cache_headers :
47
+ max_age : 0
48
+ shared_max_age : 3600
49
+
31
50
services :
32
51
app.filter.review.admin.search :
33
52
class : ' ApiPlatform\Doctrine\Orm\Filter\SearchFilter'
Original file line number Diff line number Diff line change 1
1
{
2
- # Debug
3
- {$CADDY_DEBUG}
2
+ {$CADDY_GLOBAL_OPTIONS}
4
3
}
5
4
6
5
{$SERVER_NAME}
7
6
8
7
log
9
8
9
+ {$CADDY_CACHE}
10
+
10
11
# Matches requests for OIDC routes
11
12
@oidc expression path('/oidc/* ')
12
13
Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ services:
27
27
environment :
28
28
MERCURE_PUBLISHER_JWT_KEY : ${CADDY_MERCURE_JWT_SECRET}
29
29
MERCURE_SUBSCRIBER_JWT_KEY : ${CADDY_MERCURE_JWT_SECRET}
30
+ CADDY_GLOBAL_OPTIONS : |
31
+ order cache before rewrite
32
+ cache {
33
+ api {
34
+ souin
35
+ }
36
+ }
37
+ CADDY_CACHE : cache
30
38
31
39
database :
32
40
environment :
Original file line number Diff line number Diff line change 13
13
mercure-url : " http://{{ include " api-platform.fullname" . }}/.well-known/mercure"
14
14
mercure-public-url : {{ .Values.mercure.publicUrl | default "http://127.0.0.1/.well-known/mercure" | quote }}
15
15
mercure-extra-directives : {{ .Values.mercure.extraDirectives | quote }}
16
+ caddy-global-options : {{ .Values.caddy.globalOptions | quote }}
16
17
oidc-server-url : " https://{{ (first .Values.ingress.hosts).host }}/oidc/realms/demo"
17
18
oidc-server-url-internal : " http://{{ include " api-platform.fullname" . }}/oidc/realms/demo"
18
19
next-auth-url : " https://{{ (first .Values.ingress.hosts).host }}/api/auth"
Original file line number Diff line number Diff line change 40
40
value : {{ include "api-platform.fullname" . }}-pwa:3000
41
41
- name : OIDC_UPSTREAM
42
42
value : {{ .Release.Name }}-keycloak:80
43
+ - name : CADDY_CACHE
44
+ value : cache
45
+ - name : CADDY_GLOBAL_OPTIONS
46
+ valueFrom :
47
+ configMapKeyRef :
48
+ name : {{ include "api-platform.fullname" . }}
49
+ key : caddy-global-options
43
50
- name : MERCURE_EXTRA_DIRECTIVES
44
51
valueFrom :
45
52
configMapKeyRef :
Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ caddy:
34
34
pullPolicy : IfNotPresent
35
35
# Overrides the image tag whose default is the chart appVersion.
36
36
tag : " "
37
+ globalOptions : |
38
+ order cache before rewrite
39
+ cache {
40
+ api {
41
+ souin
42
+ }
43
+ }
37
44
38
45
# You may prefer using the managed version in production: https://mercure.rocks
39
46
mercure :
You can’t perform that action at this time.
0 commit comments