mirror of
https://github.com/KevinMidboe/infra-map.git
synced 2025-12-08 04:09:07 +00:00
compile varnish tmpl from docker-entrypoint script
also updates kubernetes resources to separate app & varnish into two different deployments
This commit is contained in:
@@ -44,14 +44,9 @@ COPY default.vcl.tmpl /etc/varnish/
|
||||
COPY *.vcl /etc/varnish/
|
||||
COPY includes /etc/varnish/includes
|
||||
|
||||
# Set variables for *.tmpl files
|
||||
ARG PROXY_HOST=$PROXY_HOST
|
||||
ARG IMAGE_HOST=$IMAGE_HOST
|
||||
|
||||
# Generate VCL
|
||||
RUN gomplate -f /etc/varnish/default.vcl.tmpl -o /etc/varnish/default.vcl
|
||||
RUN rm /etc/varnish/default.vcl.tmpl
|
||||
# Create entrypoint script
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
EXPOSE 6081
|
||||
CMD ["varnishd", "-F", "-f", "/etc/varnish/default.vcl", "-a", ":6081", "-s", "malloc,512m"]
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
@@ -46,17 +46,6 @@ sub vcl_recv {
|
||||
unset req.http.Cookie;
|
||||
}
|
||||
|
||||
// Svelte-kit needs to distinguish between it's own files and the Host header.
|
||||
// The X-Forwarded-* headers below are to tell svelte-kit where it's local files are,
|
||||
// and the Host header is included in the returned html & js referencing the external
|
||||
// domain or proxy requested by client.
|
||||
// https://svelte.dev/docs/kit/adapter-node#Environment-variables-ORIGIN-PROTOCOL_HEADER-HOST_HEADER-and-PORT_HEADER
|
||||
sub vcl_backend_fetch {
|
||||
set bereq.http.X-Forwarded-Host = "localhost";
|
||||
set bereq.http.X-Forwarded-Port = "3000";
|
||||
set bereq.http.X-Forwarded-Proto = "http";
|
||||
}
|
||||
|
||||
sub vcl_synth {
|
||||
if (resp.status == 204) {
|
||||
set resp.http.Access-Control-Allow-Origin = "*";
|
||||
|
||||
8
varnish/docker-entrypoint.sh
Normal file
8
varnish/docker-entrypoint.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Generate VCL at runtime
|
||||
gomplate -f /etc/varnish/default.vcl.tmpl -o /etc/varnish/default.vcl
|
||||
|
||||
# Execute startup CMD
|
||||
exec varnishd -F -f /etc/varnish/default.vcl -a :6081 -s malloc,512m
|
||||
Reference in New Issue
Block a user