Skip to content

Davis on Proxmox TrueNAS Scale SMB SQLite Docker-compose #164

Description

@tikr7

I switched to a Proxmox and TrueNAS Scale setup (as time of writing TrueNAS Charts got depricated) and was looking for a solution to manage WebDAV via GUI. Davis is really great for that because it separates users very well. Other WebDAV servers require one instance per user which is really in annoying.
In the past I used Nextcloud for it, but it is slow and updates were a huge pain. One day my Nextcloud instance got corrupted (the PostgreSQL to be more specific).

However, it took me some time to get it fully up and running, and therefore I want to write it down. Perhaps it helps somebody else in the future.

Some decisions I took:

  • I want TrueNAS for all data, since backup is very comfortable via ZFS and GUI. So I created a dataset, user, group and made SMB available.
  • I want to use docker-compose on Proxmox. Unfortunately, in order to bind a SMB, it needs to be a VM and not LXC on Proxmox.
  • I want a very lightweight database - so SQLite. It is easier to backup.

Mount SMB:

sudo apt-get install cifs-utils 

sudo mkdir /davis

vi /home/davis/.smbcredentials
username=davis
password=davispassword
chmod 600 /home/davis/.smbcredentials

#,nobrl ==> for fixing sqllite "database is locked"
sudo vi /etc/fstab
//192.168.XXX.XXX/Davis /davis cifs uid=82,gid=82,credentials=/home/davis/.smbcredentials,nobrl 0 0

sudo reboot now

I use the following folder structure:

sudo mkdir -p /davis/davis/data
sudo mkdir -p /davis/webdav/tmp
sudo mkdir -p /davis/webdav/public
sudo mkdir -p /davis/webdav/homes

Checkout repo:

git clone https://github.com/tchapi/davis.git
cd davis
git checkout -b v4.4.4 v4.4.4 # Use latest version

cd /home/davis/davis/docker

Fix Webdav Nginx: 413 Request Enity Too Large

vi configurations/davis.conf
server {
        client_max_body_size 100M;
...

Fix missing permissions on /var/www/davis:

vi Dockerfile
...
RUN chown -R ${FPM_USER} /var/www/davis

USER $FPM_USER
...

A bunch of configs:

vi .env
ADMIN_PASSWORD=<...>

#WEBDAV_ENABLED=false
WEBDAV_ENABLED=true

#WEBDAV_TMP_DIR='/tmp'
#WEBDAV_PUBLIC_DIR='/webdav'
WEBDAV_TMP_DIR='/webdav/tmp'
WEBDAV_PUBLIC_DIR='/webdav/public'
WEBDAV_HOMES_DIR='/webdav/homes'

Adjusting the docker-compose file:

vi docker-compose-sqlite.yml
    restart: always # VM restart safe
...
    restart: always # VM restart safe
...
    volumes:
      - davis_www:/var/www/davis
#      - davis_data:/data
      - /davis/davis/data:/data
      - /davis/webdav/tmp:/webdav/tmp
      - /davis/webdav/public:/webdav/public
      - /davis/webdav/homes:/webdav/homes
volumes:
  davis_www:
    name: davis_www
#  davis_data:
#    name: davis_data

Let's start it =)

cd /home/davis/davis/docker
sudo docker compose -f docker-compose-sqlite.yml up -d 

#⚠ Do not forget to run all the database migrations the first time you run the container :
sudo docker exec -it davis sh -c "APP_ENV=prod bin/console doctrine:migrations:migrate --no-interaction"

Activity

  1. tikr7 commented on Jul 27, 2024

    @tikr7
    Author

    @tchapi maybe you want to fix something upstream but not needed.

    Feel free to close this here!

  2. tchapi commented on Jul 27, 2024

    @tchapi
    Owner

    Thanks for the clear write up. I think 44eae84 is the solution to the ../.env problem (the env var was not bubbled up the container via the example compose file)

    Can you confirm by any chance?

  3. self-assigned this
    on Aug 3, 2024
  4. tchapi commented on Aug 3, 2024

    @tchapi
    Owner

    Hello @tikr7 👋🏼
    Have you had a change to test the commit in my message above? Thanks!

  5. tikr7 commented on Aug 5, 2024

    @tikr7
    Author

    Still have it on my todo list. I was 1 week off.
    I hope I can do it today in the evening =)

  6. tchapi commented on Aug 5, 2024

    @tchapi
    Owner

    I hope I can do it today in the evening =)

    No pressure at all, just wanted to make sure we can converge on a solution :) I'll be less active in the coming two weeks in any case

  7. tikr7 commented on Aug 6, 2024

    @tikr7
    Author

    Cool. I tested it and I can confirm WEBDAV_HOMES_DIR works now in .env !
    I updated my manual above.

    Another thing I found out during my testing: Just if I use docker-compose-sqlite.yml with the default - davis_data:/data (my manual uses SMB mount there) then after:

    #⚠ Do not forget to run all the database migrations the first time you run the container :
    sudo docker exec -it davis sh -c "APP_ENV=prod bin/console doctrine:migrations:migrate --no-interaction"
    

    It creates the /data/davis-database.db as root.
    The following needs to be done then:

    sudo docker exec -it davis sh -c "chown www-data: /data /data/davis-database.db" # Yes, possible also with -R
    

    Hard to debug because the Davis homepage only gives a non-meaningful error when trying to create a user.

  8. tchapi commented on Aug 6, 2024

    @tchapi
    Owner

    It creates the /data/davis-database.db as root.

    As yes, it's expected. I'll add a warning in the README, thanks!

    EDIT: it's already in there in the fullstack section (the warning block): https://github.com/tchapi/davis?tab=readme-ov-file#full-stack

  9. tikr7 commented on Aug 7, 2024

    @tikr7
    Author

    True, I missed that.
    Thank you so much for your support, @tchapi !

  10. tchapi commented on Aug 17, 2024

    @tchapi
    Owner

    (Closing this issue for housekeeping but I'll probably add a section with "how-to's" in the readme soon)

    → https://github.com/tchapi/davis?tab=readme-ov-file#-how-tos

  11. NikeLaosClericus commented on Nov 28, 2025

    @NikeLaosClericus

    Fix missing permissions on /var/www/davis:

    vi Dockerfile
    ...
    RUN chown -R ${FPM_USER} /var/www/davis
    
    USER $FPM_USER
    ...
    

    THANK YOU, this fixed my docker-compose deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions