Installation: XWiki

Last modified by Mitchell on 2022/01/22 10:20

Setting up XWiki to act exactly the way I wanted was... interesting. Even now, I would argue that not everything's perfect (although it's pretty close). Miscellaneous installation notes:

  • I don't understand why Jetty (and I assume Tomcat) doesn't support the ability to have a WAR where you can maintain a separate directory with any changes you'd like to make on top of it. It looks like they had it in for a handful of point releases, and then removed it for 9.1. It was dropped out of their 9.0.6.v20130930 release as well, even though their source code tag claims otherwise (sloppy, imho). Why the development team couldn't have a replacement ready before removing it? Hell if I know....
    • See, the nice thing about this is that it lets you maintain your configuration changes separate from upstream, especially given that applications are often distributed as WARs. When the common use case is that I then have to extract it because I want to make a few configuration changes, and then have to hand-maintain those changes? Yeah... not so much. Which is why I'm just throwing the whole thing into a version source control system to manage. it'd be nice if I didn't need to, though.
  • The Jetty startup script is... kinda sloppy, imho, from a system administrator's perspective. If you're not running on a Debian-based system (i.e. you don't have start-stop-daemon), it tries to run su. Except you should generally be running daemons as separate accounts with /sbin/nologin?
Putting in a FIXME comment does not justify sloppy coding....
# FIXME: Broken solution: wordsplitting, pathname expansion, arbitrary command execution, etc.

su - "$JETTY_USER" -c "
  exec 
${RUN_CMD[*]} --daemon &
  disown \$!
  echo \$! > '
$JETTY_PID'"
  • If you want to build out start-stop-daemon yourself, here's a quick primer:
# Grab the wheezy (stable) package as of this moment. Find the current one here:
# https://packages.debian.org/wheezy/dpkg
$ curl -o dpkg.tar.xz 'http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_1.16.12.tar.xz'
# .xz isn't a common compression format yet.
$ tar xfvJ dpkg.tar.xz
$ cd dpkg-1.16.12
# The default prefix is /usr/local, and there's nothing wrong with that, but
# services don't always have /usr/local/bin and /usr/local/sbin in their paths.
$ ./configure --prefix=/usr
$ cd lib/compat
$ make
$ cd ../utils
$ make
$ make install /usr/sbin/start-stop-daemon
  • It's always disappointing when the configuration implies you can do something, but it doesn't actually work. Case in point, xwiki.defaultweb, referenced on the Configuration documentation page as well as xwiki.cfg.
xwiki.cfg
#-# The name of the default space. This is displayed when the URL specifies a document, but not a space, or neither.
# xwiki.defaultweb=Main
#-# Hide the /Space/ part of the URL when the space is the default one. Warning: use 1 to hide, 0 to show.
# xwiki.usedefaultweb=0
  • Doesn't actually do anything unless you use xwiki.usedefaultweb, in which case it just does the wrong thing instead (sends you to Main.WebHome instead of the space you've picked). Searches tell you to use the Redirect macro instead.
  • It's remarkable how much of a pita it is to have XWiki use short URLs. Although at least it works.

Update: Semi-mea culpa: So you don't actually need to use start-stop-daemon to run Jetty as a non-privileged user... although they don't do actively push it in front of you the way other daemons do. Jetty has a SetUID module... although the documentation is incorrect on the changes you need to make to start.ini. You need to add this instead (in addition to the change to jetty-setuid.xml):

start.ini
--module=setuid
etc/jetty-setuid.xml