vibecarbon 0.8.0 → 0.10.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.
- package/LICENSE +110 -663
- package/README.md +4 -4
- package/carbon/.env.example +11 -0
- package/carbon/backup/compose-backup.sh +8 -0
- package/carbon/docker-compose.yml +11 -0
- package/carbon/ha/primary-init.sql +10 -2
- package/carbon/k8s/base/backup/cronjob.yaml +9 -0
- package/carbon/k8s/base/repl-gateway/kustomization.yaml +11 -0
- package/carbon/k8s/base/repl-gateway/repl-gateway.yaml +92 -0
- package/carbon/k8s/values/supabase.values.yaml +6 -1
- package/carbon/scripts/dev-init.js +6 -2
- package/carbon/src/client/assets/vibecarbon-icon.svg +6 -6
- package/carbon/src/client/assets/vibecarbon-wordmark-text-dark.svg +12 -0
- package/carbon/src/client/assets/vibecarbon-wordmark-text-light.svg +12 -0
- package/carbon/src/client/components/AIIntegrationSection.tsx +1 -3
- package/carbon/src/client/components/AppSidebar.tsx +35 -28
- package/carbon/src/client/components/CTAFooter.tsx +1 -1
- package/carbon/src/client/components/ComparisonSection.tsx +1 -3
- package/carbon/src/client/components/ContentPanel.tsx +1 -1
- package/carbon/src/client/components/DeploymentScenariosSection.tsx +1 -3
- package/carbon/src/client/components/FAQSection.tsx +1 -1
- package/carbon/src/client/components/Hero.tsx +13 -1
- package/carbon/src/client/components/Logo.tsx +66 -49
- package/carbon/src/client/components/Nav.tsx +1 -1
- package/carbon/src/client/components/NewsletterSignup.tsx +1 -1
- package/carbon/src/client/components/NotificationDrawer.tsx +3 -3
- package/carbon/src/client/components/PageHeader.tsx +1 -1
- package/carbon/src/client/components/PricingSection.tsx +2 -6
- package/carbon/src/client/components/TechStackSection.tsx +1 -3
- package/carbon/src/client/components/effects/FilmGrainOverlay.tsx +5 -0
- package/carbon/src/client/components/ui/button.tsx +1 -1
- package/carbon/src/client/components/ui/card.tsx +1 -1
- package/carbon/src/client/components/ui/dialog.tsx +1 -1
- package/carbon/src/client/components/ui/dropdown-menu.tsx +2 -2
- package/carbon/src/client/components/ui/popover.tsx +1 -1
- package/carbon/src/client/components/ui/select.tsx +1 -1
- package/carbon/src/client/components/ui/sidebar.tsx +1 -1
- package/carbon/src/client/index.css +186 -104
- package/carbon/src/client/lib/supabase.ts +41 -0
- package/carbon/src/client/lib/theme.ts +14 -14
- package/carbon/src/client/locales/de.json +27 -12
- package/carbon/src/client/locales/en.json +33 -18
- package/carbon/src/client/locales/es.json +27 -12
- package/carbon/src/client/locales/fr.json +27 -12
- package/carbon/src/client/locales/pt.json +27 -12
- package/carbon/src/client/pages/Blog.tsx +1 -1
- package/carbon/src/client/pages/Changelog.tsx +1 -1
- package/carbon/src/client/pages/Checkout.tsx +1 -1
- package/carbon/src/client/pages/Dashboard.tsx +33 -40
- package/carbon/src/client/pages/Docs.tsx +1 -1
- package/carbon/src/client/pages/Home.tsx +1 -1
- package/carbon/src/client/pages/Legal.tsx +1 -1
- package/carbon/src/server/billing/providers/paddle.ts +21 -2
- package/carbon/src/server/billing/providers/polar.ts +14 -0
- package/carbon/src/server/index.ts +12 -9
- package/carbon/src/server/lib/client-ip.ts +68 -0
- package/carbon/src/server/lib/env.ts +20 -6
- package/carbon/src/server/lib/rate-limiter.ts +11 -65
- package/carbon/src/server/lib/supabase.ts +10 -4
- package/carbon/src/server/middleware/requireOrgRole.ts +76 -0
- package/carbon/src/server/middleware/requirePlan.ts +64 -34
- package/carbon/src/server/middleware/requireSuperAdmin.ts +26 -0
- package/carbon/src/server/routes/v1/admin/contact.ts +5 -20
- package/carbon/src/server/routes/v1/admin/jobs.ts +6 -20
- package/carbon/src/server/routes/v1/admin/newsletter.ts +26 -23
- package/carbon/src/server/routes/v1/auth.ts +5 -2
- package/carbon/src/server/routes/v1/billing.ts +24 -64
- package/carbon/src/server/routes/v1/index.ts +8 -1
- package/carbon/src/server/routes/v1/newsletter.ts +18 -12
- package/carbon/src/server/routes/v1/theme.ts +36 -15
- package/carbon/supabase/migrations/00003_pg_cron.sql +2 -2
- package/carbon/supabase/migrations/00004_contact_newsletter.sql +24 -14
- package/carbon/tests/component/supabase-env-guard.test.ts +54 -0
- package/carbon/tests/integration/server/middleware/rate-limit-ip-spoof.test.ts +48 -0
- package/carbon/tests/integration/server/middleware/require-plan.test.ts +101 -0
- package/carbon/tests/integration/server/routes/admin-newsletter.test.ts +93 -0
- package/carbon/tests/integration/server/routes/billing-subscription-idor.test.ts +92 -0
- package/carbon/tests/integration/server/routes/newsletter-unsubscribe.test.ts +65 -0
- package/carbon/tests/integration/server/routes/theme-validation.test.ts +66 -0
- package/carbon/tests/unit/server/client-ip.test.ts +76 -0
- package/carbon/tests/unit/server/env-bool.test.ts +63 -0
- package/carbon/tests/unit/server/paddle-webhook.test.ts +57 -0
- package/carbon/tests/unit/server/polar-webhook.test.ts +63 -0
- package/carbon/tests/unit/server/supabase-client.test.ts +30 -0
- package/carbon/volumes/db/wal-archive.sh +36 -0
- package/package.json +2 -2
- package/src/backup.js +0 -2
- package/src/cli.js +16 -0
- package/src/deploy.js +16 -5
- package/src/destroy.js +78 -0
- package/src/failover.js +118 -237
- package/src/lib/command.js +19 -1
- package/src/lib/deploy/compose/ha.js +180 -102
- package/src/lib/deploy/compose/index.js +63 -20
- package/src/lib/deploy/image.js +19 -23
- package/src/lib/deploy/k8s/ha/index.js +397 -150
- package/src/lib/deploy/k8s/k3s.js +65 -14
- package/src/lib/deploy/orchestrator.js +176 -6
- package/src/lib/deploy/remote-build.js +8 -1
- package/src/lib/deploy/replication.js +540 -0
- package/src/lib/deploy/state.js +62 -5
- package/src/lib/deploy/utils.js +30 -2
- package/src/lib/deploy/wireguard.js +146 -0
- package/src/lib/host-keys.js +120 -5
- package/src/lib/iac/index.js +57 -23
- package/src/lib/licensing/gate.js +59 -0
- package/src/lib/licensing/index.js +1 -1
- package/src/lib/licensing/tiers.js +6 -5
- package/src/lib/prod-confirm.js +65 -0
- package/src/lib/providers/hetzner-s3.js +85 -0
- package/src/lib/ssh.js +35 -35
- package/src/restore.js +102 -14
- package/src/scale.js +4 -2
- package/src/status.js +122 -0
- package/src/upgrade.js +0 -4
- package/carbon/ha/activate-standby.sh +0 -52
- package/carbon/ha/standby-init.sh +0 -74
- package/carbon/src/client/assets/vibecarbon-logo-dark.svg +0 -29
- package/carbon/src/client/assets/vibecarbon-logo-light.svg +0 -29
- package/carbon/src/server/lib/request.ts +0 -34
- package/src/lib/pod-backups.js +0 -53
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Initialize standby PostgreSQL as a streaming replica of the primary.
|
|
3
|
-
#
|
|
4
|
-
# This script runs ON the standby master node and uses kubectl to
|
|
5
|
-
# exec into the postgres pod. It:
|
|
6
|
-
# 1. Stops the standby database
|
|
7
|
-
# 2. Wipes data and runs pg_basebackup from the primary
|
|
8
|
-
# 3. Configures standby.signal and primary_conninfo
|
|
9
|
-
# 4. Restarts as a hot standby
|
|
10
|
-
#
|
|
11
|
-
# Required env vars:
|
|
12
|
-
# PRIMARY_HOST — IP address of the primary cluster (master node)
|
|
13
|
-
#
|
|
14
|
-
# Optional env vars:
|
|
15
|
-
# PRIMARY_PORT — PostgreSQL port on the primary (default: 5432, use 30432 for NodePort)
|
|
16
|
-
# REPL_PASSWORD — Replication user password (required; generated by vibecarbon create in .env.local)
|
|
17
|
-
# NAMESPACE — Kubernetes namespace (default: vibecarbon)
|
|
18
|
-
|
|
19
|
-
set -euo pipefail
|
|
20
|
-
|
|
21
|
-
: "${PRIMARY_HOST:?PRIMARY_HOST is required}"
|
|
22
|
-
PRIMARY_PORT="${PRIMARY_PORT:-5432}"
|
|
23
|
-
: "${REPL_PASSWORD:?REPL_PASSWORD is required — generate one in .env.local and export it before running standby-init.sh}"
|
|
24
|
-
NAMESPACE="${NAMESPACE:-vibecarbon}"
|
|
25
|
-
PGDATA="/var/lib/postgresql/data"
|
|
26
|
-
|
|
27
|
-
# Find the postgres pod
|
|
28
|
-
POD=$(kubectl get pods -n "$NAMESPACE" -l app.kubernetes.io/name=supabase-db -o jsonpath='{.items[0].metadata.name}')
|
|
29
|
-
if [ -z "$POD" ]; then
|
|
30
|
-
echo "ERROR: No postgres pod found in namespace $NAMESPACE"
|
|
31
|
-
exit 1
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
echo "Standby init: pod=$POD, primary=$PRIMARY_HOST:$PRIMARY_PORT"
|
|
35
|
-
|
|
36
|
-
# 1. Stop postgres on standby
|
|
37
|
-
echo "Stopping standby PostgreSQL..."
|
|
38
|
-
kubectl exec -n "$NAMESPACE" "$POD" -- su postgres -c "pg_ctl stop -D $PGDATA -m fast" 2>/dev/null || true
|
|
39
|
-
sleep 5
|
|
40
|
-
|
|
41
|
-
# 2. Wipe data and run pg_basebackup from primary
|
|
42
|
-
echo "Running pg_basebackup from primary ($PRIMARY_HOST:$PRIMARY_PORT)..."
|
|
43
|
-
kubectl exec -n "$NAMESPACE" "$POD" -- bash -c "
|
|
44
|
-
rm -rf ${PGDATA}/*
|
|
45
|
-
PGPASSWORD='${REPL_PASSWORD}' pg_basebackup -h ${PRIMARY_HOST} -p ${PRIMARY_PORT} -U replicator -D ${PGDATA} -Fp -Xs -P -R
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
# 3. Configure standby signal and primary connection info
|
|
49
|
-
echo "Configuring standby.signal and primary_conninfo..."
|
|
50
|
-
kubectl exec -n "$NAMESPACE" "$POD" -- bash -c "
|
|
51
|
-
touch ${PGDATA}/standby.signal
|
|
52
|
-
echo \"primary_conninfo = 'host=${PRIMARY_HOST} port=${PRIMARY_PORT} user=replicator password=${REPL_PASSWORD}'\" >> ${PGDATA}/postgresql.auto.conf
|
|
53
|
-
chown -R postgres:postgres ${PGDATA}
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
# 4. Start postgres as hot standby
|
|
57
|
-
echo "Starting standby PostgreSQL..."
|
|
58
|
-
kubectl exec -n "$NAMESPACE" "$POD" -- su postgres -c "pg_ctl start -D $PGDATA -l /var/log/postgresql/postgresql.log"
|
|
59
|
-
|
|
60
|
-
# 5. Verify recovery mode
|
|
61
|
-
echo "Verifying standby is in recovery mode..."
|
|
62
|
-
sleep 5
|
|
63
|
-
for i in $(seq 1 15); do
|
|
64
|
-
result=$(kubectl exec -n "$NAMESPACE" "$POD" -- psql -U supabase_admin -tAc 'SELECT pg_is_in_recovery()' 2>/dev/null || echo "")
|
|
65
|
-
if [ "$result" = "t" ]; then
|
|
66
|
-
echo "Standby is in recovery mode — streaming replication active"
|
|
67
|
-
exit 0
|
|
68
|
-
fi
|
|
69
|
-
echo " Waiting for standby to enter recovery mode (attempt $i/15)..."
|
|
70
|
-
sleep 2
|
|
71
|
-
done
|
|
72
|
-
|
|
73
|
-
echo "WARNING: Could not confirm standby is in recovery mode"
|
|
74
|
-
exit 1
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<svg width="6453" height="1012" viewBox="0 0 6453 1012" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M1351.98 758.92C1348.62 758.92 1345.62 756.818 1344.46 753.66L1165.91 263.842C1164.01 258.623 1167.88 253.102 1173.43 253.102H1290.39C1293.8 253.102 1296.84 255.271 1297.95 258.501L1417.67 606.681C1420.15 613.888 1430.34 613.876 1432.8 606.663L1551.59 258.519C1552.7 255.279 1555.74 253.102 1559.17 253.102H1673.15C1678.7 253.102 1682.57 258.623 1680.67 263.842L1502.12 753.66C1500.96 756.818 1497.96 758.92 1494.6 758.92H1351.98Z" fill="white"/>
|
|
3
|
-
<path d="M1748.91 758.92C1744.49 758.92 1740.91 755.338 1740.91 750.92V261.102C1740.91 256.684 1744.49 253.102 1748.91 253.102H1858.13C1862.55 253.102 1866.13 256.684 1866.13 261.102V750.92C1866.13 755.338 1862.55 758.92 1858.13 758.92H1748.91ZM1803.03 187.04C1762.6 187.04 1733.02 157.46 1733.02 118.02C1733.02 78.58 1762.6 49 1803.03 49C1842.47 49 1873.04 78.58 1873.04 118.02C1873.04 157.46 1842.47 187.04 1803.03 187.04Z" fill="white"/>
|
|
4
|
-
<path d="M2254 764.836C2186.91 764.836 2138.3 739.429 2106.13 702.222C2101.46 696.826 2092.13 698.971 2090.88 705.993L2082.63 752.323C2081.95 756.14 2078.63 758.92 2074.75 758.92H1980.01C1975.59 758.92 1972.01 755.338 1972.01 750.92V76.72C1972.01 72.3017 1975.59 68.72 1980.01 68.72H2089.23C2093.65 68.72 2097.23 72.3017 2097.23 76.72V298.558C2097.23 306.201 2107.28 309.773 2112.61 304.285C2144.95 270.932 2190.97 247.186 2254.99 247.186C2391.06 247.186 2490.64 343.814 2490.64 505.518C2490.64 661.306 2391.06 764.836 2254 764.836ZM2229.35 661.306C2310.2 661.306 2363.45 599.188 2363.45 506.504C2363.45 412.834 2310.2 350.716 2229.35 350.716C2148.5 350.716 2095.26 412.834 2095.26 505.518C2095.26 599.188 2148.5 661.306 2229.35 661.306Z" fill="white"/>
|
|
5
|
-
<path d="M2817.33 764.836C2652.67 764.836 2552.1 662.292 2552.1 507.49C2552.1 350.716 2654.64 247.186 2807.47 247.186C2956.36 247.186 3057.92 341.842 3057.92 492.7C3057.92 503.334 3057.92 514.647 3057.35 526.639C3057.16 530.846 3053.66 534.112 3049.45 534.112H2689.15C2685.88 534.112 2683.24 536.761 2683.24 540.028C2683.24 617.922 2735.49 667.222 2811.42 667.222C2870.04 667.222 2912.35 641.829 2927.02 596.261C2928.14 592.793 2931.29 590.314 2934.94 590.314H3043.48C3048.44 590.314 3052.22 594.795 3051.14 599.64C3030.5 691.905 2944.22 764.836 2817.33 764.836ZM2686.87 439.185C2685.84 443.964 2689.6 448.33 2694.49 448.33H2922.6C2927.43 448.33 2931.17 444.061 2930.29 439.314C2918.7 376.993 2874.41 342.828 2809.44 342.828C2749.31 342.828 2699.92 378.645 2686.87 439.185Z" fill="white"/>
|
|
6
|
-
<path d="M3374.61 764.836C3215.87 764.836 3119.24 665.25 3119.24 506.504C3119.24 349.73 3220.8 247.186 3378.56 247.186C3509.1 247.186 3592.93 316.338 3615.47 429.168C3616.44 434.016 3612.67 438.47 3607.73 438.47H3492.48C3488.71 438.47 3485.48 435.836 3484.52 432.199C3471.16 381.668 3433.43 350.716 3376.59 350.716C3297.71 350.716 3247.42 414.806 3247.42 506.504C3247.42 598.202 3296.72 661.306 3376.59 661.306C3434.41 661.306 3472.19 629.409 3485.53 577.881C3486.48 574.229 3489.71 571.58 3493.49 571.58H3607.82C3612.73 571.58 3616.49 575.983 3615.56 580.809C3593.73 694.688 3505.22 764.836 3374.61 764.836Z" fill="white"/>
|
|
7
|
-
<path d="M3912.45 764.836C3778.36 764.836 3674.83 666.236 3674.83 506.504C3674.83 350.716 3778.36 247.186 3912.45 247.186C3979.76 247.186 4027.7 271.986 4060.38 309.906C4065.03 315.295 4074.31 313.151 4075.56 306.146L4083.83 259.699C4084.51 255.882 4087.83 253.102 4091.71 253.102H4186.45C4190.87 253.102 4194.45 256.684 4194.45 261.102V750.92C4194.45 755.338 4190.87 758.92 4186.45 758.92H4091.72C4087.84 758.92 4084.51 756.13 4083.84 752.304L4075.41 704.325C4074.2 697.4 4065.13 695.195 4060.49 700.478C4027.28 738.288 3980.02 764.836 3912.45 764.836ZM3937.1 661.306C4017.96 661.306 4070.21 599.188 4070.21 507.49C4070.21 412.834 4017.96 350.716 3937.1 350.716C3855.27 350.716 3803.01 412.834 3803.01 506.504C3803.01 599.188 3855.27 661.306 3937.1 661.306Z" fill="white"/>
|
|
8
|
-
<path d="M4308.28 758.92C4303.86 758.92 4300.28 755.338 4300.28 750.92V261.102C4300.28 256.684 4303.86 253.102 4308.28 253.102H4402.87C4406.82 253.102 4410.17 255.975 4410.78 259.87L4418.21 307.536C4419.35 314.889 4429.31 316.992 4433.87 311.112C4460.35 276.986 4499.34 253.102 4569.45 253.102H4588.08C4592.49 253.102 4596.08 256.684 4596.08 261.102V359.478C4596.08 363.896 4592.49 367.478 4588.08 367.478H4543.82C4456.06 367.478 4425.5 430.582 4425.5 508.476V750.92C4425.5 755.338 4421.92 758.92 4417.5 758.92H4308.28Z" fill="white"/>
|
|
9
|
-
<path d="M4945.28 764.836C4878.19 764.836 4829.58 739.429 4797.41 702.222C4792.74 696.826 4783.41 698.971 4782.16 705.993L4773.91 752.323C4773.23 756.14 4769.91 758.92 4766.03 758.92H4671.29C4666.87 758.92 4663.29 755.338 4663.29 750.92V76.72C4663.29 72.3017 4666.87 68.72 4671.29 68.72H4780.51C4784.93 68.72 4788.51 72.3017 4788.51 76.72V298.558C4788.51 306.201 4798.56 309.773 4803.88 304.285C4836.23 270.932 4882.25 247.186 4946.27 247.186C5082.34 247.186 5181.92 343.814 5181.92 505.518C5181.92 661.306 5082.34 764.836 4945.28 764.836ZM4920.63 661.306C5001.48 661.306 5054.73 599.188 5054.73 506.504C5054.73 412.834 5001.48 350.716 4920.63 350.716C4839.78 350.716 4786.54 412.834 4786.54 505.518C4786.54 599.188 4839.78 661.306 4920.63 661.306Z" fill="white"/>
|
|
10
|
-
<path d="M5506.64 764.836C5348.88 764.836 5243.38 661.306 5243.38 506.504C5243.38 350.716 5348.88 247.186 5506.64 247.186C5664.4 247.186 5769.9 350.716 5769.9 506.504C5769.9 661.306 5664.4 764.836 5506.64 764.836ZM5506.64 661.306C5589.46 661.306 5641.72 597.216 5641.72 506.504C5641.72 414.806 5589.46 350.716 5506.64 350.716C5423.82 350.716 5371.56 414.806 5371.56 506.504C5371.56 597.216 5423.82 661.306 5506.64 661.306Z" fill="white"/>
|
|
11
|
-
<path d="M5861.42 758.92C5857 758.92 5853.42 755.338 5853.42 750.92V261.102C5853.42 256.684 5857 253.102 5861.42 253.102H5956.19C5960.05 253.102 5963.37 255.867 5964.06 259.671L5971.55 300.893C5972.78 307.645 5981.5 309.909 5986.22 304.93C6017.56 271.903 6062.75 247.186 6133.44 247.186C6243.88 247.186 6336.56 306.346 6336.56 477.91V750.92C6336.56 755.338 6332.98 758.92 6328.56 758.92H6219.34C6214.92 758.92 6211.34 755.338 6211.34 750.92V487.77C6211.34 398.044 6173.87 351.702 6100.9 351.702C6021.04 351.702 5978.64 401.988 5978.64 492.7V750.92C5978.64 755.338 5975.06 758.92 5970.64 758.92H5861.42Z" fill="white"/>
|
|
12
|
-
<g clip-path="url(#clip0_77_150)">
|
|
13
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M434.346 2.3064C436.82 0.879051 439.867 0.879058 442.342 2.30641L872.685 250.582C875.162 252.01 876.688 254.652 876.688 257.511V754.051C876.688 756.91 875.162 759.552 872.685 760.981L442.342 1009.26C439.867 1010.68 436.82 1010.68 434.346 1009.26L4.00221 760.981C1.52575 759.552 0 756.91 0 754.051V257.511C0 254.652 1.52576 252.01 4.00222 250.582L434.346 2.3064ZM708.094 505.781C708.094 577.323 679.674 645.935 629.086 696.523C578.498 747.111 509.886 775.531 438.344 775.531C366.802 775.531 298.19 747.111 247.602 696.523C197.014 645.935 168.594 577.323 168.594 505.781C168.594 434.239 197.014 365.627 247.602 315.039C298.19 264.451 366.802 236.031 438.344 236.031C509.886 236.031 578.498 264.451 629.086 315.039C679.674 365.627 708.094 434.239 708.094 505.781Z" fill="url(#paint0_linear_77_150)"/>
|
|
14
|
-
<path d="M876.688 252.891V472.062L438.344 606.938L0 472.062V252.891L438.344 0L876.688 252.891Z" fill="url(#paint1_linear_77_150)"/>
|
|
15
|
-
</g>
|
|
16
|
-
<defs>
|
|
17
|
-
<linearGradient id="paint0_linear_77_150" x1="0" y1="0" x2="0" y2="1011.56" gradientUnits="userSpaceOnUse">
|
|
18
|
-
<stop stop-color="#5EEAD4"/>
|
|
19
|
-
<stop offset="1" stop-color="#0D9488"/>
|
|
20
|
-
</linearGradient>
|
|
21
|
-
<linearGradient id="paint1_linear_77_150" x1="175.338" y1="-5.42644e-06" x2="516.194" y2="492.348" gradientUnits="userSpaceOnUse">
|
|
22
|
-
<stop stop-color="white" stop-opacity="0.5"/>
|
|
23
|
-
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
24
|
-
</linearGradient>
|
|
25
|
-
<clipPath id="clip0_77_150">
|
|
26
|
-
<rect width="876.688" height="1011.56" fill="white"/>
|
|
27
|
-
</clipPath>
|
|
28
|
-
</defs>
|
|
29
|
-
</svg>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<svg width="6453" height="1012" viewBox="0 0 6453 1012" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M1351.98 758.92C1348.62 758.92 1345.62 756.818 1344.46 753.66L1165.91 263.842C1164.01 258.623 1167.88 253.102 1173.43 253.102H1290.39C1293.8 253.102 1296.84 255.271 1297.95 258.501L1417.67 606.681C1420.15 613.888 1430.34 613.876 1432.8 606.663L1551.59 258.519C1552.7 255.279 1555.74 253.102 1559.17 253.102H1673.15C1678.7 253.102 1682.57 258.623 1680.67 263.842L1502.12 753.66C1500.96 756.818 1497.96 758.92 1494.6 758.92H1351.98Z" fill="black"/>
|
|
3
|
-
<path d="M1748.91 758.92C1744.49 758.92 1740.91 755.338 1740.91 750.92V261.102C1740.91 256.684 1744.49 253.102 1748.91 253.102H1858.13C1862.55 253.102 1866.13 256.684 1866.13 261.102V750.92C1866.13 755.338 1862.55 758.92 1858.13 758.92H1748.91ZM1803.03 187.04C1762.6 187.04 1733.02 157.46 1733.02 118.02C1733.02 78.58 1762.6 49 1803.03 49C1842.47 49 1873.04 78.58 1873.04 118.02C1873.04 157.46 1842.47 187.04 1803.03 187.04Z" fill="black"/>
|
|
4
|
-
<path d="M2254 764.836C2186.91 764.836 2138.3 739.429 2106.13 702.222C2101.46 696.826 2092.13 698.971 2090.88 705.993L2082.63 752.323C2081.95 756.14 2078.63 758.92 2074.75 758.92H1980.01C1975.59 758.92 1972.01 755.338 1972.01 750.92V76.72C1972.01 72.3017 1975.59 68.72 1980.01 68.72H2089.23C2093.65 68.72 2097.23 72.3017 2097.23 76.72V298.558C2097.23 306.201 2107.28 309.773 2112.61 304.285C2144.95 270.932 2190.97 247.186 2254.99 247.186C2391.06 247.186 2490.64 343.814 2490.64 505.518C2490.64 661.306 2391.06 764.836 2254 764.836ZM2229.35 661.306C2310.2 661.306 2363.45 599.188 2363.45 506.504C2363.45 412.834 2310.2 350.716 2229.35 350.716C2148.5 350.716 2095.26 412.834 2095.26 505.518C2095.26 599.188 2148.5 661.306 2229.35 661.306Z" fill="black"/>
|
|
5
|
-
<path d="M2817.33 764.836C2652.67 764.836 2552.1 662.292 2552.1 507.49C2552.1 350.716 2654.64 247.186 2807.47 247.186C2956.36 247.186 3057.92 341.842 3057.92 492.7C3057.92 503.334 3057.92 514.647 3057.35 526.639C3057.16 530.846 3053.66 534.112 3049.45 534.112H2689.15C2685.88 534.112 2683.24 536.761 2683.24 540.028C2683.24 617.922 2735.49 667.222 2811.42 667.222C2870.04 667.222 2912.35 641.829 2927.02 596.261C2928.14 592.793 2931.29 590.314 2934.94 590.314H3043.48C3048.44 590.314 3052.22 594.795 3051.14 599.64C3030.5 691.905 2944.22 764.836 2817.33 764.836ZM2686.87 439.185C2685.84 443.964 2689.6 448.33 2694.49 448.33H2922.6C2927.43 448.33 2931.17 444.061 2930.29 439.314C2918.7 376.993 2874.41 342.828 2809.44 342.828C2749.31 342.828 2699.92 378.645 2686.87 439.185Z" fill="black"/>
|
|
6
|
-
<path d="M3374.61 764.836C3215.87 764.836 3119.24 665.25 3119.24 506.504C3119.24 349.73 3220.8 247.186 3378.56 247.186C3509.1 247.186 3592.93 316.338 3615.47 429.168C3616.44 434.016 3612.67 438.47 3607.73 438.47H3492.48C3488.71 438.47 3485.48 435.836 3484.52 432.199C3471.16 381.668 3433.43 350.716 3376.59 350.716C3297.71 350.716 3247.42 414.806 3247.42 506.504C3247.42 598.202 3296.72 661.306 3376.59 661.306C3434.41 661.306 3472.19 629.409 3485.53 577.881C3486.48 574.229 3489.71 571.58 3493.49 571.58H3607.82C3612.73 571.58 3616.49 575.983 3615.56 580.809C3593.73 694.688 3505.22 764.836 3374.61 764.836Z" fill="black"/>
|
|
7
|
-
<path d="M3912.45 764.836C3778.36 764.836 3674.83 666.236 3674.83 506.504C3674.83 350.716 3778.36 247.186 3912.45 247.186C3979.76 247.186 4027.7 271.986 4060.38 309.905C4065.03 315.295 4074.31 313.151 4075.56 306.146L4083.83 259.699C4084.51 255.882 4087.83 253.102 4091.71 253.102H4186.45C4190.87 253.102 4194.45 256.684 4194.45 261.102V750.92C4194.45 755.338 4190.87 758.92 4186.45 758.92H4091.72C4087.84 758.92 4084.51 756.13 4083.84 752.304L4075.41 704.325C4074.2 697.4 4065.13 695.195 4060.49 700.478C4027.28 738.288 3980.02 764.836 3912.45 764.836ZM3937.1 661.306C4017.96 661.306 4070.21 599.188 4070.21 507.49C4070.21 412.834 4017.96 350.716 3937.1 350.716C3855.27 350.716 3803.01 412.834 3803.01 506.504C3803.01 599.188 3855.27 661.306 3937.1 661.306Z" fill="black"/>
|
|
8
|
-
<path d="M4308.28 758.92C4303.86 758.92 4300.28 755.338 4300.28 750.92V261.102C4300.28 256.684 4303.86 253.102 4308.28 253.102H4402.87C4406.81 253.102 4410.17 255.975 4410.78 259.87L4418.21 307.536C4419.35 314.889 4429.31 316.992 4433.87 311.112C4460.35 276.986 4499.34 253.102 4569.45 253.102H4588.08C4592.49 253.102 4596.08 256.684 4596.08 261.102V359.478C4596.08 363.896 4592.49 367.478 4588.08 367.478H4543.82C4456.06 367.478 4425.5 430.582 4425.5 508.476V750.92C4425.5 755.338 4421.92 758.92 4417.5 758.92H4308.28Z" fill="black"/>
|
|
9
|
-
<path d="M4945.28 764.836C4878.19 764.836 4829.58 739.429 4797.41 702.221C4792.74 696.826 4783.41 698.971 4782.16 705.993L4773.91 752.323C4773.23 756.14 4769.91 758.92 4766.03 758.92H4671.29C4666.87 758.92 4663.29 755.338 4663.29 750.92V76.72C4663.29 72.3017 4666.87 68.72 4671.29 68.72H4780.51C4784.93 68.72 4788.51 72.3017 4788.51 76.72V298.558C4788.51 306.201 4798.56 309.773 4803.88 304.285C4836.23 270.932 4882.25 247.186 4946.27 247.186C5082.34 247.186 5181.92 343.814 5181.92 505.518C5181.92 661.306 5082.34 764.836 4945.28 764.836ZM4920.63 661.306C5001.48 661.306 5054.73 599.188 5054.73 506.504C5054.73 412.834 5001.48 350.716 4920.63 350.716C4839.78 350.716 4786.54 412.834 4786.54 505.518C4786.54 599.188 4839.78 661.306 4920.63 661.306Z" fill="black"/>
|
|
10
|
-
<path d="M5506.64 764.836C5348.88 764.836 5243.38 661.306 5243.38 506.504C5243.38 350.716 5348.88 247.186 5506.64 247.186C5664.4 247.186 5769.9 350.716 5769.9 506.504C5769.9 661.306 5664.4 764.836 5506.64 764.836ZM5506.64 661.306C5589.46 661.306 5641.72 597.216 5641.72 506.504C5641.72 414.806 5589.46 350.716 5506.64 350.716C5423.82 350.716 5371.56 414.806 5371.56 506.504C5371.56 597.216 5423.82 661.306 5506.64 661.306Z" fill="black"/>
|
|
11
|
-
<path d="M5861.42 758.92C5857 758.92 5853.42 755.338 5853.42 750.92V261.102C5853.42 256.684 5857 253.102 5861.42 253.102H5956.19C5960.05 253.102 5963.37 255.867 5964.06 259.671L5971.55 300.893C5972.78 307.645 5981.5 309.909 5986.22 304.93C6017.56 271.903 6062.75 247.186 6133.44 247.186C6243.88 247.186 6336.56 306.346 6336.56 477.91V750.92C6336.56 755.338 6332.98 758.92 6328.56 758.92H6219.34C6214.92 758.92 6211.34 755.338 6211.34 750.92V487.77C6211.34 398.044 6173.87 351.702 6100.9 351.702C6021.04 351.702 5978.64 401.988 5978.64 492.7V750.92C5978.64 755.338 5975.06 758.92 5970.64 758.92H5861.42Z" fill="black"/>
|
|
12
|
-
<g clip-path="url(#clip0_82_53)">
|
|
13
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M434.346 2.3064C436.82 0.879051 439.867 0.879058 442.342 2.30641L872.685 250.582C875.162 252.01 876.688 254.652 876.688 257.511V754.051C876.688 756.91 875.162 759.552 872.685 760.981L442.342 1009.26C439.867 1010.68 436.82 1010.68 434.346 1009.26L4.00221 760.981C1.52575 759.552 0 756.91 0 754.051V257.511C0 254.652 1.52576 252.01 4.00222 250.582L434.346 2.3064ZM708.094 505.781C708.094 577.323 679.674 645.935 629.086 696.523C578.498 747.111 509.886 775.531 438.344 775.531C366.802 775.531 298.19 747.111 247.602 696.523C197.014 645.935 168.594 577.323 168.594 505.781C168.594 434.239 197.014 365.627 247.602 315.039C298.19 264.451 366.802 236.031 438.344 236.031C509.886 236.031 578.498 264.451 629.086 315.039C679.674 365.627 708.094 434.239 708.094 505.781Z" fill="url(#paint0_linear_82_53)"/>
|
|
14
|
-
<path d="M876.688 252.891V472.062L438.344 606.938L0 472.062V252.891L438.344 0L876.688 252.891Z" fill="url(#paint1_linear_82_53)"/>
|
|
15
|
-
</g>
|
|
16
|
-
<defs>
|
|
17
|
-
<linearGradient id="paint0_linear_82_53" x1="0" y1="0" x2="0" y2="1011.56" gradientUnits="userSpaceOnUse">
|
|
18
|
-
<stop stop-color="#5EEAD4"/>
|
|
19
|
-
<stop offset="1" stop-color="#0D9488"/>
|
|
20
|
-
</linearGradient>
|
|
21
|
-
<linearGradient id="paint1_linear_82_53" x1="175.338" y1="-5.42644e-06" x2="516.194" y2="492.348" gradientUnits="userSpaceOnUse">
|
|
22
|
-
<stop stop-color="white" stop-opacity="0.5"/>
|
|
23
|
-
<stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
24
|
-
</linearGradient>
|
|
25
|
-
<clipPath id="clip0_82_53">
|
|
26
|
-
<rect width="876.688" height="1011.56" fill="white"/>
|
|
27
|
-
</clipPath>
|
|
28
|
-
</defs>
|
|
29
|
-
</svg>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { logger } from './logger';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Extract client IP address from request headers.
|
|
5
|
-
* Checks common proxy headers (x-forwarded-for, x-real-ip, cf-connecting-ip).
|
|
6
|
-
*/
|
|
7
|
-
export function getClientIp(c: { req: { header: (name: string) => string | undefined } }): string {
|
|
8
|
-
// Cloudflare
|
|
9
|
-
const cfIp = c.req.header('cf-connecting-ip');
|
|
10
|
-
if (cfIp && isValidIp(cfIp)) return cfIp;
|
|
11
|
-
|
|
12
|
-
// Standard proxy headers
|
|
13
|
-
const forwarded = c.req.header('x-forwarded-for');
|
|
14
|
-
if (forwarded) {
|
|
15
|
-
const first = forwarded.split(',')[0].trim();
|
|
16
|
-
if (isValidIp(first)) return first;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const realIp = c.req.header('x-real-ip');
|
|
20
|
-
if (realIp && isValidIp(realIp)) return realIp;
|
|
21
|
-
|
|
22
|
-
logger.warn(
|
|
23
|
-
'Could not extract client IP from request headers (x-forwarded-for, x-real-ip, cf-connecting-ip). ' +
|
|
24
|
-
'Using fallback. Check proxy configuration if this happens frequently.'
|
|
25
|
-
);
|
|
26
|
-
return '127.0.0.1';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const ipv4Regex = /^(?:\d{1,3}\.){3}\d{1,3}$/;
|
|
30
|
-
const ipv6Regex = /^[a-fA-F0-9:]+$/;
|
|
31
|
-
|
|
32
|
-
function isValidIp(ip: string): boolean {
|
|
33
|
-
return ipv4Regex.test(ip) || ipv6Regex.test(ip);
|
|
34
|
-
}
|
package/src/lib/pod-backups.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* List Supabase database backups stored inside the Postgres pod's /backups dir
|
|
3
|
-
* (k8s mode, used when an env has no S3 configured). Shared by `backup` and
|
|
4
|
-
* `restore` so the parsing of `ls` output lives in exactly one place.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { getPostgresPod, sshKubectl } from './ssh.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @param {string} ip - master node IP
|
|
11
|
-
* @param {string} sshKeyPath - path to the deploy SSH key
|
|
12
|
-
* @param {{ sort?: 'recent' | 'largest' }} [options]
|
|
13
|
-
* - 'recent' (default) → newest first (`ls -lt`); restore lists by recency.
|
|
14
|
-
* - 'largest' → biggest first with human-readable sizes (`ls -lhS`);
|
|
15
|
-
* backup lists by size.
|
|
16
|
-
* @returns {Array<{ size: string, date: string, name: string }>} parsed entries
|
|
17
|
-
* (empty array if the pod is unreachable or holds no backups)
|
|
18
|
-
*/
|
|
19
|
-
export async function listPodBackups(ip, sshKeyPath, { sort = 'recent' } = {}) {
|
|
20
|
-
const pod = await getPostgresPod(ip, sshKeyPath);
|
|
21
|
-
const lsFlags = sort === 'largest' ? '-lhS' : '-lt';
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const output = await sshKubectl(ip, sshKeyPath, [
|
|
25
|
-
'exec',
|
|
26
|
-
'-n',
|
|
27
|
-
'vibecarbon',
|
|
28
|
-
pod,
|
|
29
|
-
'--',
|
|
30
|
-
'sh',
|
|
31
|
-
'-c',
|
|
32
|
-
`ls ${lsFlags} /backups/*_full.tar.gz /backups/*.sql.gz 2>/dev/null || echo NO_BACKUPS`,
|
|
33
|
-
]);
|
|
34
|
-
|
|
35
|
-
if (output === 'NO_BACKUPS' || !output) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return output
|
|
40
|
-
.split('\n')
|
|
41
|
-
.filter((line) => line.includes('.tar.gz') || line.includes('.sql.gz'))
|
|
42
|
-
.map((line) => {
|
|
43
|
-
const parts = line.split(/\s+/);
|
|
44
|
-
return {
|
|
45
|
-
size: parts[4],
|
|
46
|
-
date: `${parts[5]} ${parts[6]} ${parts[7]}`,
|
|
47
|
-
name: parts[parts.length - 1].replace('/backups/', ''),
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
} catch {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
}
|