Search by

team-nifty-gmbh / flux-license

team-nifty

License management for Flux ERP

Package info

github.com/Team-Nifty-GmbH/flux-license

pkg:composer/team-nifty-gmbh/flux-license

Statistics

Installs: 14 279

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.6.0 2026-10-13 08:00 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:

  1. puts the app into maintenance mode (--retry, --secret)
  2. pauses all queues (queue:pause for every connection, horizon:pause when Horizon is installed), running jobs are allowed to finish
  3. interrupts a running schedule:run
  4. 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