Created attachment 208743 [details]
svn diff to update net-im/prosody to 0.11.3 + lua 5.2
I'd like to propose some changes to the prosody port, all contained in the attached patch:
1) Update Prosody to 0.11.3.
2) Drop LuaJIT and switch to Lua 5.2. LuaJIT is effectively dead, and though still working with Lua 5.1 Prosody's official-as-documented requirement is Lua 5.2.
3) Use arc4random.
4) Do not install the example certs because absolutely noone should use them.
5) Store user data in /var/db/prosody rather than /usr/local/var/lib/prosody. This requires moving an existing folder and I'm not sure about the right way to do this... is there a reliable way to do this automatically or would a pkg-install message be sufficient?
6) Install prosody-migrator (PR#235189). Do not add luadbi to RUN_DEPENDS though because it would pull in about 150MB of dependencies for this optional feature.
7) Update the configure-script switches. Explicitly state all required settings and do not use the "ostype" switch because some settings will be wrong then.
The patched port will build without warnings in poudriere and the resulting package has been working without any problems on my little Prosody server.
Thanks! Couple notes:
1) What's the reasoning behind arc4random change?
2) Is there a reason to use /var/db/ for the pid instead of /var/run?
3) There are some errors when building via poudriere. Log attached.
Created attachment 208756 [details]
Poudriere build log
1) I had no intention for switching to arc4random, but I discovered this option while looking for something else, and it seems to be a sensible choice. arc4random is supposed to give us secure, performant, non-blocking randomness, and since we're on BSD we get it for free - not even a linker flag needed. So I guess there's mostly no reason for not using arc4random.
2) The default location for the pid file is the data directory which got moved from /usr/local/var/lib/prosody to the more fitting /var/db/prosody meaning the pid file ended up there as well. I agree that /var/run would be a better location for the pid file, but this needs more changes and checks and I didn't want to adress this issue in this round.
3) Sorry, I forgot to "svn add" a file and messed up the diff. Corrected version attached. Thanks for checking!
Created attachment 208837 [details]
svn diff, corrected version
Ok, looks like that works. For the pid, I'm fine with it in either location, but I think it's best we decide now, otherwise people might have to change their configs twice. For whatever reason, in my production server it's specified in the config file.
I'm proposing the upgrade steps as:
1) service prosody stop
2) pkg upgrade prosody (or cd /usr/ports/net-im/prosody && make deinstall && make install)
3) mv /usr/local/var/lib/prosody/* /var/db/prosody/
4) If "pidfile" is specified in prosody.cfg.lua, change its new location to /var/db/prosody/prosody.pid (or remove the line)
5) service prosody start
We could technically do step 3 automatically on install, but I'm worried about yanking a db out from under a running process.
Finally I had a look at the pid file...
By default Prosody doesn't write a pid file. However, a pid file needs to be defined via the "pidfile" config option or prosodyctl won't work. Without a leading path the pid file will be placed in the data directory (aka /var/db/prosody), otherwise in the defined location which needs write permissions for the prosody user.
So, I've updated the patch to create /var/run/prosody with the required permissions and use /var/run/prosody/prosody.pid as the default location in the rc script. This should match the users' expectations.
While I was at it I simplified the rc script. Grepping for an explicit "daemonize=false" in the config, then daemonizing via "daemon" rather than "prosodyctl" just isn't right, and without the "-p" option can't possibly work correctly, either. So this is gone. We stick to prosodyctl. It's up to the user to choose a different startup method when required (e.g. debugging).
With these changes #4 in your proposed upgrade steps would be
4) Set 'pidfile = "/var/run/prosody/prosody.pid"' in prosody.cfg.lua
What's the best way to communicate the upgrade steps to the user? Should the 5-step-guide be placed in pkg-message or is there a better way?
Created attachment 209298 [details]
svn diff, including new pid file location
Created attachment 210139 [details]
net-im/prosody 0.11.2 to 0.11.3 diff
Hi! I've just taken a look at the patch. Package builds fine and runs fine with the data moved to the new directory. I've added a pkg-message file which unifies the other pkg-messages and notifies users upgrading from a previous release about the changes and the steps needed as suggested by lx@.
It would also be a good idea to mention this in UPDATING, but other than that things look fine here and the upgrade was fairly painless on my end. :)
I'll be landing (and MFH'ing) bug 241488 shortly
- Depend on bug 241488 to ensure it gets done first
- Patch here needs updating to be rebased after bug 241488 commit
@Thomas Any older patches in this issue should be obsoleted. A single patch per issue is ideal, unless patches *must* be to be committed separately, say for instance in order to separate mergeable (port fixes) patches from non-mergeable (version updates)
Created attachment 210822 [details]
Prosody 0.11.3 refactoring patch
With the update for Prosody 0.11.3 finally committed, here's an updated patch for the refactoring parts only, that is:
- switch to Lua 5.2
- remove support for the dead LuaJIT
- fix configure flags
- fix rc script
- move data directory and pid file (see separate comment for UPDATING)
- add the prosody-migrator
- remove cert examples
- use arc4random for randomness
Minor change: the cert examples are now removed completely as a self signed cert as well as real cert requests can be generated with prosodyctl.
The new patch has no major complaints from portlint and builds without warning in poudriere with 11.3 and 12.1 on AMD64. I've been running the refactored Prosody since October 2019 (and the re-created package since yesterday).
Created attachment 210823 [details]
UPDATING info for the refactoring patch
Finally, here's a short text that should be added to the UPDATING file and that will inform Prosody users about the changes regarding the pid file and data directory and the required steps for an upgrade.
I did not include this in the refactoring patch so that the refactoring patch applies cleanly, regardless of changes in UPDATING by other ports.