Lean MV3 extension + standalone single-file ingest server that pulls watched sellers' full inventories from the Discogs API into discogs_full (mp_* schema), tracking price changes and sales over time. Successor to pliceclogs/marketwatcher; runs alongside the legacy plice server on a separate port (5057). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.6 KiB
Bash
43 lines
1.6 KiB
Bash
#!/bin/zsh
|
|
# Deploy the discgod ingest server (+ headless crawler) to the tailscale box
|
|
# and restart it. Backs up the existing server first. Run from anywhere:
|
|
# zsh /Users/johnking/discgod/deploy.sh
|
|
set -e
|
|
|
|
HOST=johnking@100.91.239.7
|
|
DIR=/Users/johnking/Documents/MONSTERPANEL/discgod
|
|
PORT=5057
|
|
|
|
# Resolve this script's directory so the local paths work from any machine.
|
|
HERE=${0:A:h}
|
|
LOCAL_SERVER=$HERE/server
|
|
|
|
scp "$LOCAL_SERVER/discgod_server.py" \
|
|
"$LOCAL_SERVER/discgod_crawl.py" \
|
|
"$LOCAL_SERVER/schema.sql" \
|
|
"$HOST:/tmp/"
|
|
|
|
ssh "$HOST" "
|
|
set -e
|
|
mkdir -p $DIR
|
|
cd $DIR
|
|
# Back up any existing server before overwriting.
|
|
[ -f discgod_server.py ] && cp discgod_server.py discgod_server_backup_\$(date +%Y%m%d_%H%M).py || true
|
|
cp /tmp/discgod_server.py /tmp/discgod_crawl.py /tmp/schema.sql .
|
|
chmod +x discgod_crawl.py
|
|
|
|
# Restart the ingest server.
|
|
OLDPID=\$(lsof -tiTCP:$PORT -sTCP:LISTEN || true)
|
|
[ -n \"\$OLDPID\" ] && kill \$OLDPID && sleep 2 || true
|
|
nohup /opt/homebrew/bin/python3 discgod_server.py > discgod_server.log 2>&1 &
|
|
sleep 3
|
|
echo '--- health ---'; curl -s http://localhost:$PORT/discgod/health; echo
|
|
echo '--- stats ---'; curl -s http://localhost:$PORT/discgod/stats; echo
|
|
echo '--- log ---'; head -5 discgod_server.log
|
|
"
|
|
echo
|
|
echo "Done. Tables (mp_* + discgod_seller_watch) are created in discogs_full on startup."
|
|
echo "Next: put your token in ~/.discgod_token on the box for the headless crawler:"
|
|
echo " ssh $HOST 'echo YOUR_TOKEN > ~/.discgod_token && chmod 600 ~/.discgod_token'"
|
|
echo "Seed the Aussie sellers: ssh $HOST 'cd $DIR && python3 discgod_crawl.py --seed /tmp/aus_sellers.txt'"
|