Set the correct rights and group during deploying master
authorGreg Burri <greg.burri@gmail.com>
Tue, 29 Oct 2024 09:33:33 +0000 (10:33 +0100)
committerGreg Burri <greg.burri@gmail.com>
Tue, 29 Oct 2024 09:33:33 +0000 (10:33 +0100)
deploy.nu

index ae8f52f..fa9b03f 100644 (file)
--- a/deploy.nu
+++ b/deploy.nu
@@ -22,8 +22,16 @@ def main [host: string, destination: string, ssh_key: path] {
     copy_ssh ./target/($target)/release/mumble_web $destination
     invoke_ssh [rm -rf $"($destination)/static"]
     copy_ssh ./static/ $destination
+
     invoke_ssh [chmod gu+x $"($destination)/mumble_web"]
-    invoke_ssh [chgrp -R www-data $"($destination)/mumble_web"]
+
+    # "|| true" to suppress the possible non-zero return.
+    invoke_ssh [chgrp -Rf www-data $"($destination)/* || true"]
+    invoke_ssh [chmod -Rf g+rw $"($destination)/* || true"]
+
+    # Add 'x' right for group (www-data) to all directories.
+    invoke_ssh [find $"($destination) -type d -exec chmod -f g+x {} + || true"]
+
     invoke_ssh [sudo systemctl start mumble_web]
     print "Deployment finished"
 }