Skip to content

burakbasaranb/docker-gps-tracking-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 

Repository files navigation

๐Ÿณ GPS Tracking System Infrastructure - Docker Container Architecture

A comprehensive Docker Container-based microservices GPS tracking system infrastructure, designed for high-performance GPS data processing, parsing, and database management. This project demonstrates modern DevOps, DataOps, and Infrastructure-as-Code practices for GPS tracking solutions, implementing CI/CD-ready, scalable, and production-grade architecture patterns.

๐Ÿš€ System Overview

This project implements a robust Docker Container-based GPS tracking infrastructure that can handle multiple GPS device protocols, process real-time location data, and maintain data integrity across distributed databases. The system is built using containerized microservices architecture for scalability, maintainability, and easy deployment across different environments.

๐Ÿ—๏ธ Architecture

Microservices Structure

  • GPS Data Collection Services - Listen to GPS devices and collect raw data
  • Data Processing Services - Parse and transform GPS data into structured format
  • Database Services - Handle data storage and synchronization
  • Monitoring Services - System health checks and maintenance

Technology Stack

  • Containerization: Docker & Docker Compose
  • Backend Languages: Go, Python, Node.js, PHP
  • Databases: PostgreSQL
  • Orchestration: Cron-based scheduling
  • Monitoring: Custom health check scripts

Infrastructure Approach

  • DevOps Practices: Automated deployment, monitoring, and maintenance
  • DataOps Strategy: Data pipeline automation and quality assurance
  • Infrastructure-as-Code: Version-controlled infrastructure configuration
  • CI/CD Ready: Continuous integration and deployment pipeline support
  • Microservices Architecture: Independent service scaling and management
  • Container Orchestration: Docker Compose for multi-service coordination

๐Ÿ“ Docker Structure

docker/
โ”œโ”€โ”€ ๐Ÿ“ฆ auto-start.sh                    # Linux System startup automation
โ”œโ”€โ”€ ๐Ÿ“ฆ docker-compose.yml               # Main container orchestration
โ”œโ”€โ”€ ๐Ÿ“ฆ portainer-service.yml            # Portainer service configuration
โ”œโ”€โ”€ ๐Ÿ“ฆ redtakip-docker.service          # Systemd service file
โ”œโ”€โ”€ ๐Ÿ“ฆ start.ps1                        # Windows startup script
โ”œโ”€โ”€ ๐Ÿ“ฆ stop.ps1                         # Windows shutdown script
โ”œโ”€โ”€ ๐Ÿ“ฆ README.md                        # Docker setup documentation
โ”œโ”€โ”€ ๐Ÿ“ฆ LINUX_SETUP.md                   # Linux installation guide
โ”‚
โ”œโ”€โ”€ ๐Ÿ batch-processor/                 # Python data processing service
โ”‚   โ”œโ”€โ”€ Dockerfile                      # Container build configuration
โ”‚   โ”œโ”€โ”€ main.py                         # Main data processing logic
โ”‚   โ”œโ”€โ”€ requirements.txt                # Python dependencies
โ”‚   โ””โ”€โ”€ utils/                          # Utility modules
โ”‚
โ”œโ”€โ”€ โฐ cron-service/                     # Bash automation service
โ”‚   โ”œโ”€โ”€ Dockerfile                      # Container build configuration
โ”‚   โ”œโ”€โ”€ backups/                        # Database backup storage
โ”‚   โ”œโ”€โ”€ logs/                           # Service log files
โ”‚   โ””โ”€โ”€ scripts/                        # Automation scripts
โ”‚       โ”œโ”€โ”€ batch_process.sh            # Batch processing automation
โ”‚       โ”œโ”€โ”€ db_backup.sh                # Database backup automation
โ”‚       โ”œโ”€โ”€ go_parse.sh                 # Go parsing automation
โ”‚       โ”œโ”€โ”€ log_clear.sh                # Log cleanup automation
โ”‚       โ”œโ”€โ”€ parse.sh                    # Data parsing automation
โ”‚       โ”œโ”€โ”€ restart_ping.sh             # Service restart automation
โ”‚       โ”œโ”€โ”€ startup.sh                  # System startup automation
โ”‚       โ””โ”€โ”€ system_check.sh             # Health monitoring automation
โ”‚
โ”œโ”€โ”€ ๐Ÿน go-parse-service/                # Go + PHP parsing service
โ”‚   โ”œโ”€โ”€ Dockerfile                      # Container build configuration
โ”‚   โ”œโ”€โ”€ go.mod                          # Go module definition
โ”‚   โ”œโ”€โ”€ go.sum                          # Go dependency checksums
โ”‚   โ”œโ”€โ”€ main.go                         # Main Go service logic
โ”‚   โ””โ”€โ”€ parse/                          # PHP parsing modules
โ”‚       โ”œโ”€โ”€ _base/                      # Base parsing functions
โ”‚       โ”œโ”€โ”€ parse.php                   # Main parsing logic
โ”‚       โ””โ”€โ”€ test.php                    # Testing functions
โ”‚
โ”œโ”€โ”€ ๐Ÿš€ go-service/                      # Go GPS signal service
โ”‚   โ”œโ”€โ”€ Dockerfile                      # Container build configuration
โ”‚   โ”œโ”€โ”€ go.mod                          # Go module definition
โ”‚   โ”œโ”€โ”€ go.sum                          # Go dependency checksums
โ”‚   โ””โ”€โ”€ main.go                         # Main GPS service logic
โ”‚
โ””โ”€โ”€ ๐Ÿ“ก teltonika-service/               # Node.js Teltonika protocol service
    โ”œโ”€โ”€ Dockerfile                      # Container build configuration
    โ”œโ”€โ”€ main.js                         # Main service logic
    โ”œโ”€โ”€ package.json                    # Node.js dependencies
    โ”œโ”€โ”€ binutils64/                     # Binary utilities
    โ”‚   โ”œโ”€โ”€ binutils.js                 # Binary processing utilities
    โ”‚   โ”œโ”€โ”€ package.json                # Package configuration
    โ”‚   โ””โ”€โ”€ README.md                   # Documentation
    โ””โ”€โ”€ teltonika-parser/               # Protocol parsing modules
        โ”œโ”€โ”€ codecs/                     # Protocol codec implementations
        โ”‚   โ”œโ”€โ”€ codec.js                # Base codec functionality
        โ”‚   โ”œโ”€โ”€ codec16.js              # Codec 16 implementation
        โ”‚   โ”œโ”€โ”€ codec7.js               # Codec 7 implementation
        โ”‚   โ””โ”€โ”€ codec8.js               # Codec 8 implementation
        โ”œโ”€โ”€ index.js                     # Main parser entry point
        โ”œโ”€โ”€ package.json                 # Package configuration
        โ”œโ”€โ”€ README.md                    # Documentation
        โ””โ”€โ”€ test/                        # Testing modules
            โ””โ”€โ”€ test.js                  # Test implementation

๐Ÿณ Why Docker?

This project leverages Docker containers for several key advantages:

  • ๐Ÿš€ Quick Setup: Get the entire system running in minutes with a single command
  • ๐Ÿ”ง Consistent Environment: Same behavior across development, testing, and production
  • ๐Ÿ“ฆ Dependency Isolation: Each service runs in its own container with specific dependencies
  • ๐Ÿ”„ Easy Scaling: Scale individual services independently based on demand
  • ๐Ÿ› ๏ธ Simple Deployment: Deploy to any environment (local, cloud, server) without configuration changes
  • ๐Ÿ“Š Resource Management: Efficient resource allocation and monitoring per service
  • ๐Ÿ”„ Version Control: Easy rollback and version management for each service
  • ๐ŸŒ Cross-Platform: Works seamlessly on Windows, macOS, and Linux

๐Ÿ”ง Services

1. GPS Go Service

Technology: Go
Purpose: GPS signal listening for A-brand devices
Features:

  • High-performance GPS data collection
  • Raw data listening and storage
  • Efficient memory management
  • Network communication handling

Port: 8888

2. Teltonika Service

Technology: Node.js
Purpose: Teltonika GPS device protocol support
Features:

  • Multi-protocol support (Codec 7, 8, 16)
  • Binary data parsing
  • Device communication handling
  • Protocol-specific data extraction

Port: 9999

3. Batch Processor Service

Technology: Python
Purpose: Data processing and database synchronization
Features:

  • Batch data processing
  • Database synchronization between local and remote
  • Data transformation and validation
  • Error handling and logging

4. Go Parse Service

Technology: Go + PHP
Purpose: GPS data parsing and processing
Features:

  • High-speed data parsing
  • Multiple data format support
  • Custom parsing algorithms
  • Data validation and cleaning

5. Cron Service

Technology: Bash Scripts
Purpose: System automation and maintenance
Features:

  • Automated database backups
  • System health monitoring
  • Log management and cleanup
  • Scheduled maintenance tasks

6. Portainer Service

Technology: Portainer
Purpose: Container management and monitoring
Features:

  • Web-based Docker container management
  • Real-time container monitoring
  • Container logs and statistics
  • Easy service management interface

Port: 9000

๐Ÿ“Š Data Flow

GPS Devices โ†’ Signal Collection โ†’ Data Parsing โ†’ Processing โ†’ Database Storage
     โ†“              โ†“              โ†“                  โ†“            โ†“
  Go Service   Teltonika     Parse Service      Batch Proc.  Local DB โ†’ Remote DB
                                                            (Raw Data)  (End User Data)
                                                                   โ†“
                                                           Signal Listening
                                                           Data Parsing
                                                           Real-time Processing
                                                                  โ†“
                                                           Clean Data
                                                           End User Apps
                                                           Geographic Services

Container Management & Monitoring
           โ†“
      Portainer Service

๐Ÿ—„๏ธ Database Structure

Local Database

  • Purpose: Signal listening and data parsing operations
  • Tables: Raw GPS data, device logs, parsed information
  • Function: Real-time data collection and processing
  • Optimization: High-performance queries for data parsing

Remote Database

  • Purpose: End-user service and application data
  • Tables: Processed and cleaned GPS data for end users
  • Function: Serves final applications and user interfaces
  • Features: Geographic data support with spatial indexing

๐Ÿ”„ Automation Features

Scheduled Tasks

  • Database Backups: Every 2 hours
  • System Health Checks: Daily at 3:00 AM
  • Log Cleanup: Automated log rotation and cleanup
  • Data Synchronization: Continuous data sync between databases

Monitoring

  • Resource Usage: CPU, memory, and disk monitoring
  • Service Status: Container health monitoring
  • Database Performance: Table sizes and performance metrics
  • System Logs: Comprehensive logging and error tracking

๐Ÿ“ˆ Performance Features

  • High Throughput: Optimized for high-volume GPS data
  • Low Latency: Real-time data processing
  • Scalability: Microservices can be scaled independently
  • Reliability: Automated failover and recovery
  • Monitoring: Comprehensive system health tracking

๐Ÿ”’ Security Features

  • Container Isolation: Each service runs in isolated containers
  • Network Security: Internal network communication
  • Data Encryption: Secure data transmission
  • Access Control: Restricted service access
  • Audit Logging: Comprehensive activity logging

๐Ÿ“ Development

Adding New GPS Protocols

  1. Create new service container
  2. Implement protocol parser
  3. Add to data processing pipeline
  4. Update monitoring and logging

Extending Functionality

  • Add new data processing modules
  • Implement additional database features
  • Create custom monitoring dashboards
  • Add new automation scripts

๐Ÿค Contact & Collaboration

This project showcases a GPS tracking system infrastructure design and architecture. If you're interested in:

  • Implementing this system for your organization
  • Custom development based on this architecture
  • Technical consultation for GPS tracking solutions
  • Partnership opportunities in GPS technology

Please contact us directly for collaboration and implementation details.

๐ŸŒ Website: www.burakbasaran.com

Note: This repository serves as a reference architecture and design showcase, not for direct code contribution.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ž Support

For technical support and questions:

  • Create an issue in the repository
  • Check the documentation
  • Review the logs and monitoring data

๐Ÿ”ฎ Future Enhancements

  • Real-time Dashboard: Web-based monitoring interface
  • Machine Learning: Predictive analytics for GPS data
  • Cloud Integration: Multi-cloud deployment support
  • Advanced Analytics: Geographic data analysis tools
  • Mobile App: Mobile monitoring application

Note: This system is designed for production use in GPS tracking applications. Ensure proper testing and validation before deploying in production environments.