Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The missing docs.... Bootstrap a filebrowser container #3214

Open
thielj opened this issue May 9, 2024 · 0 comments
Open

The missing docs.... Bootstrap a filebrowser container #3214

thielj opened this issue May 9, 2024 · 0 comments

Comments

@thielj
Copy link

thielj commented May 9, 2024

Maybe this is helpful for people trying to spin up a pre-configured filebrowser container and find the various environment variables and other methods not working as documented or expected...

Pre-requisites

Create a folder for the configuration files and another for the database. Make sure the data folder is owned and writeable to the container user (1000:1000).

mkdir ./config
install -o 1000 -g 1000 -m 750 -d ./data

docker-compose.yml

Slightly stripped down version, you'll need to add your networks or export port 80 (it seems to ignore the :8080 in the config file). The important bit is overriding the entrypoint and using a command that loads initial data and users when the database doesn't exist yet. Note the quoted $$FB_DATABASE. It's not a typo.

services:
  filebrowser:
    image: filebrowser/filebrowser
    user: 1000:1000
    entrypoint: /bin/sh
    command: >
      -c '
            /filebrowser version;
            [ -r "$$FB_DATABASE" ] || (
              /filebrowser config import /config/filebrowser.json &&
              /filebrowser users  import /config/users.json 
            );
            /filebrowser config cat 2>/dev/null;
            /filebrowser users  ls  2>/dev/null;
            /filebrowser
          '
    environment:
      FB_DATABASE: /data/database.db
    volumes:
      - "./config:/config:ro"
      - "./data:/data:rw"
      - "/files" # anon, mount more (writeable) stuff below

./config/filebrowser.json

This will setup proxy auth ("authMethod": "proxy" and "header": "Remote-User") for use with e.g. Authelia instead of the default "json" method. You might want to revert this or adjust to your own environment and prefs.

Change options in this this file according to the docs.

{
    "settings": {
        "key": "<THIS IS YOUR PRIVATE KEY>",
        "signup": false,
        "createUserDir": true,
        "userHomeBasePath": "/files/users",
        "defaults": {
            "scope": ".",
            "locale": "en",
            "viewMode": "list",
            "singleClick": true,
            "sorting": {
                "by": "name",
                "asc": false
            },
            "perm": {
                "admin": false,
                "execute": false,
                "create": false,
                "rename": false,
                "modify": false,
                "delete": false,
                "share": false,
                "download": true
            },
            "commands": [],
            "hideDotfiles": true,
            "dateFormat": false
        },
        "authMethod": "proxy",
        "branding": {
            "name": "File Browsers, Inc",
            "disableExternal": true,
            "disableUsedPercentage": false,
            "files": "",
            "theme": "",
            "color": ""
        },
        "tus": {
            "chunkSize": 10485760,
            "retryCount": 5
        },
        "commands": {
            "after_copy": [],
            "after_delete": [],
            "after_rename": [],
            "after_save": [],
            "after_upload": [],
            "before_copy": [],
            "before_delete": [],
            "before_rename": [],
            "before_save": [],
            "before_upload": []
        },
        "shell": [],
        "rules": []
    },
    "server": {
        "root": "/files",
        "baseURL": "",
        "socket": "",
        "tlsKey": "",
        "tlsCert": "",
        "port": "8080",
        "address": "127.0.0.1",
        "log": "stdout",
        "enableThumbnails": false,
        "resizePreview": false,
        "enableExec": false,
        "typeDetectionByHeader": false,
        "authHook": "",
        "tokenExpirationTime": ""
    },
    "auther": {
        "header": "Remote-User"
    }
}

./config/users.json

You can add one or more users here, i.e. this is a JSON array. If you need to generate password hashes, simply use docker run --rm filebrowser/filebrowser hash '<YOUR-PASSWORD-HERE>'. Make sure you have at least one admin user.

Most options are explained here.

[
    {
        "id": 1,
        "username": "myadmin",
        "password": "$2a$10$........bcrypt_hashed_password.......",
        "scope": "/",
        "locale": "en",
        "lockPassword": false,
        "viewMode": "list",
        "singleClick": false,
        "perm": {
            "admin": true,
            "execute": true,
            "create": true,
            "rename": true,
            "modify": true,
            "delete": true,
            "share": true,
            "download": true
        },
        "commands": [],
        "sorting": {
            "by": "name",
            "asc": false
        },
        "rules": [],
        "hideDotfiles": false,
        "dateFormat": false
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant