Files
mgmt/modules/contrib/cryptpad/main.mcl
Lourenço Vales 2d78dc9836 modules: contrib: Add cryptpad module
This is a module to deploy cryptpad locally - as it is, this is only
intended for dev purposes, not for production environments
2025-05-26 14:28:33 +02:00

52 lines
1.1 KiB
Plaintext

import "fmt"
class deploy() {
$pkgname = "cryptpad"
$installdir = "/opt/"
$gitbranch = "2025.3.1-rc"
$gitclonecommand = fmt.printf("git clone -b %s --depth 1 https://github.com/cryptpad/cryptpad.git %s", $gitbranch, $pkgname)
$shell = "/bin/bash"
exec "cryptpad-fetch" {
cwd => $installdir,
ifshell => $shell,
ifcmd => fmt.printf("test ! -d %s%s", $installdir, $pkgname),
shell => $shell,
cmd => $gitclonecommand,
}
exec "cryptpad-install" {
cwd => fmt.printf("%s%s", $installdir, $pkgname),
ifshell => $shell,
ifcmd => fmt.printf("test -d %s%s", $installdir, $pkgname),
shell => $shell,
cmd => "npm install && npm run install:components",
Depend => Exec["cryptpad-fetch"],
}
file "/opt/cryptpad/config/config.js" {
source => "/opt/cryptpad/config/config.example.js",
state => "exists",
Depend => Exec["cryptpad-install"],
}
exec "cryptpad-run" {
cwd => fmt.printf("%s%s", $installdir, $pkgname),
ifshell => $shell,
ifcmd => fmt.printf("test -d %s%s", $installdir, $pkgname),
shell => $shell,
cmd => "npm run dev",
Depend => File["/opt/cryptpad/config/config.js"],
}
}