initial: split from gov-agreg — vreau.digital standalone platform

Moved from gov-agreg/src/pages/achizitii/* to root (drop prefix).
- 22 pages migrated, 127 files total
- All internal links: /achizitii/X → /X (176 occurrences fixed)
- AchizitiiLayout subnav rewritten: /X paths, top-right link to vreaudigital.ro hub
- BaseLayout new (vreau.digital branding, OG tags, site URL)
- astro.config.mjs: site https://vreau.digital, server output (was static)
- docker-compose: port 5096 (vreaudigital is 5095), container vreau-digital
- deploy.sh: paths /opt/vreau-digital, log /var/log/vreau-digital-deploy.log

Backend shared with gov-agreg:
- PostgreSQL satra (same schemas: seap, firms, anaf, anre, ...)
- Photon, Martin tiles
- Infisical /vreaudigital path (DATABASE_URL etc. shared)

build: PASS (npx astro check 0 errors, npm run build 5s vite + 10s server)
This commit is contained in:
Claude VM
2026-05-13 00:10:32 +03:00
commit a6c03a091e
352 changed files with 75295 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
#!/bin/bash
# SEAP Achiziții Directe (DA) — daily/weekly backfill of e-licitatie.ro DA notices.
#
# The DA endpoint is rate-limited and large (~500K rows already + ~8M historical
# 2017-2024 pending). The scraper itself is idempotent and resumable via
# `seap.sync_state[source='da']`:
# - reads last_date, requests notices > last_date
# - upserts on natural key, updates sync_state to latest fetched
#
# Mirrors scrape-anre.sh / scrape-bugetar.sh pattern. Reads DATABASE_URL via
# Infisical MI, writes envfile, docker-run with --env-file, deletes file.
#
# Env knobs:
# MODE=da | backfill (default: da; backfill = last 6 months ignoring sync_state)
#
# Run:
# sudo /opt/vreaudigital/services/seap-scraper/cron/scrape-da.sh
# sudo MODE=backfill /opt/vreaudigital/services/seap-scraper/cron/scrape-da.sh
set -euo pipefail
MODE="${MODE:-da}"
LOG=/var/log/vreaudigital-da.log
log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG"; }
log "=== SEAP DA scrape started (mode=$MODE) ==="
if docker ps --filter name=vreaudigital-da --format '{{.Names}}' | grep -q '^vreaudigital-da$'; then
log "WARN: vreaudigital-da already running, skipping this tick"
exit 0
fi
docker rm -f vreaudigital-da 2>/dev/null || true
# ── Fetch DATABASE_URL via Infisical Machine Identity ──
source /opt/vreaudigital/.infisical-mi
TOKEN=$(infisical login --method=universal-auth \
--domain="$INFISICAL_API_URL" \
--client-id="$INFISICAL_CLIENT_ID" \
--client-secret="$INFISICAL_CLIENT_SECRET" \
--silent --plain)
umask 077
ENVF=$(mktemp /tmp/.vreaudigital-da-env.XXXXXX)
DBURL=$(infisical secrets get DATABASE_URL \
--domain="$INFISICAL_API_URL" \
--projectId="$INFISICAL_PROJECT_ID" \
--env="$INFISICAL_ENV" --path="$INFISICAL_PATH" \
--token="$TOKEN" --plain --silent)
echo "DATABASE_URL=$DBURL" > "$ENVF"
unset DBURL TOKEN
cd /opt/vreaudigital/services/seap-scraper
if [ ! -d node_modules/tsx ]; then
log "Installing seap-scraper deps..."
docker run --rm -v "$(pwd):/work" -w /work --user "$(id -u):$(id -g)" \
node:22-alpine npm install --omit=optional 2>&1 | tee -a "$LOG" >/dev/null
fi
CID=$(docker run -d \
--name vreaudigital-da \
--network host \
--env-file "$ENVF" \
-v "$(pwd):/work" \
-w /work \
--user "$(id -u):$(id -g)" \
--restart no \
node:22-alpine \
npx tsx src/index.ts --mode=$MODE)
log "container started: $CID"
sleep 3
rm -f "$ENVF"
log "envfile cleaned"
docker wait vreaudigital-da >/dev/null
EXIT_CODE=$(docker inspect -f '{{.State.ExitCode}}' vreaudigital-da 2>/dev/null || echo "?")
docker logs vreaudigital-da 2>&1 | tail -40 | tee -a "$LOG"
log "=== SEAP DA scrape done (exit=$EXIT_CODE) ==="
exit "$EXIT_CODE"