Skip to content

Conversation

@JoseEdSouza
Copy link

Pull Request: Modernize Docker Stack, Add CI/CD, and Fix Monitor Compatibility

Description

This PR introduces a significant overhaul to the deployment and development experience of Barefoot, focusing on containerization, configuration flexibility, and modern tooling compatibility.

Key Changes

1. Docker Modernization

  • Modular Images: Split the monolithic setup into separate, optimized Docker images for map, matcher, and tracker services.
  • Pre-built Workflow: Updated docker-compose.yml to use pre-built images from GitHub Container Registry (GHCR) by default. This allows users to start the stack immediately without local compilation.
  • Build Support: Added docker-compose.build.yml for users who need to build from source.

2. Dynamic Configuration

  • Environment Variables: Replaced the reliance on static property files with dynamic configuration using environment variables.
  • Automatic Mapping: Implemented entrypoint scripts that map environment variables (e.g., SERVER__PORT, MAP__DATABASE_HOST) to server.properties and map.properties at runtime.
  • Benefits: Enables 12-factor app compliance and simplifies deployment across different environments (dev, staging, prod) without rebuilding images.

3. CI/CD Pipeline

  • GitHub Actions: Added a docker-publish.yml workflow that automatically builds and publishes Docker images to GHCR.
  • Conditional Triggers: The workflow is optimized to run only when relevant files (src, map, docker, etc.) are modified.

4. Monitor Tool Fixes

  • Node.js Compatibility: Upgraded the barefoot-monitor dependency from zmq (which had native binding issues on newer Node versions) to zeromq.
  • Async API: Refactored monitor.js to use the new zeromq async/await API, ensuring compatibility with Node.js 20+.

5. Documentation

  • Quick Start: Updated README.md with a "Docker Ready" section, providing clear instructions on how to run the stack and configure it using environment variables.

Motivation & Advantages

  • Ease of Use: Drastically reduces the barrier to entry. New users can run docker-compose up -d and have a fully functional map-matching stack in minutes.
  • Maintainability: Decoupling services and adding CI/CD automation streamlines the release process.
  • Cloud-Native: The move to environment variable configuration makes the application easier to deploy on container orchestration platforms like Kubernetes.
  • Modernization: Updating the monitor tool ensures the visualization components remain usable on modern developer workstations.

epascal and others added 30 commits March 8, 2024 12:20
…atabase, refine PostgreSQL and Osmosis setup.
…t variables, healthcheck, and volume mappings.
…t and database, refine PostgreSQL and Osmosis setup.
…t and database, refine PostgreSQL and Osmosis setup.
…s.maxsize`, update file handling to binary mode, and ensure UTF-8 decoding for socket data.
…with Maven base image and map properties

- Introduce `docker-entrypoint.sh` to dynamically configure `server.properties` and `map.properties` from environment variables.
- Replace base image in `Dockerfile` with Maven for a more streamlined build process.
- Update `docker-compose.yml`:
  - Switch `matcher-server` to build from context.
  - Add environment variables for map and server configurations.
  - Introduce healthcheck dependency for `map-server`.
- Include default `map.properties` settings for database configuration.
- Update None checks with `any()` for better readability.
- Replace deprecated `long` type with `float` in `isinstance()` call.
- Use `input()` instead of `raw_input()` for compatibility with Python 3.
- Align boolean comparisons with Python conventions.
…iguration

- Replace `OSM_*` environment variables with `MAP_*` and `POSTGRES_*` conventions.
- Update `docker-compose.yml`, `entrypoint.sh`, and `Dockerfile` for consistent variable usage.
- Adjust import script execution parameters in the entrypoint script to reflect new variable names.
- Improve clarity and maintainability of environment configurations.
- Split `Dockerfile` into separate files for matcher and tracker services.
- Add `entrypoint.sh` scripts to dynamically configure properties for matcher and tracker servers.
- Update `docker-compose.yml`:
  - Reference new Dockerfiles for matcher and tracker services.
  - Add tracker server configuration with port mappings and environment variables.
- Ensure default properties for server, map, and tracker configurations.
…age subscription to async/await ensuting compatibility with node 20.
…e configuration and automatic map import, replacing static region property files.
… a separate compose file for local builds from source.
…EADME instructions, and add path filtering to Docker publish workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants