Skip to content

Latest commit

 

History

History
155 lines (122 loc) · 4.96 KB

INSTALL.md

File metadata and controls

155 lines (122 loc) · 4.96 KB

Installation

From Docker images

Official Docker images are available, please see detailed instructions at https://hub.docker.com/r/epoupon/fileshelter.

From Debian packages

Bookworm packages are provided for amd64 architectures. As root, trust the following debian package provider and add it in your list of repositories:

wget https://debian.poupon.dev/apt/debian/epoupon.gpg -P /usr/share/keyrings
echo "deb [signed-by=/usr/share/keyrings/epoupon.gpg] https://debian.poupon.dev/apt/debian bookworm main" > /etc/apt/sources.list.d/epoupon.list

To install or upgrade Fileshelter:

apt update
apt install fileshelter

The fileshelter service is started just after the package installation, run by a dedicated fileshelter system user.
Please refer to Deployment for further configuration options.

From source

Note: this installation process and the default values of the configuration files have been written for Debian Bookworm. Therefore, you may have to adapt commands and/or paths in order to fit to your distribution.

Debian/Ubuntu dependencies

Note: a C++17 compiler is needed to compile Fileshelter

apt-get install build-essential cmake libboost-dev libconfig++-dev libarchive-dev

You also need Wt4, that is not packaged on Debian. See installation instructions.

Build

git clone https://github.com/epoupon/fileshelter.git fileshelter
cd fileshelter
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release

cmake will complain if a mandatory library is missing.

Note: you can customize the installation directory using -DCMAKE_INSTALL_PREFIX=path (defaults to /usr/local).

make

Note: you can use make -jN to speed up compilation time (N is the number of compilation workers to spawn).

Installation

Note: the commands of this section require root privileges.

make install

Create a dedicated system user:

useradd --system --group fileshelter

Copy the configuration files:

cp /usr/share/fileshelter/fileshelter.conf /etc/fileshelter.conf
cp /usr/share/fileshelter/fileshelter.service /lib/systemd/system/fileshelter.service

Create the working directory and give it access to the fileshelter user:

mkdir /var/fileshelter
chown -R fileshelter:fileshelter /var/fileshelter
chmod -R 770 /var/fileshelter

To make Fileshelter run automatically during startup:

systemctl enable fileshelter

Upgrade

To upgrade FileShelter from source, you need to update the master branch and rebuild/install it:

cd build
git pull
make

Then using root privileges:

make install
systemctl restart fileshelter

Deployment

Configuration

Fileshelter uses a configuration file, installed by default in /etc/fileshelter.conf. It is recommended to edit this file and change relevant settings (listen address, listen port, working directory, ...).

A basic Terms of Service is provided. The configuration file contains the definition of the fields needed by the default ToS. You may also specify an alternate ToS file to fit your needs.

If a setting is not present in the configuration file, a hardcoded default value is used (the same as in the default.conf file)

Reverse proxy settings

Fileshelter is shipped with an embedded web server, but it is recommended to deploy behind a reverse proxy. You have to set the behind-reverse-proxy option to true in the fileshelter.conf configuration file and to adjust the trusted proxy list in trusted-proxies.

Note: when running in a docker environment, you have to trust the docker gateway IP (which is 172.17.0.1 by default)

Here is an example to make Fileshelter properly work on myserver.org using nginx:

server {
    listen 80;

    server_name myserver.org;

    access_log            /var/log/nginx/myserver.access.log;

    proxy_request_buffering off;
    proxy_buffering off;
    proxy_buffer_size 4k;
    client_max_body_size 100M; # Make the number the same as 'max-share-size' in fileshelter.conf

    location / {

      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;

      proxy_pass          http://localhost:5091;
      proxy_read_timeout  120;
    }
}

Run

systemctl start fileshelter

Logs can be accessed using journalctl:

journalctl -u fileshelter.service

To connect to Fileshelter, just open your favorite browser and go to http://localhost:5091