define website_blog_2::instance ( String $author, String $blog_title = $name, Boolean $has_comments = false, String $subtitle = '', Optional[Struct[{ url => String, ref => String}]] $vcs_repo = undef, ) { $root = "${website_blog_2::blog_root}/${title}" $safe_title = base64('encode', $blog_title) $upperdir = "/var/website-blog-2/${title}" $workdir = "/var/website-blog-2/.workdirs/${title}" file { [ $upperdir, $workdir ]: ensure => directory, } mount { $root: ensure => mounted, atboot => true, device => 'overlay', fstype => 'overlay', options => [ 'lowerdir=/usr/share/website-blog-2', "upperdir=${upperdir}", "workdir=${workdir}", ].join(',') } # Manage entries directory if $vcs_repo { vcsrepo { "${root}/entries": ensure => latest, provider => git, source => $vcs_repo['url'], revision => $vcs_repo['ref'], group => 'www-data', } } else { file { "${root}/entries": ensure => directory, } } file { "${root}/settings.php": ensure => file, content => epp("${module_name}/settings.php.epp", { author => $author, title => $blog_title, subtitle => $subtitle, has_comments => $has_comments, }), } file { "${root}/footnote": ensure => directory, recurse => true, } $foot_files = [ ['about.md', 'About'], ['contact.md', 'Contact'], ['legal.md', 'Legal'], ['qna.md', '"Q&A"'], ] $foot_files.each |$item| { file { "${root}/footnote/${item[0]}": source => "puppet:///modules/${module_name}/footers/${item[0]}", } } file { "${root}/special-files.ini": ensure => file, content => epp( "${module_name}/special-files.ini.epp", { foot_files => $foot_files, }), } $location_ssl = letsencrypt::conf::nginx::location($website_blog_2::domain) nginx::resource::location { "${safe_title} - /": location => '/', try_files => ['$uri', '$uri/', '=404'], index_files => [], autoindex => on, server => $website_blog_2::blog_server_name, * => $location_ssl, add_header => { 'Cache-Control' => "no-cache", }, } nginx::resource::location { "${safe_title} - css": location => '~ \.css$', try_files => [ '$uri', '=404' ], server => $website_blog_2::blog_server_name, expires => '1h', * => $location_ssl, add_header => { 'Cache-Control' => "no-cache", }, } nginx::resource::location { "${safe_title} - php": location => '~ \.php$', fastcgi_params => 'snippets/fastcgi-php.conf', fastcgi => 'unix:/run/php/php-fpm.sock', * => $location_ssl, server => $website_blog_2::blog_server_name, } nginx::resource::location { "${safe_title} - ht": location => '~ /\.ht', location_cfg_append => { deny => 'all' }, index_files => [], ssl_only => false, * => $location_ssl, server => $website_blog_2::blog_server_name, } }