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
This commit is contained in:
Lourenço Vales
2025-05-07 09:06:47 +02:00
parent b85751e07e
commit 2d78dc9836
2 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
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"],
}
}

View File