User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
services:filebrowser [2024/03/22 08:48] willyservices:filebrowser [2025/01/21 11:50] (current) – [Running] willy
Line 5: Line 5:
 ==== Installation ==== ==== Installation ====
  
-Create a standard user to host the FileBrowser installation. You will most probably /never// run it as this user, but always as different users, to allow it manage files owned by those users.+Create a standard user to host the FileBrowser installation. You will most probably //never// run it as this user, but always as different users, to allow it manage files owned by those users.
  
 <code bash> <code bash>
Line 20: Line 20:
  
 That's it!  That's it! 
 +
 +In addition you might want to create the following **.bashrc**:
 +<file - .bashrc>
 +#!/bin/bash
 +
 +export UMASK=0002
 +export PATH=$PATH:~/bin
 +</file>
 +
 +==== Authentication ====
 +
 +<code bash>
 +filebrowser config set --auth.method=noauth
 +filebrowser config set --auth.method=proxy --auth.header=X-My-Header
 +</code>
 +
 +TBD
  
 ==== Reverse Proxy ==== ==== Reverse Proxy ====
Line 43: Line 60:
 </file> </file>
  
-Remember to set the correct port as each instance of FileBrowser will have to run with it's own port, and set a reasonable location URL. This setup will also make use of FileBrowser user intergation with Proxy Authentication, if used.+Remember to set the correct port as each instance of FileBrowser will have to run with it's own port, and set a reasonable location URL. This setup will also make use of FileBrowser user intergation with Proxy Authentication, if used, by uncommenting the last line.
  
 ==== Running ==== ==== Running ====
Line 57: Line 74:
 </code> </code>
  
-The start script should be something like+As the starting script, since i use OpenRC, i have written the following init script wihch needs to be dropped to **/etc/init.d/filebrowser**
-<file filebrowser.sh+<file filebrowser> 
-#!/bin/bash +#!/sbin/openrc-run 
-FILEBROWSER="/data/daemons/filebrowser/bin/filebrowser" +# Copyright 2024 Willy Garidol 
-APP_PATH="/home/myuser+# Distributed under the terms of the GNU General Public License v3 
-DATA_PATH="/data/MyFiles+ 
-BASE_URL="/files/myuser+depend() { 
-PORT=3005 +        need localmount net 
-"${FILEBROWSER}" config set --auth.method=noauth -d "${APP_PATH}/filebrowser.db" 2>&1 >> "${APP_PATH}/filebrowser.log" +
-"${FILEBROWSER}" -r "${DATA_PATH}" -${PORT-b "${BASE_URL}" -"${APP_PATH}/filebrowser.db-l "${APP_PATH}/filebrowser.log2>&1 >> "${APP_PATH}/filebrowser.log"+ 
 +FB_LOG_PATH="/var/log/filebrowser" 
 +FB_SLOT="${SVCNAME#filebrowser.}
 +FB_USER=${USER:-${FB_SLOT}} 
 +FB_GROUP=${GROUP:-${FB_SLOT}} 
 + 
 +description=${DESCRIPTION:-Web based Filebrowser} 
 +pidfile="/run/${RC_SVCNAME}.pid
 +command_background=true 
 +command="/data/daemons/filebrowser/bin/filebrowser
 +command_args="-r \"${FOLDER}\" -p ${PORT} -b \"${BASE_URL}\" -d \"${DATABASE}\-l ${FB_LOG_PATH}/${FB_SLOT}/filebrowser.log" 
 +command_user="${FB_USER}:${FB_GROUP}" 
 + 
 +start_pre() { 
 +        if [ "${FB_SLOT}" != "filebrowser"
 +        then 
 +                test -e "${FB_LOG_PATH}" || mkdir "${FB_LOG_PATH}" 
 +                test -"${FB_LOG_PATH}/${FB_SLOT}|| { 
 +                        mkdir "${FB_LOG_PATH}/${FB_SLOT}" 
 +                } && chown -R ${FB_USER} "${FB_LOG_PATH}/${FB_SLOT}" 
 +        else     
 +                ebegin "Error: do not run this script, run a link to it!" 
 +                eend 255 
 +        fi 
 +}
 </file> </file>
  
-And the startup script should be **/etc/local.d/40-filebrowser.start**: +make it executable! 
-<file - 40-filebrowser.start>+ 
 +Now, create a file **/etc/conf.d/filebrowser.myshare**: 
 +<file filebrowser.myshare> 
 +BASE_URL="/files/MyFiles" 
 +DATABASE="/homr/myuser/filebrowser.db" 
 +DESCRIPTION="Common web archive" 
 +FOLDER="/data/MyFiles" 
 +GROUP="users" 
 +PORT=3005 
 +USER="filebrowser"
 </file> </file>
-make both executable of course.+ 
 +And create the symlink, start it and add to autostart: 
 +<code bash> 
 +ln -s /etc/init.d/filebrowser  /etc/init.d/filebrowser.myshare 
 +rc-update add filebrowser.myshare default 
 +/etc/init.d/filebrowser.myshare start 
 +</code> 
 + 
 +To add more shares, just create new links to the //filebrowser// init script and create the associated config file. 
 + 
 + 
 +==== Updates ==== 
 + 
 +Download a new binary release (see link above), replace binary and restart service.