diff --git a/CLAUDE.md b/CLAUDE.md index ead2d07..e691e42 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -23,8 +23,9 @@ Data transport architecture options: `docs/pf_perspective_options.md` ``` server.js Express entry point; pg pool; session; type parsers for bigint/numeric -pf.sh Account and territory admin (add-user, passwd, set-territory, …) -install.sh Fresh install +pf.sh Install, deploy and admin: config, db-setup, deploy, install-service, + add-user, passwd, set-territory, … (fresh install: config → db-setup + → add-user → deploy → install-service) routes/ auth.js POST /api/login, /api/logout, GET /api/me; login throttle tables.js GET /api/tables, /api/tables/:schema/:tname/preview diff --git a/install.sh b/install.sh deleted file mode 100755 index 2af88c5..0000000 --- a/install.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash -set -e - -echo "" -echo "========================================" -echo " Pivot Forecast — Install" -echo "========================================" -echo "" - -# ── DB connection ───────────────────────────────────────────── -read -p "DB host [192.168.1.110]: " DB_HOST -DB_HOST=${DB_HOST:-192.168.1.110} - -read -p "DB port [5432]: " DB_PORT -DB_PORT=${DB_PORT:-5432} - -read -p "DB name [ubm]: " DB_NAME -DB_NAME=${DB_NAME:-ubm} - -read -p "DB user [ptrowbridge]: " DB_USER -DB_USER=${DB_USER:-ptrowbridge} - -read -s -p "DB password: " DB_PASSWORD -echo "" - -read -p "App port [3030]: " PORT -PORT=${PORT:-3030} - -# Session cookies are signed with this; the server refuses to start without it. -SESSION_SECRET=$(node -e 'console.log(require("crypto").randomBytes(32).toString("hex"))') - -read -p "Send session cookie over HTTPS only? [Y/n]: " SECURE_ANS -case "${SECURE_ANS:-y}" in [Nn]*) COOKIE_SECURE=false ;; *) COOKIE_SECURE=true ;; esac - -# ── Write .env ──────────────────────────────────────────────── -cat > .env </dev/null || die "psql not found — install postgresql-client" echo - bold "DB Setup — will run: setup_sql/01_schema.sql, setup_sql/02_auth.sql" - warn "This creates the pf schema, tables, and the account/session tables." - warn "Safe to re-run (CREATE IF NOT EXISTS)." + bold "DB Setup — will run: setup_sql/01_schema.sql, setup_sql/gen_dim_period.sql, setup_sql/02_auth.sql" + warn "This creates the pf schema and tables, the pf.dim_period calendar, and the account/session tables." + warn "The calendar's fiscal year starts in the month set in gen_dim_period.sql (fiscal_start_month) — check it before a first install." + warn "Safe to re-run (CREATE IF NOT EXISTS; existing calendar rows are never overwritten)." read -rp " Continue? [y/N] " confirm [[ "$confirm" =~ ^[Yy]$ ]] || { echo "Aborted."; return; } run_psql -v ON_ERROR_STOP=1 -f "${APP_DIR}/setup_sql/01_schema.sql" + run_psql -v ON_ERROR_STOP=1 -f "${APP_DIR}/setup_sql/gen_dim_period.sql" run_psql -v ON_ERROR_STOP=1 -f "${APP_DIR}/setup_sql/02_auth.sql" success "Schema applied." @@ -574,7 +576,7 @@ interactive_menu() { echo " 4) restart restart server" echo " 5) status service + DB + git info" echo " 6) logs tail journald logs" - echo " 7) db-setup apply setup_sql/01_schema.sql" + echo " 7) db-setup apply the pf schema, calendar and auth tables" echo " 8) config set DB connection + app PORT" echo " 9) install-service create systemd unit file" echo " 10) uninstall-service remove systemd unit file"