livrare website cu erp si crm
This commit is contained in:
parent
28773e3a72
commit
5c7bf7c295
257 changed files with 31929 additions and 0 deletions
77
website/build-from-zero.sh
Executable file
77
website/build-from-zero.sh
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env bash
|
||||
# Build de la 0 Website DiDi - one-shot installer
|
||||
# Versiune 1.0, mai 2026
|
||||
#
|
||||
# Cerinte: docker, docker compose v2
|
||||
# Reteaua Docker `didi-network` trebuie sa existe.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
log() { printf '\033[1;36m[%(%H:%M:%S)T]\033[0m %s\n' -1 "$*"; }
|
||||
err() { printf '\033[1;31m[%(%H:%M:%S)T] ERROR:\033[0m %s\n' -1 "$*" >&2; exit 1; }
|
||||
|
||||
# ── Verificari ──────────────────────────────────────────────
|
||||
command -v docker >/dev/null || err "docker nu e instalat"
|
||||
docker compose version >/dev/null || err "docker compose v2 nu e instalat"
|
||||
|
||||
if ! docker network inspect didi-network >/dev/null 2>&1; then
|
||||
log "Creez reteaua didi-network..."
|
||||
docker network create didi-network
|
||||
fi
|
||||
|
||||
# ── Verificare .env.production ──────────────────────────────
|
||||
if [ ! -f .env.production ]; then
|
||||
err ".env.production lipseste. Vezi CONFIGURATION.md pentru variabile."
|
||||
fi
|
||||
|
||||
# Verifica variabilele critice
|
||||
source .env.production 2>/dev/null || true
|
||||
[ -n "${AUTH_KEYCLOAK_SECRET:-}" ] || err "AUTH_KEYCLOAK_SECRET nu e setat in .env.production"
|
||||
[ -n "${AUTH_SECRET:-}" ] || err "AUTH_SECRET nu e setat in .env.production"
|
||||
[ -n "${STRIPE_SECRET_KEY:-}" ] || err "STRIPE_SECRET_KEY nu e setat in .env.production"
|
||||
[ -n "${ERPNEXT_API_KEY:-}" ] || err "ERPNEXT_API_KEY nu e setat in .env.production"
|
||||
|
||||
# Verifica ERPNext disponibil
|
||||
log "Verific accesibilitate ERPNext..."
|
||||
if ! curl -sf -o /dev/null --max-time 5 "${NEXT_PUBLIC_ERPNEXT_URL:-http://localhost:8080}"; then
|
||||
log " ATENTIE: ERPNext nu raspunde la ${NEXT_PUBLIC_ERPNEXT_URL:-http://localhost:8080}"
|
||||
log " Website-ul porneste oricum, dar paginile vor da erori la API calls catre ERPNext."
|
||||
fi
|
||||
|
||||
# ── Build + start ───────────────────────────────────────────
|
||||
log "Build imagine Docker (~30 sec)..."
|
||||
docker compose build --quiet website 2>&1 | tail -3 || err "Build a esuat"
|
||||
|
||||
log "Pornire container..."
|
||||
docker compose up -d website
|
||||
|
||||
# ── Health check ────────────────────────────────────────────
|
||||
log "Astept ca website-ul sa fie ready..."
|
||||
for i in $(seq 1 20); do
|
||||
HTTP=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 || echo "000")
|
||||
if [ "$HTTP" = "200" ]; then
|
||||
log " UP la http://localhost:3000"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ "$HTTP" != "200" ]; then
|
||||
log " Status: $HTTP - verifica log-urile cu: docker compose logs --tail 50 website"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ── Quick smoke test ────────────────────────────────────────
|
||||
log "Smoke test..."
|
||||
for path in "/" "/about" "/pricing" "/contact" "/api/auth/session"; do
|
||||
code=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000${path}")
|
||||
printf " %-25s %s\n" "$path" "$code"
|
||||
done
|
||||
|
||||
log "============================================="
|
||||
log " Website DiDi UP: http://localhost:3000"
|
||||
log " Test login: test@didi.local / Test1234!"
|
||||
log "============================================="
|
||||
Loading…
Add table
Add a link
Reference in a new issue