aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostclass/dav_server
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-12-16 20:35:26 -0500
committerCullum Smith <cullum@sacredheartsc.com>2024-12-16 20:35:26 -0500
commitffccdc6b85680489a0881e1af80edb4f67361709 (patch)
tree4c087502c74b030bd8f2bf54291691246a0c1af7 /scripts/hostclass/dav_server
parent62bf72f6824885744ab4f9b33101218be5d39206 (diff)
downloadinfrastructure-ffccdc6b85680489a0881e1af80edb4f67361709.tar.gz
add webdav to dav_server role
Diffstat (limited to 'scripts/hostclass/dav_server')
-rw-r--r--scripts/hostclass/dav_server13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/hostclass/dav_server b/scripts/hostclass/dav_server
index fd3bdd4..9c5d9f9 100644
--- a/scripts/hostclass/dav_server
+++ b/scripts/hostclass/dav_server
@@ -10,6 +10,9 @@
: ${davical_awl_repo:='https://gitlab.com/davical-project/awl.git'}
: ${davical_awl_branch:='master'}
: ${davical_admins:=''}
+: ${webdav_users:=''}
+: ${webdav_user_quota:='2g'}
+: ${webdav_upload_sizelimit:='104857600'} # 100 MB
davical_dn="uid=${davical_username},${robots_basedn}"
davical_repo_dir=/usr/local/www/davical
@@ -21,6 +24,7 @@ davical_https_cacert="${nginx_conf_dir}/davical.ca.crt"
davical_keytab="${keytab_dir}/davical.keytab"
davical_client_keytab="${keytab_dir}/davical.client.keytab"
davical_fpm_socket=/var/run/fpm-davical.sock
+webdav_dir=/usr/local/www/webdav
davical_psql(){
postgres_run --host="$davical_dbhost" --dbname="$davical_dbname" "$@"
@@ -45,6 +49,15 @@ pkg install -y \
p5-DBI \
p5-YAML
+# Create ZFS datasets for WebDAV files.
+create_dataset -o "mountpoint=${webdav_dir}" "${state_dataset}/webdav"
+install_directory -o root -g "$nginx_user" -m 0770 "$webdav_dir"
+
+for user in $webdav_users; do
+ create_dataset -o "refquota=${webdav_user_quota}" "${state_dataset}/webdav/${user}"
+ install_directory -o root -g "$nginx_user" -m 0770 "${webdav_dir}/${user}"
+done
+
# Install davical from git.
[ -d "$davical_repo_dir" ] || git clone "$davical_repo" "$davical_repo_dir"
[ -d "$davical_awl_repo_dir" ] || git clone "$davical_awl_repo" "$davical_awl_repo_dir"