Fase 0: scaffold monorepo, SvelteKit skeleton, and dev infrastructure
- Turborepo + pnpm workspaces with apps/web and packages/types - SvelteKit app: Tailwind, Paraglide i18n (en/es), keycloak-js, Supabase client, auth/collective stores, PWA service worker skeleton, all route placeholders - packages/types: domain types (User, Collective, ShoppingList, etc.) and database.ts placeholder for generated types - Justfile with dev, db-*, kc-*, build, backup, restore, deploy recipes - infra/docker-compose.dev.yml: Postgres 15, GoTrue, PostgREST, Realtime v2.83, Storage, Kong (port 8001), Studio, Keycloak 24 - infra/docker-compose.prod.yml, kong.yml, db-init scripts, backup/deploy scripts - keycloak/realm-export.json with colectivo realm and 5 dev test users - supabase/config.toml and seed.sql with sample collective and items - GitHub Actions: ci.yml (lint+typecheck+build) and deploy.yml (GHCR + SSH) - .env.example documenting all required variables - Fixed docker-compose issues: Studio image tag, Kong port conflict (8001), internal role passwords init script, Realtime METRICS_JWT_SECRET/APP_NAME Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
27
infra/scripts/backup-cron.sh
Executable file
27
infra/scripts/backup-cron.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# backup-cron.sh — intended to be run by cron on the production host.
|
||||
# Example crontab entry (daily at 03:00 UTC):
|
||||
# 0 3 * * * /opt/colectivo/infra/scripts/backup-cron.sh >> /var/log/colectivo-backup.log 2>&1
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
LOG_PREFIX="[$(date -u +"%Y-%m-%dT%H:%M:%SZ")] backup-cron:"
|
||||
|
||||
# Load env vars from the production .env
|
||||
if [ -f "$SCRIPT_DIR/../../.env" ]; then
|
||||
# shellcheck disable=SC1091
|
||||
set -a; source "$SCRIPT_DIR/../../.env"; set +a
|
||||
fi
|
||||
|
||||
echo "$LOG_PREFIX Starting scheduled backup"
|
||||
"$SCRIPT_DIR/backup.sh" supabase
|
||||
echo "$LOG_PREFIX PostgreSQL backup done"
|
||||
|
||||
"$SCRIPT_DIR/backup.sh" keycloak
|
||||
echo "$LOG_PREFIX Keycloak backup done"
|
||||
|
||||
# Prune local temp files older than 1 day
|
||||
find /tmp/colectivo-backups -type f -mtime +1 -delete 2>/dev/null || true
|
||||
|
||||
echo "$LOG_PREFIX All done"
|
||||
Reference in New Issue
Block a user