From d1dd12a091d44c2dc5465142e45bd3b0599676d9 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sat, 6 Jul 2024 17:59:38 +1000 Subject: [PATCH] feat: add cache to simpleproxy --- site/profiles/manifests/nginx/simpleproxy.pp | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/site/profiles/manifests/nginx/simpleproxy.pp b/site/profiles/manifests/nginx/simpleproxy.pp index 7a497ae..29c1daf 100644 --- a/site/profiles/manifests/nginx/simpleproxy.pp +++ b/site/profiles/manifests/nginx/simpleproxy.pp @@ -99,15 +99,39 @@ class profiles::nginx::simpleproxy ( # merge the hashes conditionally $nginx_parameters = merge($defaults, $extras_hash) + ## manage cache for nginx + #file {'/var/cache/nginx/cache': + # ensure => 'directory', + # owner => 'nginx', + # group => 'root', + # mode => '0700', + #} + + #file {'/var/cache/nginx/cache_temp': + # ensure => 'directory', + # owner => 'nginx', + # group => 'root', + # mode => '0700', + #} + # manage the nginx class - include 'nginx' + class { 'nginx': + proxy_cache_path => { + '/var/cache/nginx/cache' => 'cache:128m', + }, + proxy_cache_levels => '1:2', + proxy_cache_keys_zone => 'cache:128m', + proxy_cache_max_size => '1024m', + proxy_cache_inactive => '10m', + proxy_temp_path => '/var/cache/nginx/cache_temp', + } # create the nginx vhost with the merged parameters create_resources('nginx::resource::server', { $nginx_vhost => $nginx_parameters }) # create nginx locations if $use_default_location == false { - create_resources('nginx::resource::location', $locations) + create_resources('nginx::resource::location', $locations => {'server' => $nginx_vhost}) } # manage selinux