Getting started on macOS with Docker - HY-OHTUPROJ-OSRM/osrm-project GitHub Wiki

Running the HY‑OHTUPROJ‑OSRM stack on macOS with Docker

These step‑by‑step notes assume Docker Desktop for macOS is installed and running. All commands can be copied verbatim ➜ paste into Terminal.app.

Example folder legend

~/ohtu/osrm-demo
├── routing-api/
│   ├── buildmac.sh
│   ├── startmac.sh
│   ├── create_database.sh
│   ├── ...
│   └── osrm-backend/
│       └── docker/
│           └── Dockerfile-debian
└── routing-front/
    ├── buildmac.sh
    ├── ...
    └── startmac.sh

0  Create / enter a project root

# Feel free to choose another location
mkdir -p ~/ohtu/osrm-demo
cd       ~/ohtu/osrm-demo

1  Run the PostGIS database (Docker)

docker run --platform linux/amd64 \
           -p 5432:5432 \
           -e POSTGRES_PASSWORD=pass \
           --name postgis \
           -d postgis/postgis
  • Argument --platform linux/amd64 tells Docker to fetch the Intel/AMD 64-bit build of the image—even on Apple Silicon (arm64). Docker Desktop uses QEMU under the hood to emulate x86-64 if your Mac’s CPU is arm64
  • Container name  : postgis
  • DB connection   : postgreslocalhost:5432 ▸ password pass

2  Set up the Routing API service

2‑a  Clone & checkout dev branch

# still inside ~/ohtu/osrm-demo
git clone https://github.com/HY-OHTUPROJ-OSRM/routing-api.git
cd routing-api

2‑b  Init the OSRM backend submodule & build its image

cd osrm-backend

git submodule init
git submodule update

# build the Debian‑based OSRM image (~v6.0.0)
docker build -f docker/Dockerfile-debian \
             -t osrm-backend:v6.0.0-debian .

cd ..  # back to routing-api/

2‑c  Compile API

./buildmac.sh

3  Set up the Front‑end

cd ~/ohtu/osrm-demo     # <- back to project root
git clone https://github.com/HY-OHTUPROJ-OSRM/routing-front.git
cd routing-front
git checkout dev

./buildmac.sh

4  Launch everything

Open two terminal tabs:

4‑a  API tab

cd ~/ohtu/osrm-demo/routing-api
./startmac.sh

4‑b  Front‑end tab

cd ~/ohtu/osrm-demo/routing-front
./startmac.sh

Both scripts print the local URL (e.g. http://localhost:3000 for the API, http://localhost:8080 for the UI).


Troubleshooting

Symptom Quick check Fix
Port 5432 busy / DB won’t start sudo lsof -iTCP:5432 -sTCP:LISTEN Stop the blocking service:
docker ps --filter "publish=5432" look for NAMES
docker rm <NAME>
API can’t connect to database docker logs postgis (look for "database system is ready to accept connections") Verify DATABASE_HOST / PORT / USER / PASSWORD / DB in your environment and in routing-api/startmac.sh.
Front page 404 / blank tail -f routing-front/logs/* Check for Webpack / Vite build errors, then rerun front's ./buildmac.sh and ./startmac.sh.

✅ Done! Open the front‑end URL, search for a route, and watch the API query your freshly‑loaded PostGIS + OSRM backend.

⚠️ **GitHub.com Fallback** ⚠️