| 1 | amends "../../config/Service.pkl" |
| 2 | |
| 3 | import "../../config/site.pkl" as site |
| 4 | import "pkl:json" |
| 5 | |
| 6 | local workspace = new json.Parser {}.parse(read("../../config/mac-studio-sandbox.json").text) |
| 7 | |
| 8 | name = "Samba" |
| 9 | |
| 10 | container { |
| 11 | image = "ghcr.io/servercontainers/samba@sha256:31b90ea7fe3258d30fccd971c85743b92694605f4b43dc8a4df23a202fced06a" |
| 12 | imageUser = true |
| 13 | hostNetwork = !site.preview |
| 14 | cpu = 100 |
| 15 | memory = 256 |
| 16 | entrypoint = "/bin/sh" |
| 17 | args { |
| 18 | "/sandbox-check-mount" |
| 19 | "/shares/mac-studio-sandbox" |
| 20 | workspace.dataset |
| 21 | "/container/scripts/entrypoint.sh" |
| 22 | "runsvdir" |
| 23 | "-P" |
| 24 | "/container/config/runit" |
| 25 | } |
| 26 | |
| 27 | tcp { |
| 28 | new { |
| 29 | name = "smb" |
| 30 | containerPort = 445 |
| 31 | hostPort = 445 |
| 32 | loopback = false |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | volumes { |
| 37 | ["/shares/clover"] { src = site.cloverRoot; readOnly = site.cloverReadOnly } |
| 38 | ["/shares/clover/Media"] { src = site.mediaRoot; readOnly = site.mediaReadOnly } |
| 39 | ["/shares/mac-studio-sandbox"] { src = workspace.mountPoint; readOnly = true } |
| 40 | ["/sandbox-check-mount"] { config = "check-mount.sh"; readOnly = true } |
| 41 | } |
| 42 | |
| 43 | env { |
| 44 | // Finder writes as Clover's owner; Copyparty writes through the shared group. |
| 45 | ["UID_clo"] = site.cloverUid.toString() |
| 46 | ["ACCOUNT_clo"] = "${secret.own.account}" |
| 47 | ["AVAHI_DISABLE"] = "1" |
| 48 | ["WSDD2_DISABLE"] = "1" |
| 49 | ["SAMBA_CONF_WORKGROUP"] = "PAPER_CLOVER" |
| 50 | ["SAMBA_CONF_SERVER_STRING"] = "paper clover's nas" |
| 51 | // NFS ACE mode changes bypass the masks used for shared editing. |
| 52 | ["SAMBA_GLOBAL_STANZA"] = "fruit:nfs_aces = no" |
| 53 | ["SAMBA_VOLUME_CONFIG_clover"] = """ |
| 54 | [clover] |
| 55 | path = /shares/clover |
| 56 | valid users = clo |
| 57 | read only = \(if (site.cloverReadOnly) "yes" else "no") |
| 58 | create mask = 0660 |
| 59 | force create mode = 0660 |
| 60 | directory mask = 0770 |
| 61 | force directory mode = 02770 |
| 62 | vfs objects = catia fruit streams_xattr |
| 63 | fruit:veto_appledouble = no |
| 64 | kernel oplocks = yes |
| 65 | """ |
| 66 | ["SAMBA_VOLUME_CONFIG_mac_studio_sandbox"] = """ |
| 67 | [mac-studio-sandbox] |
| 68 | path = /shares/mac-studio-sandbox |
| 69 | valid users = clo |
| 70 | read only = yes |
| 71 | vfs objects = catia fruit streams_xattr |
| 72 | fruit:veto_appledouble = no |
| 73 | kernel oplocks = yes |
| 74 | """ |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | requiredSecrets { "account" } |