Administrators#
This chapter is for whoever installs the tracker, configures it, moves a MantisBT installation into it, backs it up and upgrades it. It assumes a Unix system, PostgreSQL, and a reverse proxy in front of the tracker.
locust is one binary. It keeps everything in PostgreSQL except the contents of attachments, which are files on disk. It serves its pages itself, and the reverse proxy in front of it terminates TLS.
Requirements#
PostgreSQL 15 or newer. The database user needs
CREATEon the database, for thecitextextension, which is a trusted extension.Rust 1.88 or newer to build from source; the Debian package needs no Rust.
pg_dumponPATHforlocust backupand forlocust migrate --backup-dir, andpg_restoreforlocust restore. The Debian package’s own scripts also usepsql.A mail relay, if the tracker is to send notifications.
No PHP and no web server modules. The tracker needs no cron entry for its own work: it files periodic tasks and sends mail from inside
locust serve. What you may want to run from a timer is your own choice:locust backup(see Backups), andlocust retainandlocust prune-dormant(see Keeping data no longer than needed).
Hardware: a tracker of the size of bugs.taler.net (ten thousand issues, fifty thousand notes) runs comfortably on two cores and a gigabyte of memory. See Capacity for numbers measured on a larger machine.
Installing#
From source#
$ ./bootstrap # from a git checkout; a tarball has ./configure
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
./configure --help lists the directory options that it honours
(--prefix, --bindir, --datadir, --docdir, --mandir,
--sysconfdir). The rest of the autoconf vocabulary is accepted and
ignored, so a packaging driver can run it unchanged. It looks for
cargo and rustc, and a missing one is an error. It also looks
for sphinx-build, pg_dump, pg_restore and psql, and a
missing one is a warning that says what will not work.
make install installs:
|
the binary |
|
the configuration defaults |
|
the manual page |
|
the configuration format |
|
this manual, served under |
make install-conf also writes $SYSCONFDIR/locust/locust.conf if
there is none; it never overwrites one. Without Sphinx the manual is
skipped and everything else is installed as usual, and ./configure
--disable-manual skips it deliberately.
The Debian package#
make deb builds the package and writes it into the directory above
the source tree; run apt install ./locust_*.deb there to install it.
The package creates the system user and /etc/locust/locust.conf,
with a generated SECRET and the public URL. The URL is
http://<this host's name>/ unless you answer the question for it,
which debconf asks only at priority medium or lower;
dpkg-reconfigure locust asks it later. If a local PostgreSQL
cluster is reachable as the postgres user, the package also creates
a PostgreSQL role and a database owned by it. It ships site files for
nginx and Apache in /etc/{nginx,apache2}/sites-available/.
The package stops there. It creates no schema and no administrator, and it asks nothing about them, because an unattended installation cannot know how the tracker is to start: new, or imported from MantisBT. You run:
$ sudo -u locust locust migrate # the schema
$ sudo -u locust locust create-admin # or: locust import ...
$ sudo systemctl start locust
locust create-admin makes an account called administrator with
the address root@localhost and prints a generated password.
--username, --email and --password-stdin (which reads the
password from the first line of standard input) change that, and
--if-no-users makes it do nothing on a database that already has
accounts.
An upgrade migrates by itself: the package runs locust migrate
--if-initialized, which brings an existing schema up to the package’s
version and changes nothing when there is no schema yet. To have the
package dump the database before each such upgrade, run
dpkg-reconfigure -plow locust and say yes to the backup: the dumps
go to /var/backups/locust unless you name another directory, and
when a dump fails, nothing is migrated. An upgrade also renames a
configuration section [locust-mantis] from an older version to
[locust].
Starting the service#
The package ships locust.service, which is enabled but does not start
until there is a schema, and locust-backup.timer, which is shipped
disabled, because where backups go and how long they are kept is your
decision. When you install from source, a unit of three lines is
enough: ExecStart=/usr/local/bin/locust serve as an unprivileged
user, with Restart=on-failure.
locust serve refuses to start while migrations are pending, so a
service that comes up is a service whose schema matches its binary.
The reverse proxy#
Put nginx or Apache in front for TLS. locust builds every absolute URL
from [locust] BASE_URL and does not read the Host header. Three
things matter:
Set
X-Forwarded-For(nginx:$proxy_add_x_forwarded_for) and name the proxy’s address in[locust-rate-limits] TRUSTED_PROXIES. Otherwise every request looks as if it came from the proxy.Allow request bodies as large as
MAX_FILE_SIZEtimesFILE_UPLOAD_MAX_NUM, plus a mebibyte for the form, or uploads fail at the proxy and the form is lost. The shipped site files allow 51 MiB, which is what locust itself accepts with the defaults (ten files of 5 MiB). If you raise either option, raise the proxy’s limit with it.Give the response header room, because a page that lists issues names each of them in a cookie. nginx reads the header into one
proxy_buffer_size(4k by default) and answers 502 when it does not fit; the shipped site sets16k.
Over a UNIX socket (SERVE = unix) there is no peer address at all.
The peer is a process on this host and is trusted, and the client is
taken from X-Forwarded-For.
Configuring#
locust.conf is a GNU Taler configuration file: [sections] of
OPTION = VALUE, case-insensitive names, case-sensitive values,
YES/NO booleans, # and % comments, $VAR and
${VAR:-default} in options that name a file, and @INLINE@ to
read another file. locust.conf(5) and taler.conf(5) document
it.
Files are read in this order, and an option in a later file overrides the same option in an earlier one:
everything in
$PREFIX/share/locust/config.d/: the shipped defaults, which upgrades replace and which are not to be edited;the file given with
-c, or else the first of$XDG_CONFIG_HOME/locust.conf,$HOME/.config/locust.conf,/etc/locust.confand/etc/locust/locust.conf.
Every option has a built-in default, so a tracker with no configuration
file at all serves on 127.0.0.1:8080 against postgres:///locust.
locust config prints the configuration as it was read, every section
and option of the defaults and of your file together, with the values as
they are written (${DOCDIR} is not expanded). It then checks the
configuration as every other command would, and exits with 78 and the
reason when they would refuse it, so it is the check to run before you
restart the service. locust config -d also says which file and line
each value came from. The options that are stored in the database
(Configuration in the database) are not shown.
The sections#
[locust]BASE_URL, the absolute public URL with its trailing slash. This is MantisBT’s$g_path: every absolute link and every mail is built from it.SECRET, a fixed random string for form tokens; if it is unset, it changes at every start, and forms that were left open stop working.ATTACHMENTS_DIR, where the contents of attachments are kept, as<dir>/<aa>/<sha256>.MANUAL_DIR, where this manual is installed (${DOCDIR}by default). These four are locust’s own, and they are read at startup only. Everything else in the section is one of MantisBT’s options (below).[locust-httpd]SERVE = tcpwithPORTandBIND_TO,unixwithUNIXPATHandUNIXPATH_MODE(a stale socket file is replaced), orsystemdfor a socket that the service manager hands over.[locustdb-postgres]CONFIG, the connection URI:postgres:///locustfor the local socket,postgresql://user:password@host/dbnamefor a server. libpq’s key/value form is understood as well.MAX_CONNECTIONSis the size of the pool (16). No TLS is configured here: run PostgreSQL on the same host or on a private network.[locust-policy]The thresholds that decide visibility.
ANONYMOUS_LEVELlets visitors browse at that level without logging in; it is unset by default, so every page needs a login. Setting it switches on MantisBT’sALLOW_ANONYMOUS_LOGINwith an account calledanonymous, whichlocust servecreates. The other options stand for MantisBT’s thresholds, with MantisBT’s defaults:PRIVATE_PROJECT_THRESHOLD(MantisBT’s option of the same name),VIEW_ISSUE_THRESHOLD(VIEW_BUG_THRESHOLD),PRIVATE_ISSUE_THRESHOLD(PRIVATE_BUG_THRESHOLD),PRIVATE_NOTE_THRESHOLD(PRIVATE_BUGNOTE_THRESHOLD) andSHOW_MONITORS_THRESHOLD(SHOW_MONITOR_LIST_THRESHOLD). Levels areviewer,reporter,updater,developer,managerandadministrator. Where[locust]sets the same thing under MantisBT’s name,[locust]wins, and a row in the database wins over both.[locust-mail]TRANSPORT:smtp://host:25,smtp://host:587?tls=required,smtps://user:password@host:465orsendmail. Without it, mail is queued and not sent (see Mail).[locust-rate-limits]ENABLED,TRUSTED_PROXIES, and for each class of request a sustained rate and a burst, as<CLASS>_PER_MINUTEand<CLASS>_BURST. The classes areLOGIN,ACCOUNT(signup, lost password, verification links),WRITE(anything that is not a GET or HEAD),REST(per address),REST_TOKEN(per token) andEXPORT(CSV, Excel, Word, print, RSS, search). A rate of 0 switches a class off.ENABLEDalso switches MantisBT’s anti-spam check (see Rate limits and abuse).[locust-ai]The options for language models:
ENABLED,BOT_SIGNUP, the limits on one filed tree (TREE_MAX_ISSUES,TREE_MAX_DEPTH,TREE_MAX_BYTES),CONFIRM_EXPIRY_DAYS,REQUEST_ID_RETENTION_DAYS, andPATCH_TAG, the tag that the agents’ guide asks for on a report with a patch (patchby default; empty for no such rule).BOT_SIGNUPfollows MantisBT’sALLOW_SIGNUPunless you set it.ENABLED = NOremoves the discovery documents and the JSON and Markdown answers of the issue page, makes everything under/api/aianswer 404, and changes nothing else. See Integrators.[locust-ui]What a page shows where locust departs from MantisBT. Each option has MantisBT’s own behaviour as its other value, so one line gets MantisBT’s page back.
PERM_LOGIN_DEFAULT(YES): the login form’s “Save my login” starts ticked, where MantisBT leaves it clear. A request that carriesperm_loginis obeyed either way.VERSION_SORT(date): the three version columns sort by the day that the release is scheduled for, undated releases last in both directions, where MantisBT (name) sorts by the version’s name.GROUP_RESOLVE(NO): the issue list does not offer MantisBT’s “Resolve” among the actions for a selection. Resolving an issue needs a resolution, a fixed-in version and usually a note, and the mass action asks for none of them. “Update status” is still offered, and an issue’s own page resolves it properly.MAX_PER_PAGE(250): the most issues that one page of a list shows, whatever the filter’s “Show” asks for. MantisBT has no such limit and reads “all” as all of them. A page of several hundred issues names each of them in a cookie, and that response header grows larger than the buffer that the proxy reads it into. The page then answers 502, and so does its filter form, which is where you would set the number back.0is MantisBT’s behaviour, and needsproxy_buffer_sizeraised with it. The print view and the CSV and Excel exports are not paged and are not affected.SUMMARY_CACHE_SECONDS(86400): how long the process keeps the result of the summary query, which both the Summary and the Graphs tab are drawn from and which is the most expensive query on the tracker. Every write discards the whole cache as it finishes, so the day only matters for what changes with the date alone, such as the periods that the charts count in. Two servers against one database, however, see each other’s writes only when the day is up; a tracker that wants the charts exact sets this to 0. At most 64 results are kept at once, one for each viewer, filter, project and range, and the oldest goes first, so the memory that the cache costs has a limit whatever the setting.- MantisBT’s options, in
[locust] MantisBT’s own options, the ones that
config_inc.phpholds, are written in[locust]too, beside locust’s four, under MantisBT’s names without the$g_prefix. No MantisBT option has the name of one of locust’s own. A boolean isYESorNO, a number is a number, a string is itself, and a list or a map is JSON. JSON is also how a threshold takes a set of levels:ADD_BUGNOTE_THRESHOLD = [25, 90]. A name that is neither one of locust’s four nor a MantisBT option that locust reads is an error, and so is a value that is not a number in an option that takes one: locust refuses to start where PHP would have used 0. MantisBT’s own names for what locust’s four do (PATH,CRYPTO_MASTER_SALT,ABSOLUTE_PATH_DEFAULT_UPLOAD_FOLDERandMANUAL_URL) are refused, and the error names the option to write instead.[locust] BASE_URL = https://bugs.example.org/ ATTACHMENTS_DIR = /var/lib/locust/attachments FROM_EMAIL = noreply@example.org WINDOW_TITLE = Example bug tracker MAX_FILE_SIZE = 5000000
locust never ignores an option in one of its own sections without saying
so. A section whose name begins with locust has to be one of those
above, and every option in it has to be one that the section knows.
Anything else is refused at startup, and the error names the option and
the section it stood in. That catches a typing error
([locust-mial], BIND_T0). More usefully, it catches a real
option in the wrong one of locust’s sections, such as one of MantisBT’s
options or one of locust’s own four outside [locust], and then the
error says where the option belongs:
$ locust -c locust.conf serve
Error: reading the configuration
Caused by:
FROM_EMAIL in [locust-mail] is no option of that section; FROM_EMAIL
is one of MantisBT's own options and belongs in [locust]
Sections that are not locust’s are left alone, since a Taler
configuration file carries [paths] and may carry more.
Where locust’s defaults differ from MantisBT’s#
Besides the options of [locust-ui], some of MantisBT’s own defaults
are deliberately not kept:
The due date. MantisBT hides it from everybody (
due_date_view_thresholdanddue_date_update_thresholdare bothnobody). locust shows it to anybody who may see the issue and lets a developer set it, because that field is what its deadlines are made of. Setting both options back tonobodyhides the field again, as MantisBT does.The summary. MantisBT keeps it for managers (
view_summary_threshold = MANAGER). locust gives it to developers, and with it the wholeSummarytab bar (the counts, the graphs, the plan, the resource view and the priorities), because people who do the work cannot argue with a plan that they may not read.VIEW_SUMMARY_THRESHOLD = MANAGERrestores MantisBT’s default.The reauthentication window.
REAUTHENTICATION_EXPIRYin[locust]is four hours in locust, where MantisBT’s default is five minutes. Five minutes suits a password, but with a second factor, a manager who edits a project, adds a category and dates a release types three one-time codes and waits for each. Each guarded page that you open while the window is still open extends it, so continuous work never runs into it. The window guards the account pages, among them the password page, as well as the administration pages, so four hours are four hours in which somebody at an unlocked screen can change a password. If you want it tighter, set it lower.The anti-spam check. MantisBT refuses an account’s next change once it has made too many in a window (
ANTISPAM_MAX_EVENT_COUNTandANTISPAM_TIME_WINDOW_IN_SECONDSin[locust]). In locust this is a rate limit like the others, so it applies only while[locust-rate-limits] ENABLED = YES, and that is off by default.
Configuration in the database#
MantisBT keeps the options that its own administration pages set in a
database table, not in a file, and locust does the same. Those rows
apply on top of locust.conf, per project and per user where MantisBT
resolves them that way.
Figure 32 Manage → Configuration: the options stored in the database, with
where each value comes from.#
So an option can be set in the file, in a row for all projects or in a
row for one project, and the later of these wins; where MantisBT has a
row for one user, that comes on top. The page says where each value
comes from. This page is also where a project’s
bug_report_page_fields is set: the list that decides which optional
fields the report form shows, and the way to give one project a short
form (Managers).
Figure 33 Manage → Overview: versions, paths and what this installation is
made of.#
Users and access#
Figure 34 Manage → Users: accounts, their level, and when each was last
seen.#
An account has a global access level and, per project, a membership that overrides it for that project. Membership applies to exactly one project and is not inherited by its subprojects. That is MantisBT’s rule, and so imported permissions behave exactly as they did in MantisBT.
Deleting a user leaves a disabled placeholder behind, so that their issues and notes keep an author. The name becomes free again.
Dormant accounts: the box under the user list deletes accounts that have not been seen for a given number of years and that nothing refers to: no issue, no note, nothing. It shows the list before it deletes anything.
Two-factor authentication: a project can require it from a level upwards (Managers). When somebody loses their device,
Deactivate OTPon their user page clears the secret and applies every project’s requirement to them again, so their level in those projects is lowered. A manager can raise it again once they have set up a new secret.Signup follows MantisBT’s
allow_signup. Addresses at providers of throwaway addresses are always refused, from a list that is built into locust, and failed logins lock an account as MantisBT’s lockout does.
locust create-admin makes an administrator from the command line
(see The Debian package for its options).
Keeping data no longer than needed#
Two commands delete what is no longer needed, each with --dry-run to
list what would go without deleting anything:
locust prune-dormant --years Ndoes from the command line what the dormant box does from the page (Nis 1 by default). Administrators, protected accounts and the anonymous account are never deleted.locust retaindeletes the recorded hours that belong to no work package, once their month is older than the time for which the project keeps them (Keep unclassified hours foron the project page). Those are issue work that was taken up before it was classified, and activities that were started without a work package. No contract says how long they must be kept, so the tracker must not keep them for ever. Hours that stand on a work package are never touched: deleting those is an administrator’s decision, package by package (Managers). What the command deleted goes into the audit log.
Nothing runs either command by itself. Run them from a timer if the tracker records time or should forget dormant accounts.
Mail#
A change that causes a notification writes it into the notifications
table, in the same transaction as the change. A worker inside locust
serve turns each notification into mail in email_outbox and, with
a TRANSPORT configured, sends it. So nothing is lost when the relay
is down, and nothing is sent twice when a request fails.
Without
[locust-mail] TRANSPORT,locust servestill queues every mail, sends none and logs nothing about it. Once a transport is configured, the queue is sent.locust send-mailsends the mail that is due, once, through the configured transport, for example from a timer or to flush the queue after a relay outage. It needs aTRANSPORTas well.A mail that does not go out is tried again, with the wait doubling each time from a minute to about seventeen hours, for
EMAIL_RETRY_IN_DAYSdays (seven) from the time it was queued. After that it is not tried again, and it keeps itslast_errorfor somebody to read, where MantisBT deletes it.0tries again for ever.Who is mailed about what is decided by MantisBT’s
notify_flagsand by each user’s preferences.SELECT count(*) FROM email_outbox WHERE sent_at IS NULLcounts the mail that has not been sent, including the mail that was given up.... AND created_at > now() - interval '7 days'(with the days ofEMAIL_RETRY_IN_DAYS) counts only what is still being tried, which is the queue to watch after a cutover.
The tracker’s own address#
[locust-mail] says how mail leaves. Who the mail is from is part
of MantisBT’s own configuration, so it is written in [locust] under
MantisBT’s names, not in [locust-mail], where it is refused
(an option in the wrong section). The addresses
default to example.com addresses, as in MantisBT, and the name to
“Mantis Bug Tracker”, so an installation that sends mail sets them:
[locust]
FROM_EMAIL = noreply@example.org
FROM_NAME = Example Bug Tracker
RETURN_PATH_EMAIL = admin@example.org
WEBMASTER_EMAIL = webmaster@example.org
FROM_EMAIL is the sender of every notification, and the organiser of
the invitation that a meeting sends. FROM_NAME is the name beside
it. RETURN_PATH_EMAIL is the envelope sender, where a bounce goes.
WEBMASTER_EMAIL is the address that a page offers to a reader who
cannot get past an error. All four are read again for each mail, so a
configuration page that overrides one takes effect without a restart.
DEBUG_EMAIL sends every mail to one address instead of the person it
was addressed to, with To: <the real recipient> at the top of the
body. It is for trying out a tracker’s notifications without writing to
anybody.
locust does not sign its mail. DKIM is the job of the mail server: the
signature is made where the mail leaves your domain, at the server that
TRANSPORT hands it to, which holds the key. MantisBT’s
EMAIL_DKIM_* options are refused with a message that says so, rather
than accepted and ignored.
Rate limits and abuse#
[locust-rate-limits] ENABLED = YES switches on token buckets per
client and class. A request over a limit gets 429 with
Retry-After instead of the page. Behind a proxy, TRUSTED_PROXIES
must name the proxy, or every client shares one bucket. The same switch
applies MantisBT’s anti-spam check (see Where locust’s defaults differ
from MantisBT’s); with ENABLED = NO, none of these limits applies.
Besides these, locust reproduces MantisBT’s own protections, which apply
whatever ENABLED says: the failed-login lockout, the limit on open
lost-password requests, and the check for throwaway addresses at
signup. In the lockout, a wrong password counts, also for a disabled
account, and a locked account is refused without counting.
Importing from MantisBT#
$ createdb locust
$ locust migrate
$ locust import --from "host=/var/run/postgresql dbname=mantis" \
--crypto-master-salt '<the $g_crypto_master_salt of config_inc.php>'
The import reads a MantisBT 2.0–2.28 database on PostgreSQL. Convert
a MySQL installation first, with pgloader, and import the converted
copy. The import writes everything in one transaction, copies the
attachments into ATTACHMENTS_DIR, and then compares the result with
the source, record by record, and prints the comparison. Issue ids are
preserved.
Options worth knowing:
--crypto-master-saltMantisBT’s
$g_crypto_master_salt. With it, every user’s RSS feed URL stays valid. Without it, they all change.--mantis-upload-dirWhere the files are, if MantisBT was configured with
$g_file_upload_method = DISK. The directory must be readable by the user who runs the import.--table-prefix/--table-suffixMantisBT’s
$g_db_table_prefixand suffix, if they are not the defaults.--verify-onlyCompares an already imported database with the source again.
What the importer refuses rather than guesses:
Usernames that differ only in case. locust’s names are unique regardless of case. The importer stops and lists them, so that you can rename one first.
Access levels that MantisBT does not ship. Levels are a PostgreSQL enum, and a tracker that invented one must map it first.
A project with several parents, which MantisBT allows, is not refused:
locust keeps the parent with the lowest id, and reports the others as
warnings and as skipped.
Read the report before you continue: skipped, unsupported and
warnings must be empty or understood, and every verification line
must read ok.
Some things do not come over. Sessions do not, so everybody logs in
once more. Plugins do not: locust has none and shows no trace of one.
MantisBT’s signup_use_captcha is ignored. The importer counts as
unsupported what it leaves behind of MantisBT’s data: sponsorships,
news items, project documents, per-project user preferences,
time-tracking entries and queued mail. Queued mail means that mail
which MantisBT had not sent yet at the cutover is not sent. Passwords,
API tokens and RSS keys do come over, and MD5 password hashes are
upgraded to Argon2id at each user’s first login.
The cutover#
The checklist below was rehearsed from end to end (compat/rehearse.py
in the source tree), and it is the one that bugs.taler.net and
bugs.gnunet.org follow.
The cutover is smaller than it looks. locust serves MantisBT’s pages at
MantisBT’s page names without the .php. Every old URL, such as
view.php?id=N, index.php or a form posting to
bug_update.php, is answered with a permanent redirect (308) to its
new one, while api/rest/... stays exactly as it is. Links in commit
messages, mails and other trackers keep working, scripts keep working,
and the switch is a change of where the reverse proxy forwards to.
MantisBT stays installed, frozen, for the rollback.
Before the day#
Rehearse on a copy of the real data. Restore last night’s dump, import it into a scratch database, and read the report (above). Time it: the import takes time in proportion to the data.
Configuration ready and reviewed, in particular:
[locust] BASE_URL,SECRETandATTACHMENTS_DIR, the last on a disk with room for the attachments (each file is stored once).[locust]again, for the options from MantisBT’sconfig_inc.php. The options that MantisBT’s web pages set are rows in its database and come over with the import. In particular,MAX_FILE_SIZEmust be MantisBT’s effective limit, which is$g_max_file_sizecapped by PHP’supload_max_filesizeandpost_max_size. In the rehearsal, leaving it at MantisBT’s own default made every issue page differ from MantisBT’s.[locust-mail] TRANSPORT, and[locust-rate-limits]withTRUSTED_PROXIES.
Reverse proxy: the site for locust prepared and not yet enabled.
Backups scheduled, and one restore tried.
Announcement: the time, the window in which the tracker can only be read, and that everybody logs in once more afterwards.
The day#
Step |
What |
Rehearsed |
|---|---|---|
1 |
Freeze MantisBT: the proxy answers 503 to everything that is not a GET or HEAD, except the login and logout pages. Reading and logging in keep working. |
0.5 s |
2 |
Dump: |
0.7 s |
3 |
Frozen copy: |
0.6 s |
4 |
locust database: |
0.3 s |
5 |
Import and verify: |
4.5 s |
6 |
Attachment files: |
< 0.1 s |
7 |
Start locust and check |
|
8 |
Switch the proxy to locust, still frozen, and check as a reporter, a developer and an administrator: an issue, the issue list, My View, and the REST API with a token. |
0.6 s |
9 |
Lift the freeze. From here on, changes exist only in locust. |
|
10 |
Backup: |
0.7 s |
The times are for a synthetic database at the scale of bugs.taler.net (10,095 issues, 50,100 notes, 98,994 history rows, 2,019 attachments, 1,015 users; 71 MB in MantisBT) on a 24-core host with a local PostgreSQL 17. At five times that size, the import and its verification take 21.4 s and 277 MB of memory.
Rollback#
Until step 9, the rollback is only the proxy: point it back at MantisBT and lift the freeze. No change has been made that MantisBT lacks.
After step 9, locust holds changes that MantisBT does not have, and there is no way back that keeps them. Decide within the time you set aside for the checks in step 8. Keep MantisBT’s frozen database and the dump until the new installation has run for a while.
After the switch#
The count of mail that is still being tried falls to zero (see Mail), and the relay’s log shows deliveries.
Scripts that use the REST API work unchanged: both
api/rest/<route>andapi/rest/index.php/<route>are served.RSS readers still get their feeds, if you passed the master salt.
The log shows no rate-limit lines in ordinary use; raise a class if it does.
The first scheduled backup ran, and
locust check-attachmentsis clean.After a quiet period, retire MantisBT, and keep the last dump.
Backups#
$ locust backup --out /backup/locust
writes /backup/locust/locust-<UTC time>.dump (pg_dump
--format=custom) and copies the attachment files that are new since
the last backup into /backup/locust/attachments/.
Dumping first and copying the files second is consistent on purpose: files are named by their SHA-256, written before any row refers to them, and never changed or deleted, so every file that a dump refers to already exists. Keep several dumps; they share the one attachment directory. Copy both off-site with any tool that copies new files.
To restore, create an empty database and point [locustdb-postgres]
CONFIG at it first, because locust restore loads the dump into
the configured database, which must be empty:
$ createdb locust_new
$ locust restore --dump /backup/locust/locust-<time>.dump
The command then copies the backup’s attachment files into
ATTACHMENTS_DIR and checks them, recomputing each file’s SHA-256.
The files are taken from attachments/ beside the dump, unless
--attachments DIR names another directory. A dump written by an
older version of locust is loaded and its files are copied, but the
command then stops before the check, because the schema is older than
the binary: run locust migrate and then locust check-attachments
--deep.
locust check-attachments verifies that every attachment row has its
file with the recorded size, and --deep also recomputes each file’s
SHA-256.
The Debian package ships locust-backup.timer, disabled.
Upgrading#
Read the release’s entry in
NEWS. It is in the source tree and is installed beside this manual inshare/doc/locust(NEWS.gzin the Debian package, with the package’s own notes inNEWS.Debian.gzbeside it). A change to the configuration file is announced there. locust refuses to start with an option that it no longer reads: every command exceptlocust configthen exits with 1 and an error that names the option and its section (locust configexits with 78). A whole section that locust no longer reads makes every command log an error that names the file, and exit with 78.Back up (
locust backup).Install the new binary.
Run
locust migrate, with the same configuration as the service, because a migration may read it. The package does this itself: it runsmigrate --if-initialized.--backup-dir DIRdumps the database first, and migrates nothing if the dump fails.Restart the service.
locust migrate exits with 78, changing nothing, if the database’s
schema is newer than the program, or if a migration was changed after
it was applied. Migrations are compiled into the binary and checksummed,
so there is no directory of SQL files to keep in step.
Downgrades are not supported: restore the backup.
Monitoring#
GET /healthz200 and
okwhile the database answers, 503 otherwise. It needs no authentication and shows no data; this is what a load balancer should poll.- Logs
RUST_LOGsets the level. When it is unset, locust logs atinfo, which is right for most installations: rate-limit rejections and the decisions oflocust migrateare logged atinfo, and mail failures atwarn, so the levelwarnhides the rate-limit rejections and the decisions oflocust migrate.- Database
The usual PostgreSQL metrics. A page of this tracker costs one or two database round trips, whatever the size of the data, so a rising rate of statements means more traffic and not a slow page.
Capacity#
Measured against MantisBT 2.28.4 (php-fpm behind nginx) on the same synthetic data, with a release build of locust and 16 database connections:
Page |
MantisBT (req/s) |
locust (req/s) |
|---|---|---|
Issue list |
412 |
974 |
One issue |
727 |
890 |
My View |
357 |
436 |
REST, a page of 50 issues |
114 |
353 |
Adding a note (web form) |
240 |
452 |
Adding a note (REST) |
317 |
736 |
The difference is in the statements per request: 49 to 683 in MantisBT, 2 to 8 in locust.
Agents#
[locust-ai] ENABLED decides whether language models can read this
tracker as data at all. With it on, the issue page also answers in JSON
and Markdown when asked, /llms.txt and /.well-known/ai describe
the tracker, and /api/ai takes writes from accounts that are marked
as agents. The following rules are enforced, not advice. An agent’s
account has a name that begins with bot-, no password, and the
address of a human behind it, who had to confirm it. An agent may never
delete anything or rewrite somebody else’s words, and an agent’s account
is marked as one wherever its name appears. BOT_SIGNUP = NO keeps
agents from registering at all, and disabling an agent’s account stops
it like any other.
Integrators describes the endpoints.
This manual#
The manual is built by Sphinx from docs/manual in the source tree,
and installed as HTML into $DOCDIR/<language>/. The tracker serves
it under /manual/<language>/ from wherever [locust] MANUAL_DIR
points, and /manual/ sends a reader to their own language, or to
English. It costs no database query and needs no login.
make manualbuilds it, andmake installinstalls it.Without
sphinx-buildthere is no manual, and/manual/answers 404; the rest of the tracker is not affected.To add a language, add its code to
MANUAL_LANGUAGESin theMakefile, runmake manual-gettext, translate the catalogue and rebuild. The tracker itself needs no change: it serves every language directory that it finds at startup, so a restart is enough, and the footer link follows each reader’s own language.
No URL of the manual names a version: an installation serves the manual of the locust that is running.
Troubleshooting#
What you see |
What it usually is |
|---|---|
|
The schema is older than the binary: run |
|
The database is newer than the binary, or an applied migration
was edited: do not force it, use the matching binary. Or the
configuration still has a section that locust no longer reads,
such as |
Every page needs a login, including the public ones |
|
Uploads fail at a size the page allows |
The reverse proxy’s limit on the request body, not locust’s. |
One page answers 502 while the rest of the tracker is fine |
The response header did not fit the proxy’s buffer: raise
|
All requests seem to come from one address, and rate limits refuse ordinary use |
|
Mail is not delivered and the queue grows |
No |
Forms say the token is invalid after a restart |
|
|
No manual is installed, or |
An issue “does not exist” for one user |
It is in a project that the user may not see: such an issue is answered exactly like one that does not exist. A private issue in a project that the user can see is answered with “Access Denied”. |