Skip to main content

Published · Updated

Device provisioning across application, identity and VPN systems

I built the central provisioning application in Laravel 11. It ties together device records, Authentik, WireGuard configuration, the reverse-proxy layer and the Bash scripts that set up the device, for registration in batches. This note is mostly about which system owns which piece of device state.

  • Laravel
  • device provisioning
  • WireGuard
  • Authentik
  • Redis
  • REST API
  • automation

One owner for each piece of state

Registration takes single serial numbers and ranges, and the same workflow has to create the identity and network configuration the device needs during setup.

Each of those pieces has one owner. Laravel holds the device record and the business rules, Authentik handles identity and access, WireGuard with wg-portal covers VPN configuration, Nginx Proxy Manager covers the proxy, and the setup scripts only apply changes on the device. None of the components keeps its own copy of the device state.

The workflow in Laravel

The application uses PostgreSQL for data and Redis queues for work that shouldn’t block an administrator’s request. Laravel Horizon shows how the queue is progressing and which jobs failed. Access to the panel and services is configured in Authentik, and middleware restricts the provisioning endpoint.

An administrator can paste a mixed, comma-separated list of single serial numbers and ranges, for example E000001-E000230. The application deduplicates it into one list for the administrator to approve. It then generates the WireGuard configuration, and the Bash scripts on the device fetch it through a REST API, which is the only interface for device-side automation.

  • Single serial numbers and ranges in one input, deduplicated before approval.
  • Panel and service access configured in Authentik.
  • Queues for work that doesn’t need to block the request, visible in Horizon.
  • One REST API as the interface for device-side automation.

Retries and undoing completed steps

Provisioning calls external services over HTTP and runs through queues, so any step can time out or fail halfway. A failed step was retried. If it kept failing, the pipeline undid the steps it had already completed, including what it had created in the external services, not only in the database.

That isn’t a distributed transaction: each undo is another call that can fail. When one did, the failed job showed up in the queue, but there was no retry for the undo and no audit trail of what was left half done. If I built it again, the undo steps would get the same retries and logging as the forward steps.

Scope and limits

The flow handles single devices and ranges in batches; the largest batch processed, in the test environment, was in the hundreds of devices. The system never ran in production with real devices, and my part ended in May 2025. I don’t have before-and-after measurements, so apart from the batch size I don’t give numbers.

See also: Freelance Laravel backend development.

To talk about a similar setup or problem, use the contact page.

Related project

Related case study: