Unify server, persist ratings via API, refresh scraper data
All checks were successful
Build and Push / build (push) Successful in 13s
All checks were successful
Build and Push / build (push) Successful in 13s
- Replace split setup (ratings_server.py on :8081 + http.server on :8080) with a single combined Flask server (server.py) on :8080 that serves static files and the /api/ratings GET/POST endpoints - Ratings are now persisted server-side: mapa_bytu.html loads ratings from GET /api/ratings on startup (API as source of truth) and POSTs on every change — enables cross-browser and cross-device state sharing while keeping localStorage as a synchronous read cache - Dockerfile: install flask, copy server.py instead of ratings_server.py, expose only port 8080 - entrypoint.sh: start single server process instead of two - Makefile: add serve / serve-debug targets for local development - scrape_psn.py: fix log label, add --max-pages stub arg for CLI parity - Refresh all scraped property data Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,11 +6,13 @@ RUN apk add --no-cache curl bash tzdata \
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
RUN pip install --no-cache-dir flask
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY scrape_and_map.py scrape_realingo.py scrape_bezrealitky.py \
|
||||
scrape_idnes.py scrape_psn.py scrape_cityhome.py \
|
||||
merge_and_map.py regen_map.py run_all.sh ratings_server.py ./
|
||||
merge_and_map.py regen_map.py run_all.sh server.py ./
|
||||
|
||||
COPY build/crontab /etc/crontabs/root
|
||||
COPY build/entrypoint.sh /entrypoint.sh
|
||||
@@ -18,7 +20,7 @@ RUN chmod +x /entrypoint.sh run_all.sh
|
||||
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
EXPOSE 8080 8081
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=60s --timeout=5s --start-period=300s \
|
||||
CMD wget -q -O /dev/null http://localhost:8080/ || exit 1
|
||||
|
||||
@@ -18,8 +18,5 @@ crond -b -l 2
|
||||
echo "[entrypoint] Starting initial scrape in background..."
|
||||
bash /app/run_all.sh &
|
||||
|
||||
echo "[entrypoint] Starting ratings API server on port 8081..."
|
||||
DATA_DIR="$DATA_DIR" python3 /app/ratings_server.py &
|
||||
|
||||
echo "[entrypoint] Starting HTTP server on port 8080..."
|
||||
exec python3 -m http.server 8080 --directory "$DATA_DIR"
|
||||
echo "[entrypoint] Starting combined server on port 8080..."
|
||||
exec DATA_DIR="$DATA_DIR" python3 /app/server.py
|
||||
|
||||
Reference in New Issue
Block a user