Check and monitor the server

  • For IT
  • Bugsoft Portal 4.12.14

bugsoft status and production:check show at a glance whether the server is all right; how to connect them to your monitoring.

Two commands show whether Bugsoft Portal runs well. Use them after the installation, after every update, and in your monitoring.

bugsoft status

sudo bugsoft status

It shows:

  • the version;
  • whether PHP-FPM, the web server and MariaDB (if it is on this server) are running;
  • whether /healthz answers;
  • how old the last backup is;
  • how many days the certificate is still valid;
  • whether the keys still need to go into the password vault;
  • the result of production:check.
Exit codeMeaning
0Everything is all right.
1Advice: for example, the backup is older than 36 hours, or the certificate expires within 30 days.
2Error: a service is not running, /healthz does not answer, or production:check reports an error.

These codes work like those of Nagios and similar monitoring tools.

production:check

sudo bugsoft production:check
sudo bugsoft production:check --json

One list: ✓ good, ! advice, ✗ fix this first. With a ✗ the command exits with code 1.

With --json you get the same rows as JSON (passes, and per row key, status and text), for a script or your monitoring.

It checks, among other things: the environment and debug, the keys, the address (https), PHP and its extensions, the database, the last backup, free disk space, the permissions of the configuration file, the scheduled tasks, sign-in, the emergency account and the licence. Every row is explained below, under Every row of production:check.

Every row of production:check

The first column is the key of the row in --json. Rows that do not apply to your server, such as the SQLite rows with MariaDB, are not shown.

RowGood whenHow to fix it
envAPP_ENV is productionChange the configuration file (The configuration file).
debugAPP_DEBUG is offSet APP_DEBUG=false: with debug on, visitors see error details.
demoDemo mode is offSet APP_DEMO=false. A demo belongs on a server of its own.
keyAPP_KEY is setsudo bugsoft key:generate on a new server; see Keys and secrets on the server.
vaultVAULT_KEKS is setsudo bugsoft vault:keygen; see Keys and secrets on the server.
urlAPP_URL starts with https://Set up HTTPS on the web server or the proxy (HTTPS, proxy and load balancer).
installedThe installation is locked and install.token is gonesudo bugsoft install:lock
bug_markThe BugOS ladybird (the favicon and the assistant mark) is unchangedPut back the files from the package, and contact the vendor.
phpPHP 8.2 or newer with all extensionsInstall what the row names (What the server needs).
php_eolThe PHP version still gets security updatesPlan PHP 8.3 or 8.4. A PHP package of your distribution gets fixes from the distribution itself.
cryptoEncryption works and CRYPTO_SUITE is fixedSet CRYPTO_SUITE to the suite the row names, and never change it again.
opcacheOPcache is onInstall and enable php-opcache.
uploadsupload_max_filesize is at least 6MIn the php.ini of the website, set upload_max_filesize=6M and post_max_size=8M.
migrationsAll database changes have been madesudo bugsoft migrate (an update does this by itself).
sqlite_placeThe SQLite database is outside the web folderMove it at once, and change DB_DATABASE.
sqlite_writeThe database and its folder are writable for PHPMake the PHP-FPM user the owner of the folder. With SELinux: give the folder the type httpd_sys_rw_content_t (semanage fcontext and restorecon); install.sh does this itself.
sqlite_walSQLite runs in WAL modeBugsoft Portal switches WAL on itself. If it is off, the database is often on a network disk. Move it to a local disk.
sqlite_healthThe database is not damagedRestore a backup (Backups and restoring).
backupThere is a backup from the last 36 hoursSee Backups and restoring. With MariaDB in Docker, the backup is made outside Bugsoft Portal; the row then says so.
db_tlsThe database is on this server, or the connection uses TLS and checks the certificateSet DB_SSL_CA (and if needed DB_SSL_CERT and DB_SSL_KEY); see Encryption and keys.
storageThe folder storage/ is writableMake the PHP-FPM user the owner.
diskMore than 1 GB is freeMake space, or remove old backups.
env_fileThe configuration file is only readable by its ownerchmod 600 on the file.
env_placeThe configuration file is outside the web folderMove it at once. If it could be downloaded, make new keys.
cronThe scheduled tasks ran in the last 15 minutesSee Scheduled tasks (cron).
mailBugsoft Portal can send e-mailSee Set up e-mail.
signinA sign-in system is set up and switched onSee Sign-in and sign-in systems.
saml_domNo SAML connection is on, or the PHP extension dom (php-xml) is loadedInstall php-xml (sudo ./install.sh --saml) and restart PHP-FPM; see Sign in with SAML. Without a SAML connection you do not need the extension.
breakglassThere is an emergency account with TOTPsudo bugsoft breakglass:create; see The emergency account.
breakglass_totpBREAKGLASS_SKIP_TOTP is offSwitch it off as soon as the authenticator app is linked.
licenseThe licence is validAdvice during the last days of the trial and during the grace period; a fail while the portal is locked. See The licence.
license_checkThe online licence check got an answer, or it is off, or this is an offline licenceAdvice when there is no answer yet or the last attempt failed: check that cron runs and that the firewall allows the licence server (Outbound connections), then choose Check now on the Licence page. A fail when the package has a check address that is not https, or no key to verify the answers: install an official package from Bugsoft.
license_vendor_keyThe package has the public key of the vendorInstall an official package from Bugsoft.
version_ageThe version is an official package with a release dateCheck whether there is a newer version (What's new). Support covers the latest version and the one before it.
security_updateThe last licence check names no security update for this versionAdvice, never a fail. Install the new version soon: the download and the command are on the Licence page (Update Bugsoft Portal).
audit_retentionThe audit log has a retention periodChoose one in Settings.

Scheduled tasks (cron)

Bugsoft Portal does a few things by itself every minute: send reminders and e-mail, summarise the statistics, clean up old data, anchor the audit log, make the SQLite backup, and send the e-mails about the licence and expiring secrets. For this, cron:run must run every minute.

  • With install.sh, the server arranges this itself with the timer bugsoft-cron. During maintenance it skips a turn. Check it with journalctl -u bugsoft-cron.service.
  • By hand: a crontab line for the website user, for example * * * * * php /path/to/bugsoft/bin/console cron:run.
  • Without access to cron, for example at a hosting provider: set CRON_TOKEN, and let a scheduler call POST /cron/run every minute with the header X-Cron-Token.

In Admin › Settings › System › System status, under Scheduled tasks, you see when cron last ran. If it did not run in the last 15 minutes, production:check gives advice, and the step stays open on Start and the first steps.

/healthz for a load balancer

https://portal.klaverveld.example/healthz answers 200 with {"status":"ok"} when the database answers, and 503 when it does not. Use this address for a load balancer or uptime monitor; it creates no session. During an update, /healthz stays reachable.

Log files

  • The installation and updates: /var/log/bugsoft-install.log
  • Bugsoft Portal itself: /var/lib/bugsoft/logs/
  • The scheduled tasks: journalctl -u bugsoft-cron.service and journalctl -u bugsoft-backup.service

Stuck? See Questions and problems or contact Bugsoft at ugurs156@gmail.com.