Getting Linkwarden docker storage right
from trilobite@lemmy.ml to selfhosted@lemmy.world on 11 Oct 15:58
https://lemmy.ml/post/37399174

I’m trying to install Linkwarden and I want to make sure I get the storage right so that if I have to move the data to another VM, it is easy to do. If I use the default compose file, will it simply create a ./data ./pgdata and ./meili_data folders in the same folder where the docker compose file is? Which of course is very handy as then I have the compose, the .env and the data all in one place. Is this a good way of managing docker volumes? The install docs here say that I can also set a STORAGE_FOLDER variable in the .env file which by default is /data. But does this mean that the default is in the root directory of the host?

#selfhosted

threaded - newest

rtxn@lemmy.world on 11 Oct 16:30 next collapse

I’ve never used Linkwarden, but the /data folder is often used by Docker containers to store the application’s data, so it’s likely an internal path. You’ll have to create a volume that exposes the internal /data path to the host filesystem, then whatever is written into that directory will be made available to both the container and the host system. Any file or directory in the container can be exposed this way.

I usually put my data volumes in /srv (where my large RAID array is mounted) and config volumes in /config, into a subdirectory named after the service, and with the minimal necessary privileges to run the container and the service. You could, for example, create volumes like this:

/srv/linkwarden/postgres_data:/var/lib/postgresql/data
/srv/linkwarden/linkwarden_data:/data/data
/srv/linkwarden/meili_data:/meili_data

The volume path (left side of the colon) can be anything. The right side is where the services expect their files to appear inside the container.

ArchAengelus@lemmy.dbzer0.com on 11 Oct 16:30 next collapse

Docker compose files (and docker execs) use the following format

  volumes:
    - <host_storage_path>:<vm_mount_path>

If the docker-compose has a ${VAR_NAME}:/data, then it will replace it directly with the variable defined in the .env file in the same directory with the format

VAR_NAME=/path/on/host

And would mount the host’s /path/on/host to /data

ki9@lemmy.gf4.pw on 14 Oct 12:12 collapse

Unrelated: I recommend vaultwarden, an open source community fork in rust. Works great with official bitwarden apps and extensions.