diff --git a/README.md b/README.md index 19482f6a..a06c6a5a 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,14 @@ The new and improved OCL terminology service v2 3. Go to http://localhost:8000/swagger/ to benefit. 4. Go to http://localhost:8080 for keyCloak. +### Dev Setup on Apple Silicon / arm64 +The published `openconceptlab/oclapi2` Docker images are amd64-only. On arm64 hosts (Apple M-series Macs, arm64 Linux) they run under Rosetta/QEMU emulation, and under load — especially Celery's post-restart indexing — the emulated cores saturate hard enough to block the API for tens of seconds. Use the local-build override to compile from the local Dockerfile instead: +1. `sysctl -w vm.max_map_count=262144` #required by Elasticsearch (no-op on Docker Desktop / OrbStack) +2. `docker compose -f docker-compose.yml -f docker-compose.local.yml up -d` +3. Go to http://localhost:8000/swagger/ to benefit. + +If you previously pulled the amd64 image and have it cached, force a one-time rebuild before step 2: `docker compose -f docker-compose.yml -f docker-compose.local.yml build api`. + ### Configuration #### Authentication OCL API supports authentication using 2 methods. One is Django Auth (integrated into API) and the other is SSO using external service supporting OpenID such as Keycloak, Active Directory, etc. diff --git a/docker-compose.local.yml b/docker-compose.local.yml new file mode 100644 index 00000000..d9ab4c41 --- /dev/null +++ b/docker-compose.local.yml @@ -0,0 +1,23 @@ +# Opt-in override for local native builds on arm64 hosts (Apple Silicon Macs, +# arm64 Linux). The published openconceptlab/oclapi2 images are amd64-only; +# on arm64 they run under Rosetta/QEMU emulation, and once Celery indexing +# kicks in the emulated cores saturate hard enough to block the API for +# tens of seconds at a time. Building from the local Dockerfile (which uses +# python:3.12-slim, a multi-arch base) gives a native image and ~200x faster +# requests in practice. +# +# Usage: +# docker compose -f docker-compose.yml -f docker-compose.local.yml up -d +# +# If you previously pulled the amd64 image, force a one-time rebuild: +# docker compose -f docker-compose.yml -f docker-compose.local.yml build api +# +# The api service is the only one that needs `build:` — all other services +# that share the openconceptlab/oclapi2 image tag will reuse the locally- +# built image once it exists. + +services: + api: + build: + context: . + dockerfile: Dockerfile