feat: implement manual routing sync system, update map tile URLs to HTTPS, and migrate admin session storage to localStorage

This commit is contained in:
Hamza-Ayed
2026-07-15 23:01:18 +03:00
parent 78fe6c48cc
commit c97c961c96
14 changed files with 281 additions and 18 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# --------------------------------------------------------------------------
# check_routing_sync.sh
# Runs via cron every minute to check if the admin dashboard requested
# a routing graph rebuild (due to a newly approved road).
# --------------------------------------------------------------------------
APP_DIR="/home/hamzadoctor/app"
cd "${APP_DIR}"
# Read flag from Redis using the redis container
SYNC_REQ=$(docker compose exec -T redis redis-cli get routing_sync_requested | tr -d '\r')
if [ "$SYNC_REQ" = "1" ] || [ "$SYNC_REQ" = "\"1\"" ]; then
echo "$(date): Sync requested! Triggering delta apply and GH rebuild..."
# 1. Delete the flag immediately so we don't trigger it again
docker compose exec -T redis redis-cli del routing_sync_requested
# 2. Apply delta
if [ -f "${APP_DIR}/infrastructure/scripts/apply-delta.sh" ]; then
bash "${APP_DIR}/infrastructure/scripts/apply-delta.sh"
fi
# 3. Restart GraphHopper to rebuild index
docker compose stop routing
rm -rf "${APP_DIR}/infrastructure/osm-data/graph-cache" "${APP_DIR}/infrastructure/osm-data/default-gh"
docker compose up -d routing
echo "$(date): Routing rebuild triggered successfully."
fi
@@ -21,6 +21,9 @@ BBOX_SYRIA="35.7,32.3,42.4,37.3"
echo "🚀 Starting Overture Data Pipeline (Jordan & Syria)..."
echo "🧹 Clearing old Overture tables to prevent duplication..."
docker compose -f /home/hamzadoctor/app/docker-compose.yml exec -T db psql -U $DB_USER -d $DB_NAME -c "DROP TABLE IF EXISTS overture_place, overture_building, overture_segment;"
# 1. Setup Python Environment
# ... (rest of setup)
if [ ! -d "venv_overture" ]; then
@@ -68,9 +71,12 @@ process_city() {
# 3. Execution (Jordan & Syria)
# Jordan
process_city "jordan_north" "$BBOX_JORDAN_NORTH" "division_area"
process_city "jordan_north" "$BBOX_JORDAN_NORTH" "place"
process_city "jordan_south" "$BBOX_JORDAN_SOUTH" "division_area"
process_city "jordan_south" "$BBOX_JORDAN_SOUTH" "place"
# Syria
process_city "syria" "$BBOX_SYRIA" "division_area"
process_city "syria" "$BBOX_SYRIA" "place"
echo "🎉 Administrative boundary GeoJSONs ready for import!"
+6
View File
@@ -15,6 +15,12 @@ echo "0 3 */10 * * /home/hamzadoctor/app/infrastructure/scripts/update-data.sh >
# 2. Discover road closures daily at 4:00 AM
echo "0 4 * * * curl -X POST -H \"x-api-key: intaleq_secret_2026\" http://localhost:3200/api/map-refinement/roads/discover-closures >> /home/hamzadoctor/app/infrastructure/logs/closures.log 2>&1" >> $CRON_FILE
# 3. Check for manual routing sync requests every minute
echo "* * * * * /home/hamzadoctor/app/infrastructure/scripts/check_routing_sync.sh >> /home/hamzadoctor/app/infrastructure/logs/routing_sync.log 2>&1" >> $CRON_FILE
# 4. Update Overture Maps Data on the 1st of every month at 2:00 AM
echo "0 2 1 * * /home/hamzadoctor/app/infrastructure/scripts/overture_ingest.sh >> /home/hamzadoctor/app/infrastructure/logs/overture_ingest.log 2>&1" >> $CRON_FILE
# Install crontab
crontab $CRON_FILE
rm $CRON_FILE