services: nearle-api: build: . # Pinned so `docker compose up -d --build` rebuilds the SAME tag the running # container was created from (it was started with `docker run`, not compose). # Without this, compose would build `nearleapi-nearle-api` and leave a # confusing second image behind. image: nearle-api-image container_name: nearle_api restart: unless-stopped ports: - "8000:8000" environment: - MQTT_BROKER=66.116.225.226 - API_STATUS_URL=https://jupiter.nearle.app/live/api/v1/utils/createriderstatus - API_LOGS_URL=https://jupiter.nearle.app/live/api/v1/utils/createriderperiodiclog - API_PROFILE_URL=https://jupiter.nearle.app/live/api/v1/utils/createuserredis # /healthz returns 503 whenever the MQTT side is down, so `docker ps` shows # "unhealthy" instead of the container looking fine while forwarding nothing. healthcheck: test: ["CMD-SHELL", "python -c \"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/healthz', timeout=3).status==200 else 1)\""] interval: 60s timeout: 10s retries: 3 start_period: 30s networks: - nearle-net networks: nearle-net: external: true