LinkStackOrg / linkstack-docker

A simple to set up docker variant of LinkStack. LinkStack is a highly customizable link sharing platform with an intuitive, easy to use user interface.
https://linkstack.org/docker
GNU Affero General Public License v3.0
355 stars 43 forks source link

htdocs is empty #17

Closed malves closed 1 year ago

malves commented 2 years ago

Hello there,

I am trying to deploy llc on my synology NAS. I have mounted the folder /htdocs to an external folder (/Docker/llc). When I run the container, the folder /Docker/llc is empty.

Do I have to do something to copy all llc files to my external target folder ?

Thank you !

JulianPrieber commented 2 years ago

Hey @malves,

When following the steps described in the README, the files should have been copied over, already.

The problem is I'm probably not the best one to help you troubleshoot this issue, I've just started out with docker and don't know all too much about it.

You might be able to find someone who can help on the DBtech or our community Discord:

https://discord.gg/M9J6hFq https://discord.littlelink-custom.com

STaRDoGG commented 2 years ago

I have mounted the folder /htdocs to an external folder (/Docker/llc). When I run the container, the folder /Docker/llc is empty.

Any time you mount something (file or folder) to an existing one within a container, the local file/folder overwrites the one within the container (technically the one within the container still exists as a different layer, but it's "invisible").

in other words. mounting an empty /Docker/llc to the /htdocs within the container, essentially "empties" the contents of the stuff in /htdocs. You can drop a test file in /Docker/llc and you'll see it show up in /htdocs.

Do I have to do something to copy all llc files to my external target folder ?

You have to copy out the stuff from the /htdocs folder within the container first, into your /Docker/llc and then when you mount it again, the htdocs folder will have a "clone" of what was in it.

I forget offhand, and am too lazy atm to look it up ;) but I think I recall the readme showing how to do a quick copy of the htdocs folder the first time you run it using a docker run command. If not, a quick docker cp will do it.

STaRDoGG commented 2 years ago

Btw, really, you don't need to copy the entire contents of the htdocs folder (and probably shouldn't). It's enough to just copy out and then mount any files or folders you will customize. These are the only things that I mount in mine:

      - '/opt/docker/configs/littlelink/config/.env:/htdocs/.env:rw'
      - '/opt/docker/configs/littlelink/config/advanced-config.php:/htdocs/config/advanced-config.php:rw'
      - '/opt/docker/configs/littlelink/config/img:/htdocs/img:rw'

the .env and advanced-config.php contain your config, and the imgfolder retains any image changes (avatar, etc.).

jan-di commented 2 years ago

Hi, stumbled over the same issue today and would like to add my 2 cents to the disccusion:

STaRDoGG commented 2 years ago
  • I saw in some similar images (where a whole folder should be volume, that also includes application data) that the necessary data is created on first run, if the entrypoint detects that the folder is empty. Maybe this would make sense here.

I agree, it is a very nice convenience when the container auto-populates necessary files in mounts. A lot of container authors will add a small bash script to check on startup whether they exist and if not, copy them over. There are source code examples out there; in fact I just saw one recently, but forget where I saw it, and didn't bookmark.

  • @STaRDoGG Does your list include also everything the user configures via UI? Or should I use the list from the Readme for full persistence?

As far as I can tell from my own usage so far, the files that I mentioned are the only ones that get changed via the UI, but @JulianPrieber is the expert to ask on that one (it's his project =).

  • In the Readme file it is recommended to mount the whole /htdocs folder, but the docker compose example does mount single files.

That would work fine; I personally like to only mount files that change (my own customizations/settings), since there's no other need generally to store a bunch of files that either never change, or I have no control over. I prefer to leave those in the container. It also lessens a bit of potential confusion when looking through files for something, and obviously hard drive clutter, and space, especially when using a smaller SSD. It also makes a bit more sense for container portability to leave as much inside the container as possible.

beefstew809 commented 2 years ago
* I saw in some similar images (where a whole folder should be volume, that also includes application data) that the necessary data is created on first run, if the entrypoint detects that the folder is empty. Maybe this would make sense here.

Definitely would love to see this added to this project. Just another nice quality of life improvement for the project. Unfortunately I am not docker literate enough to help out with this.

STaRDoGG commented 1 year ago

I agree, it is a very nice convenience when the container auto-populates necessary files in mounts. A lot of container authors will add a small bash script to check on startup whether they exist and if not, copy them over.

Have a look at this function:

https://github.com/kerberos-io/kerberos-docker/blob/a48f59446fd3b77f193b9c0bac76208dd6c8f6aa/run.sh#L14

JulianPrieber commented 1 year ago

I will count this one as solved and convert it into a discussion.