Skip to content

Gollum as a service

jn64 edited this page Jun 18, 2023 · 19 revisions

Example service files are provided in contrib

systemd

See contrib/systemd for example

System service

To run Gollum as a system service:

  1. Create a gollum.service file.
  2. Add a ExecStart=... line. This line specifies the location of gollum executable and arguments to run it with. Use Gollum README or gollum --help to display the list of available arguments.
    Example:
    ExecStart=/usr/local/bin/gollum --show-all "/home/someuser/wiki/"
    
  3. Start the service: [sudo] systemctl start gollum.service

System service, run under a particular user

To run Gollum as a system service, but under a particular user (root by default):

  1. Add a User=%i line to gollum.service file and rename the file to gollum@.service.
  2. Change the line ExecStart=/usr/local/bin/gollum --show-all "/home/someuser/wiki/" to ExecStart=/usr/local/bin/gollum --show-all "/home/%i/wiki/".
  3. Start the service: [sudo] systemctl start gollum@<target-user>.service, where <target-user> is the user to run Gollum under.

User service

To run the service in a user session:

  1. Complete the first two steps of making a system service (see above).
  2. Create the mkdir -p ~/.config/systemd/user/ folder and move the gollum.service file there. Edit gollum.service as needed.
  3. Start the user service via [sudo] systemctl --user start gollum.

SysV

See contrib/sysv-debian for example

To install it:

  1. Copy contrib/sysv-debian/init.d/gollum to /etc/init.d/ on your system.
  2. Adapt the GOLLUM_* variables to your needs:
    • GOLLUM_USER sets the user the gollum process will be run as,
    • GOLLUM_BASE sets the path to the repository that contains the wiki contents, and
    • GOLLUM_OPTS allows you to set additional parameters passed to gollum on the commandline (see gollum --help for documentation on those).
  3. Make the script executable if it isn't already:
    chmod +x /etc/init.d/gollum
  4. Depending on your system, use service gollum start or /etc/init.d/gollum start to start Gollum. The script understands the parameters start, stop, restart, and status.

OpenRC

See contrib/openrc for example

FreeBSD

A script to run it on FreeBSD as daemon can be found in www/rubgem-gollum port