Archived: This repository is a historical academic artifact and is no longer actively maintained. It is public solely for reference purposes and is published without an open-source license. Public availability should not be interpreted as permission to use, modify, or redistribute the material.
LEIA A VERSÃO FINAL DO TCC EM PORTUGUÊS
A bus passenger information system with location tracking, API services, and real-time data processing.
The Compose stack contains the following services and supporting tools:
- BusAPI: Ingests vehicle location updates and publishes them to RabbitMQ
- BusLocationHandler: Processes location messages and stores them in PostgreSQL/PostGIS
- BusPredictionHandler: Consumes processed location updates and writes arrival predictions to Redis
- PisAPI: Client-facing API for locations, schedules, and predictions
- PisWebFrontend: React web application for bus tracking and stop information
- BusPlaybackSimulator: Replays historical parquet data
- BusSqlDatabase (PostgreSQL/PostGIS): Manages GTFS schedule database
- GTFS Schedule Import Tool: Generates schedule SQL from GTFS data
- Redis Stack: Provides the Redis cache and RedisInsight UI
- RabbitMQ: Message broker for real-time communication
- PgAdmin: Database administration interface
The primary data flow is:
flowchart TB
subgraph Input["Data Input"]
simulator[BusPlaybackSimulator]
api[BusAPI]
end
subgraph Messaging["Messaging"]
rabbit[RabbitMQ]
end
subgraph Processing["Processing"]
location[BusLocationHandler]
prediction[BusPredictionHandler]
end
subgraph Storage["Storage"]
postgres[(PostgreSQL)]
redis[(Redis)]
end
subgraph Client["Client Access"]
pis[PisAPI]
frontend[PisWebFrontend]
end
simulator --> api --> rabbit
rabbit --> location --> redis
location --> rabbit
rabbit --> prediction --> redis
postgres --> pis
redis --> pis
pis --> frontend
- Docker and Docker Compose installed
- Git with submodules initialized
- Python 3.8+ and the GTFS import tool dependencies (only when generating the schedule schema)
- AWS CLI (optional; only required to download parquet files from S3)
git clone --recursive https://github.com/Bollos00/BusPisSystem.git
cd BusPisSystem
# If already cloned, initialize submodules:
git submodule update --init --recursiveCopy and modify the environment file:
cp .env.example .env
# Edit .env with your preferred settingsSee BusSqlDatabase/README.md for instructions on preparing GTFS data and generating the schedule schema.
# Start all services
docker compose up -d
# Start infrastructure services only (if needed)
docker compose up -d postgres_db rabbitmq_mq redis_stackThe externally published services are available at the following URLs:
- 🌐 Web Frontend: http://localhost:3000
- 🚌 Bus API: http://localhost:8000 (Documentation: http://localhost:8000/docs)
- 🚏 PIS API: http://localhost:8003 (Documentation: http://localhost:8003/docs, Health: http://localhost:8003/health)
- 🎬 Playback Simulator: http://localhost:8001 (UI: http://localhost:8001/ui, Documentation: http://localhost:8001/docs)
- 📍 Bus Location Handler: Internal service (no published port)
- 🔮 Bus Prediction Handler: Internal service (no published port)
- 🐰 RabbitMQ Management: http://localhost:15672 (guest/guest)
- 📊 RedisInsight: http://localhost:5540 (Redis server: localhost:6379)
- 🗄️ PgAdmin: http://localhost:8080 (admin@example.com/admin)
- 🗃️ PostgreSQL: localhost:5432 (postgres/postgres)
# View service status
docker compose ps
# View logs for all services
docker compose logs -f
# View logs for specific service
docker compose logs -f bus_api
# Stop all services
docker compose down
# Restart specific service
docker compose restart bus_api
# Build all services
docker compose build
# Build specific service
docker compose build bus_api
# Clean up (removes Compose-managed named volumes and stored database data)
docker compose down -v --remove-orphans