Skip to content

ADDING COMPOSE #7208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

elshan2000
Copy link

@elshan2000 elshan2000 commented Jul 8, 2025

Issue

What issue is this PR targeting? If there is no issue that addresses the problem, please open a corresponding issue and link it here.

Please read our documentation on release and version management.
If your PR is still work in progress please attach the relevant label.

Tasklist

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

Copy link
Author

@elshan2000 elshan2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker Compose Setup for Project OSRM

This directory contains a Docker Compose configuration to simplify running [Project OSRM](https://github.com/Project-OSRM/osrm-backend).

With this way:

  • Only use docker compose up -d  
  • It launches a frontend service with health checks.
  • Don't need to ensure services start in the correct order.

📂 Directory Structure

osrm-backend/
├── docker-compose.yml
├── prepare_osrm.sh

🏃 Quick Start

1️⃣ Clone this repository

git clone https://github.com/elshan2000/osrm-backend.git
cd osrm-backend

How It Works

Init Service

  • Checks for the marker file osrm_is_created.

  • If not present, runs:

    • osrm-extract
    • osrm-partition
    • osrm-customize
  • Creates the marker file.

  • Exits after preparation.

Backend Service

  • Depends on the frontend healthcheck.
  • Starts osrm-routed serving prepared data.

Frontend Service

  • Periodically checks for the presence of the marker file osrm_is_created.
  • Reports healthy when the preparation is complete.
  • This readiness allows the backend service to start safely.

�ힺ Health Check Logic

The frontend container performs a health check by verifying:

/data/osrm_is_created

Once the file exists, the health check reports healthy. This ensures that:

✅ Data preparation is complete before routing starts.


🧹 Clean Up

To stop and remove all containers:

docker compose down

To force re-preparation of the data (for example, if you want to regenerate .osrm files):

docker compose down
rm ./data/osrm_is_created
docker compose up -d

✨ Contribution

This Docker Compose configuration was contributed by [elshan2000](https://github.com/elshan2000).

Feel free to open issues or submit improvements!


📄 License

This project follows the [Project OSRM](https://github.com/Project-OSRM/osrm-backend) license (BSD-2-Clause).

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.

1 participant