Published · Updated
Device provisioning across application, identity and VPN systems
I built the central provisioning application in Laravel 11 to tie together device records, Authentik, WireGuard configuration, the reverse proxy, and Bash setup scripts on the hardware. This note focuses on how state ownership was split across those systems.
- Laravel
- device provisioning
- WireGuard
- Authentik
- Redis
- REST API
- automation
One source of truth for each piece of state
Registration accepted single serial numbers and ranges, and the same workflow had to create the identity and network config the device needed during setup.
Each part of device state had a single owner. Laravel held the device record and workflow logic, Authentik handled identity and access, WireGuard with wg-portal owned VPN configuration, Nginx Proxy Manager handled the proxy layer, and the setup scripts only applied changes on the hardware. None of the components duplicated another’s state.
The workflow in Laravel
The application used PostgreSQL and Redis queues so long-running provisioning work wouldn’t block an administrator’s HTTP request. Laravel Horizon showed queue progress and failed jobs. Panel and service access ran through Authentik, and middleware restricted the provisioning endpoint.
An administrator could paste a mixed, comma-separated list of individual serials and ranges (for example E000001-E000230). The app deduplicated the input into one list for approval, then generated the WireGuard config. Bash scripts on the device fetched it through a single REST API serving as the only interface for hardware automation.
- Single serial numbers and ranges in one input, deduplicated before approval.
- Panel and service access controlled through Authentik.
- Redis queues for background work, with progress and errors visible in Horizon.
- One REST API as the sole interface for device-side scripts.
Retries and undoing completed steps
Provisioning calls external services over HTTP from queued jobs, so any step can time out or fail halfway through. Failed steps were retried; if an error persisted, the pipeline undid the steps already completed, including changes made in external services rather than only in the database.
That isn’t a distributed transaction: every undo is another network call that can fail too. When one did, the failed job surfaced in the queue, but the rollback had no retry loop or dedicated audit log. If I built this again today, compensating steps would get the same retries and logging as the forward steps.
Scope and limits
The workflow processed batches of hundreds of devices in a test environment. The client ultimately decided not to roll it out to production with live devices, and my involvement ended in May 2025.
See also: Freelance Laravel backend development.