filebrowser/docs

Document how to run at startup / restart

eine opened this issue · 7 comments

eine commented

Close filebrowser/filebrowser#411, filebrowser/filebrowser#418 and filebrowser/filebrowser#453.

In the issues referred above, and in the references in them, multiple alternatives are given:

It'd be interesting to have a short section in the web page (or maybe some hints spread in existing ones) to summarize the suggested alternatives. I think that the most relevant for this use case are systemd, screen/tmux and docker.

@yurividal, @xcvista would you like to contribute?

For my contribution, it would be easier to ship the systemd unit file with the program, and add instructions on how to install the unit file, configuration files and how to use them.

eine commented

The possible problem if it is shipped with the program is that each user can extract/install it in a different path, use a different user/group, and/or put config file(s) in different paths. Therefore, it is difficult to provide a solution that fits all the use cases without requiring manual intervention.

That's why I think that it is desirable to add the content in filebrowser/filebrowser#411 to the web page (probably in Installation -> systemd), and provide some additional references for users to tailor it to their needs.

Alternatively, a default setup can be added to the one-step script (get.sh) that interactively asks the user about the params. However, this implementation requires some more work.

The file in filebrowser/filebrowser#411 is concrete. It is supposed to be copied to the systemd unit directory (e.g. /lib/systemd/system) as-is using the file name filebrowser@.service. This is why I am suggesting shipping this file with the code.

eine commented

These three params in that file are concrete, but not portable:

User=www-data
Group=www-data
ExecStart=/usr/local/sbin/filebrowser -c /etc/filebrowser/%I

More precisely, the default install path with the one-step script is /usr/local/bin, not /usr/local/sbin. Also, user/group www-data are not ensured to exists in the system. They do exist in Ubuntu-based distros with apache, but not in many other distros.

Nevertheless, copying the file to /lib/systemd/system is ok. I also like the suggestion about putting the configuration(s) in /etc/filebrowser.

The www-data user and group are from the default Debian installation of multiple Web servers - Apache, nginx, etc. The file I used is intended for Debian and Ubuntu.

This file can be generated in the installation step by filling in the actual installation location and guessed Web server user and group using this template. The /lib/systemd/system location is default for systemd. The /etc/filebrowser path is my own creation but since you like it...

I also suggest to change to:

ExecStart=/usr/local/bin/filebrowser -c /etc/filebrowser/%I -d /etc/filebrowser/%I.db

This way you don't need to specify database on your default.json or default.yaml

  1. any init file unit must not be included with filebrowser, cos must keep simple
  2. any init file unit must be documented i will provide sysvinit and openrc for devuan/alpine only
  3. after that is complete this issue must be closed, due the reason 1. and the reason 2.