Skip to content

Implementation Checklist

Laravel code

  • Copy EmsBackendController.php to app/Http/Controllers/.
  • Merge config_services.php.snippet into config/services.php.
  • Merge routes_api.php.snippet into routes/api.php.
  • Add the three EMS variables to .env.
  • Ensure Laravel HTTP client support is available. It is included in normal Laravel applications through illuminate/http.
  • Protect /api/ems/settings with the application's normal authenticated-admin middleware if only administrators may change EMS settings.
  • Keep the Python bearer token server-side.

Docker

  • Put ems-frontend and ems-backend on the same Docker network.
  • Confirm the Python service name is exactly ems-backend.
  • Set the same bearer token in both containers.
  • Expose Python port 8080 to the Docker network.
  • Do not require port 8080 to be public if Laravel is the only caller.

Verification

  • php artisan route:list --path=api/ems shows six routes.
  • Health request succeeds from inside ems-frontend.
  • Laravel settings GET succeeds.
  • Laravel settings PUT with a complete JSON document succeeds.
  • The Python shared settings file changes after PUT.
  • The EMS operation mode changes on the next EMS cycle.
  • Laravel readings GET returns devices.
  • Laravel per-device readings GET returns readings.
  • Invalid device names return 422.
  • Stopped Python backend returns Laravel 502.