provisioning-catalog/playbooks/bootstrap_initial/steps/deploy_libre_daoshi.nu

29 lines
1.1 KiB
Text
Raw Normal View History

#!/usr/bin/env nu
def main [
--hetzner-context: string = ""
--dry-run
]: nothing -> nothing {
let htz_ctx = if ($hetzner_context | is-not-empty) { $hetzner_context } else { $env.PLAYBOOK_PARAM_HETZNER_CONTEXT? | default "" }
if $dry_run {
print "[dry-run] would deploy libre-daoshi cluster: k0s + postgresql + forgejo + woodpecker + radicle-seed"
return
}
if ($htz_ctx | is-empty) { error make { msg: "hetzner-context is required for daoshi deployment" } }
let deploy_r = do { with-env { HCLOUD_CONTEXT: $htz_ctx } { ^prvng cluster deploy --workspace libre-daoshi } } | complete
if $deploy_r.exit_code != 0 {
error make { msg: $"libre-daoshi deployment failed: ($deploy_r.stderr | str trim)" }
}
print $deploy_r.stdout
let wait_r = do { ^prvng cluster wait-ready --workspace libre-daoshi --timeout 900 } | complete
if $wait_r.exit_code != 0 {
error make { msg: "libre-daoshi cluster did not become ready within 15m" }
}
print "libre-daoshi cluster deployed and ready"
print "Next: configure forgejo repos and woodpecker secrets manually (NATS_CREDS, DOCKER_REGISTRY)"
}