Implementation Checklist
Laravel code
- Copy
EmsBackendController.phptoapp/Http/Controllers/. - Merge
config_services.php.snippetintoconfig/services.php. - Merge
routes_api.php.snippetintoroutes/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/settingswith the application's normal authenticated-admin middleware if only administrators may change EMS settings. - Keep the Python bearer token server-side.
Docker
- Put
ems-frontendandems-backendon the same Docker network. - Confirm the Python service name is exactly
ems-backend. - Set the same bearer token in both containers.
- Expose Python port
8080to the Docker network. - Do not require port
8080to be public if Laravel is the only caller.
Verification
-
php artisan route:list --path=api/emsshows 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.