vibecarbon 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/carbon/backup/compose-backup.sh +45 -121
  2. package/carbon/db/Dockerfile +14 -3
  3. package/carbon/docker-compose.dns01.prod.yml +42 -0
  4. package/carbon/docker-compose.metabase.prod.yml +1 -2
  5. package/carbon/docker-compose.n8n.prod.yml +1 -2
  6. package/carbon/docker-compose.prod.yml +9 -7
  7. package/carbon/k8s/base/backup/configmap-walg.yaml +47 -0
  8. package/carbon/k8s/base/backup/cronjob.yaml +67 -92
  9. package/carbon/k8s/base/backup/kustomization.yaml +1 -0
  10. package/carbon/k8s/base/backup/network-policy.yaml +9 -14
  11. package/carbon/k8s/base/backup/rbac.yaml +40 -0
  12. package/carbon/k8s/base/network-policies.yaml +33 -0
  13. package/carbon/k8s/base/traefik/certificate.yaml +13 -7
  14. package/carbon/k8s/values/supabase.values.yaml +152 -0
  15. package/carbon/scripts/docker-up.js +13 -1
  16. package/carbon/src/client/components/DeploymentScenariosSection.tsx +171 -0
  17. package/carbon/src/client/locales/de.json +29 -0
  18. package/carbon/src/client/locales/en.json +29 -0
  19. package/carbon/src/client/locales/es.json +29 -0
  20. package/carbon/src/client/locales/fr.json +29 -0
  21. package/carbon/src/client/locales/pt.json +29 -0
  22. package/carbon/src/client/pages/Home.tsx +5 -0
  23. package/package.json +1 -2
  24. package/src/backup.js +13 -66
  25. package/src/create.js +9 -4
  26. package/src/deploy.js +12 -0
  27. package/src/destroy.js +5 -43
  28. package/src/lib/backup-s3.js +0 -31
  29. package/src/lib/cloudflare.js +0 -59
  30. package/src/lib/config.js +1 -42
  31. package/src/lib/deploy/acme.js +57 -0
  32. package/src/lib/deploy/admin-user.js +105 -0
  33. package/src/lib/deploy/bundle.js +137 -5
  34. package/src/lib/deploy/compose/ha.js +208 -92
  35. package/src/lib/deploy/compose/index.js +292 -424
  36. package/src/lib/deploy/k8s/ha/index.js +12 -148
  37. package/src/lib/deploy/k8s/index.js +1 -21
  38. package/src/lib/deploy/k8s/k3s.js +407 -168
  39. package/src/lib/deploy/orchestrator.js +90 -33
  40. package/src/lib/deploy/utils.js +20 -0
  41. package/src/lib/hetzner-guided-setup.js +0 -7
  42. package/src/lib/iac/index.js +45 -16
  43. package/src/lib/images.js +17 -0
  44. package/src/lib/licensing/index.js +1 -59
  45. package/src/lib/licensing/tiers.js +0 -8
  46. package/src/lib/pod-backups.js +53 -0
  47. package/src/lib/providers/index.js +0 -47
  48. package/src/lib/ssh.js +12 -0
  49. package/src/restore.js +216 -302
  50. package/src/scale.js +76 -77
  51. package/carbon/backup/Dockerfile +0 -75
  52. package/carbon/backup/backup.sh +0 -95
  53. package/carbon/runtime.Dockerfile +0 -17
  54. package/src/lib/deploy/compose/acme-verify.js +0 -121
  55. package/src/lib/deploy/index.js +0 -119
  56. package/src/lib/kubectl.js +0 -81
@@ -1,81 +0,0 @@
1
- /**
2
- * Kubectl helpers that avoid exposing secrets in argv.
3
- *
4
- * Any Kubernetes manifest containing secret data MUST use
5
- * kubectlApplyManifest so the bytes flow through stdin instead of the
6
- * shell command line.
7
- */
8
-
9
- import { spawnSync } from 'node:child_process';
10
- import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
11
- import { tmpdir } from 'node:os';
12
- import { join } from 'node:path';
13
-
14
- /**
15
- * Apply a Kubernetes manifest via `kubectl apply -f -` piped from stdin.
16
- * The manifest body (including any secret data) never appears in argv.
17
- *
18
- * @param {object} manifest - Kubernetes resource as a plain object
19
- * @param {object} [options]
20
- * @param {string} [options.namespace]
21
- * @param {object} [options.env]
22
- * @param {number} [options.timeout=60000]
23
- * @returns {string} - kubectl stdout
24
- */
25
- export function kubectlApplyManifest(manifest, options = {}) {
26
- const yaml = JSON.stringify(manifest);
27
- const args = ['apply', '-f', '-'];
28
- if (options.namespace) args.push('-n', options.namespace);
29
- const res = spawnSync('kubectl', args, {
30
- input: yaml,
31
- encoding: 'utf-8',
32
- env: options.env ?? process.env,
33
- timeout: options.timeout ?? 60_000,
34
- });
35
- if (res.status !== 0) {
36
- const stderr = (res.stderr || '').trim();
37
- const exitCode = res.status ?? '(null)';
38
- // NEVER include res.stdout — kubectl may echo the submitted manifest on
39
- // failure, and the manifest may contain secret data.
40
- throw new Error(`kubectl apply failed (exit ${exitCode}): ${stderr || '(no stderr)'}`);
41
- }
42
- return res.stdout;
43
- }
44
-
45
- /**
46
- * Apply a strategic-merge patch to a resource via a temp patch file.
47
- * Use this instead of interpolating JSON into a shell command line.
48
- *
49
- * @param {string} resourceRef - e.g. 'deployment/app' or 'serviceaccount/default'
50
- * @param {string} namespace
51
- * @param {object} patch - patch object
52
- * @param {object} [options]
53
- * @param {string} [options.type='strategic'] - 'strategic' | 'merge' | 'json'
54
- * @param {object} [options.env]
55
- * @param {boolean} [options.ignoreError]
56
- * @param {number} [options.timeout=60000]
57
- * @returns {string|null} - kubectl stdout, or null when ignoreError + failure
58
- */
59
- export function kubectlPatch(resourceRef, namespace, patch, options = {}) {
60
- const { type = 'strategic', env, ignoreError = false, timeout = 60_000 } = options;
61
- const dir = mkdtempSync(join(tmpdir(), 'vibecarbon-patch-'));
62
- const patchFile = join(dir, 'patch.json');
63
- try {
64
- writeFileSync(patchFile, JSON.stringify(patch), { mode: 0o600 });
65
- const args = ['patch', resourceRef, '-n', namespace, '--type', type, '--patch-file', patchFile];
66
- const res = spawnSync('kubectl', args, {
67
- encoding: 'utf-8',
68
- env: env ?? process.env,
69
- timeout,
70
- });
71
- if (res.status !== 0) {
72
- if (ignoreError) return null;
73
- const stderr = (res.stderr || '').trim();
74
- const exitCode = res.status ?? '(null)';
75
- throw new Error(`kubectl patch failed (exit ${exitCode}): ${stderr || '(no stderr)'}`);
76
- }
77
- return res.stdout;
78
- } finally {
79
- rmSync(dir, { recursive: true, force: true });
80
- }
81
- }