- Track already_imported/new_imported counts separately in sync_runs and surface them in status API + dashboard last-run card - Cache invoice data in SQLite orders table (factura_* columns); dashboard falls back to Oracle only for uncached imported orders - Resolve JSON_OUTPUT_DIR and SQLITE_DB_PATH relative to known anchored roots in config.py, independent of CWD (fixes WSL2 start) - Use single Oracle connection for entire validation phase (perf) - Batch upsert web_products instead of one-by-one - Remove stale VFP scripts (replaced by gomag-vending.prg workflow) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
1004 B
Bash
36 lines
1004 B
Bash
#!/bin/bash
|
|
# Start GoMag Import Manager - WSL/Linux
|
|
cd "$(dirname "$0")"
|
|
|
|
# Create venv if it doesn't exist
|
|
if [ ! -d "venv" ]; then
|
|
echo "Creating virtual environment..."
|
|
python3 -m venv venv
|
|
fi
|
|
|
|
# Activate venv
|
|
source venv/bin/activate
|
|
|
|
# Install/update dependencies if needed
|
|
if [ api/requirements.txt -nt venv/.deps_installed ] || [ ! -f venv/.deps_installed ]; then
|
|
echo "Installing dependencies..."
|
|
pip install -r api/requirements.txt
|
|
touch venv/.deps_installed
|
|
fi
|
|
|
|
# Stop any existing instance on port 5003
|
|
EXISTING_PIDS=$(lsof -ti tcp:5003 2>/dev/null)
|
|
if [ -n "$EXISTING_PIDS" ]; then
|
|
echo "Stopping existing process(es) on port 5003 (PID $EXISTING_PIDS)..."
|
|
echo "$EXISTING_PIDS" | xargs kill 2>/dev/null
|
|
sleep 2
|
|
fi
|
|
|
|
# Oracle config
|
|
export TNS_ADMIN="$(pwd)/api"
|
|
export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_15:$LD_LIBRARY_PATH
|
|
|
|
cd api
|
|
echo "Starting GoMag Import Manager on http://0.0.0.0:5003"
|
|
python -m uvicorn app.main:app --host 0.0.0.0 --port 5003
|