team-nifty-gmbh / flux-license
License management for Flux ERP
Requires
- composer/semver: ^3.3
- team-nifty-gmbh/flux-erp: ^1.12
Requires (Dev)
- brianium/paratest: ^7.0
- laravel/pint: ^1.25
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-livewire: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v2.6.0
- v2.5.1
- v2.5.0
- v2.4.1
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- dev-chore/flux-erp-1.12
- dev-feat/report-every-billable-activation
- dev-feat/confirm-billable-user-activation
- dev-feat/package-update-notifications
- dev-feature/laravel-13-support
This package is auto-updated.
Last update: 2026-10-13 09:26:30 UTC
README
License management for Flux ERP.
Billable user activation
Activating a user under Settings → Users (create modal or edit page) asks for confirmation when the user adds to the license bill. The price comes from flux.team-nifty.com/api/flux-licenses/{license_key}/pricing, is cached for a day and checked against the free, minimum and maximum accounts of the license. When the price cannot be fetched, the confirmation is asked anyway without naming it. Activations through the API are not affected.
Every activation of a billable user is reported to flux.team-nifty.com/api/flux-licenses/{license_key}/user-activations, whichever way it happens: confirmed in the dialog (ui), through the API (api, with the token name), from the console (console) or anything else (other). The report carries the activated user, the acting user, IP address, user agent, the price and the time. It hooks into the created and updated events of the user model, so a direct action or model call is covered as well. The report is a queued job (ReportUserActivation) with retries; it checks the price itself and skips activations within the free accounts. A failing dispatch is logged and never blocks the activation.
Maintenance window
flux-license:maintenance-begin takes an instance offline without breaking running work:
- puts the app into maintenance mode (
--retry,--secret) - pauses all queues (
queue:pausefor every connection,horizon:pausewhen Horizon is installed), running jobs are allowed to finish - interrupts a running
schedule:run - waits until no job is reserved any more (
--timeout, default 300 seconds)
If jobs are still running after the timeout, the command exits non-zero and leaves the instance down and paused.
flux-license:maintenance-end resumes the queues (and Horizon), brings the app up and, with --health-url, fails unless that URL answers with a 2xx status. Both commands are idempotent.
Deploy script (Forge)
cd $FORGE_SITE_PATH $FORGE_PHP artisan flux-license:maintenance-begin --retry=60 trap '$FORGE_PHP artisan flux-license:maintenance-end --health-url="https://$FORGE_SITE_NAME/up"' EXIT git pull origin $FORGE_SITE_BRANCH $FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader $FORGE_PHP artisan migrate --force $FORGE_PHP artisan optimize $FORGE_PHP artisan octane:reload # only on Octane sites
The trap brings the instance back even when a step fails.
Server snapshot
php artisan flux-license:maintenance-begin # take the snapshot here, an online snapshot pauses the VM sudo chronyc makestep || sudo systemctl restart systemd-timesyncd # correct the clock after the pause php artisan flux-license:maintenance-end --health-url=https://example.com/up