summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-12 01:56:51 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-01-12 01:58:58 +0100
commite489d51af2b11e59b6b2fe85ee9561d583c43e9c (patch)
treed10900d8fd40376b9e10aeae67b9eac6ca51b721
parentRaise X11 max clients. (diff)
downloadwebdav_server-e489d51af2b11e59b6b2fe85ee9561d583c43e9c.tar.gz
webdav_server-e489d51af2b11e59b6b2fe85ee9561d583c43e9c.tar.xz
Fix up shiori.
-rw-r--r--modules/profiles/manifests/shiori.pp46
-rw-r--r--modules/shiori/manifests/init.pp51
2 files changed, 55 insertions, 42 deletions
diff --git a/modules/profiles/manifests/shiori.pp b/modules/profiles/manifests/shiori.pp
new file mode 100644
index 0000000..df9b718
--- /dev/null
+++ b/modules/profiles/manifests/shiori.pp
@@ -0,0 +1,46 @@
+class profiles::shiori (
+ String $server_name,
+ Array[String] $group_members = [],
+ $port = 8080,
+) {
+
+ class { 'shiori':
+ port => $port,
+ }
+
+ group { 'shiori':
+ ensure => present,
+ members => $group_members,
+ }
+
+ include ::profiles::group_profile
+
+ file { '/etc/profile.d/group.d/shiori':
+ ensure => file,
+ content => "export SHIORI_DIR=${shiori::dir}\n",
+ }
+
+ include ::nginx
+
+ $certname = lookup('certname')
+
+ nginx::resource::server { $server_name:
+ ipv6_enable => true,
+ ipv6_listen_options => '',
+ ssl => true,
+ ssl_redirect => true,
+ ssl_cert => "/etc/letsencrypt/live/${certname}/fullchain.pem",
+ ssl_key => "/etc/letsencrypt/live/${certname}/privkey.pem",
+ www_root => $shiori::dir,
+ use_default_location => false,
+ }
+
+ nginx::resource::location { 'shiori /':
+ location => '/',
+ proxy => "http://[::]:$port",
+ index_files => [],
+ ssl => true,
+ ssl_only => true,
+ server => $server_name,
+ }
+}
diff --git a/modules/shiori/manifests/init.pp b/modules/shiori/manifests/init.pp
index ebeb0d0..69d5fde 100644
--- a/modules/shiori/manifests/init.pp
+++ b/modules/shiori/manifests/init.pp
@@ -1,9 +1,9 @@
class shiori (
$port = 8080,
- Array[String] $group_members = [],
- Optional[Hash] $nginx = undef,
+ $dir = '/var/www/shiori',
) {
+
# on arch this is available through the aur
package { 'shiori-bin':
ensure => installed,
@@ -12,15 +12,10 @@ class shiori (
user { 'shiori':
ensure => present,
system => true,
- home => '/var/www/shiori',
- }
-
- group { 'shiori':
- ensure => present,
- members => $group_members,
+ home => $dir,
}
- file { '/var/www/shiori':
+ file { $dir:
ensure => directory,
owner => shiori,
group => shiori,
@@ -28,8 +23,8 @@ class shiori (
}
file { [
- '/var/www/shiori/archive',
- '/var/www/shiori/thumb',
+ "${dir}/archive",
+ "${dir}/thumb",
] :
ensure => directory,
owner => shiori,
@@ -37,7 +32,7 @@ class shiori (
mode => '0770',
}
- file { '/var/www/shiori/shiori.db':
+ file { "${dir}/shiori.db":
owner => 'shiori',
group => 'shiori',
mode => '0660',
@@ -52,8 +47,8 @@ class shiori (
ensure => 'file',
content => @("EOF")
# This file is managed by Puppet.
- # Editing it might also lead to inconsistencies with nginx
PORT=${port}
+ SHIORI_DIR=${dir}
| EOF
}
@@ -66,33 +61,5 @@ class shiori (
],
}
- # TODO only run this if Class['profiles::group_profile'] is loaded
- file { '/etc/profile.d/group.d/shiori':
- ensure => file,
- content => "export SHIORI_DIR=/var/www/shiori\n",
- }
-
- if ($nginx) {
- include ::nginx
- $certname = $nginx['certname']
- nginx::resource::server { $nginx['server_name']:
- ipv6_enable => true,
- ipv6_listen_options => '',
- ssl => true,
- ssl_redirect => true,
- ssl_cert => "/etc/letsencrypt/live/${certname}/fullchain.pem",
- ssl_key => "/etc/letsencrypt/live/${certname}/privkey.pem",
- www_root => '/var/www/shiori',
- use_default_location => false,
- }
-
- nginx::resource::location { 'shiori /':
- location => '/',
- proxy => "http://[::]:$port",
- index_files => [],
- ssl => true,
- ssl_only => true,
- server => $nginx['server_name'],
- }
- }
+ # Users could be managed here, through shioris HTTP API
}