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

htdocs directory not populating with persistent volume #112

Open
rhasselbusch opened this issue Jan 7, 2024 · 23 comments
Open

htdocs directory not populating with persistent volume #112

rhasselbusch opened this issue Jan 7, 2024 · 23 comments
Labels
duplicate This issue or pull request already exists

Comments

@rhasselbusch
Copy link

Hi together,

when i deploy the sample docker-compose.yml LinkStack works just fine but when i switch to a persistent volume, the directorys got created but not populated with any data.

My docker-compose.yml looks like this:

`version: "3.8"

services:

linkstack:
hostname: 'linkstack'
image: 'linkstackorg/linkstack:latest'
environment:
TZ: 'Europe/Berlin'
SERVER_ADMIN: '[email protected]'
HTTPS_SERVER_NAME: 'links.anything.cloud'
LOG_LEVEL: 'info'
PHP_MEMORY_LIMIT: '256M'
UPLOAD_MAX_FILESIZE: '8M'
volumes:
- /docker-centralstore/linkstack/htdocs:/htdocs/
ports:
- '8190:443'
restart: unless-stopped

volumes:
linkstack:`

Anybody have any ideas whats wrong? The Containers Log doesn't show any errors.

best regards
Rolf

@helfrichmichael
Copy link

Same for me. I also tried copying the htdocs content while it was running into a mount and then making that mount the main mount, but now I just get persistent 500 errors (even with 100 user and 101 group permissions set for the folder).

If I try to hit the dashboard it can't find the URL it seems:

[Mon Jan 08 10:16:18.258392 2024] [core:info] [pid 36] [client 172.17.0.1:47206] AH00128: File does not exist: /htdocs/dashboard
[Mon Jan 08 10:16:18.258317 2024] [httpd.conf] 172.17.0.1 - - "GET /dashboard HTTP/1.1" 404 279 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" 3240 494
[Mon Jan 08 10:16:20.276640 2024] [core:info] [pid 48] [client 172.17.0.1:47254] AH00128: File does not exist: /htdocs/dashboard
[Mon Jan 08 10:16:20.276503 2024] [httpd.conf] 172.17.0.1 - - "GET /dashboard HTTP/1.1" 404 279 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" 3188 494

@JulianPrieber JulianPrieber added the duplicate This issue or pull request already exists label Jan 9, 2024
@listerthrawn
Copy link

I hit the same issue. Still not solved it either. You can use persistent volumes, you just need to use a docker volume rather than a filesystem one. This is sufficing for now, but doesn't match what I usually do.

services:
  linkstack:
    image: linkstackorg/linkstack:latest
    volumes:
      - mylinkstackvolume:/htdocs
      
<restofconfig>

volumes:
  mylinkstackvolume:

And that works just fine

@rhasselbusch
Copy link
Author

Thanks for the info, I'll test that as a development environment.

Unfortunately, I can't use it productively as my entire Docker setup is based on docker-compose.yml's that are located on Github and the data that is stored on a NAS that is backed up - I can start the restore on any system using a bash script.
If I now use Docker Volumes, I also have to back up the system itself or somehow rsync the local folder to the NAS or similar. - Unfortunately, that doesn't work.

Let's see if the error will be fixed in time.

@lastsamurai26
Copy link
Member

Same for me. I also tried copying the htdocs content while it was running into a mount and then making that mount the main mount, but now I just get persistent 500 errors (even with 100 user and 101 group permissions set for the folder).

If I try to hit the dashboard it can't find the URL it seems:

[Mon Jan 08 10:16:18.258392 2024] [core:info] [pid 36] [client 172.17.0.1:47206] AH00128: File does not exist: /htdocs/dashboard
[Mon Jan 08 10:16:18.258317 2024] [httpd.conf] 172.17.0.1 - - "GET /dashboard HTTP/1.1" 404 279 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" 3240 494
[Mon Jan 08 10:16:20.276640 2024] [core:info] [pid 48] [client 172.17.0.1:47254] AH00128: File does not exist: /htdocs/dashboard
[Mon Jan 08 10:16:20.276503 2024] [httpd.conf] 172.17.0.1 - - "GET /dashboard HTTP/1.1" 404 279 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" 3188 494

can you show us the permissions inside of the Container ?
i use my own folder für linkstack and i don't have problems

@nikurasutan
Copy link

Do your files have the correct permission, they should have the apache group and Name with the UID 100 and GID 101. Another error could be that the dotfiles are missing. This happend to me, becuase mv seems not to move dotfiles, if not mentioning them explicity.

@le-patenteux
Copy link

le-patenteux commented Mar 5, 2024

Hello, has anyone found a solution for that issue?
I prefer to have my files in a persistent filesystem storage instead of a docker volume.
Simpler to backup and manage

Thank you all for your amazing work!

(tried changing owners of the folder, even tried chmodding it to 777 as a test, and it did not work)

@le-patenteux
Copy link

As all things in life, I found the answer 2 minutes after my question!

Note that I am using SWAG (NGINX) as my web facing proxy... so some parts for your perticular setup might need modifications...

Turns-out calling the local path directly in the service definition is not working, but binding the volume to the filesystem works fine... This works for me!

version: "3.8"

services:
  linkstack:
    hostname: linkstack
    image: linkstackorg/linkstack:latest
    container_name: linkstack
    restart: unless-stopped
    environment:
      TZ: "America/Toronto"
      SERVER_ADMIN: "[email protected]"
      #LOG_LEVEL: 'info'
      PHP_MEMORY_LIMIT: "256M"
      UPLOAD_MAX_FILESIZE: "8M"
    ports:
      - "8099:80"
      - "8443:443"
    volumes:
      - "linkstack_persistent:/htdocs"
    networks:
      - swag-network

networks:
  swag-network:
    external: true

volumes:
  linkstack_persistent:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /your/path/linkstack

@nikurasutan
Copy link

nikurasutan commented Mar 6, 2024

@Normand-Nadon like I've written above you need to populate the latest release manually if you use a bind mount instead of a docker volume. The current docs don't mention it currently but I submitted a PR a month ago to add that
https://github.com/LinkStackOrg/docs/pull/9/files#diff-bbecedccd398b5bb74ad0dff5a5174b41988214dbff19d55713f8bd97bf926e6R84

@nikurasutan
Copy link

It's on the Docs-Website now btw.:
https://docs.linkstack.org/docker/setup/#docker-bind-mounts

@le-patenteux
Copy link

@Normand-Nadon like I've written above you need to populate the latest release manually if you use a bind mount instead of a docker volume. The current docs don't mention it currently but I submitted a PR a month ago to add that https://github.com/LinkStackOrg/docs/pull/9/files#diff-bbecedccd398b5bb74ad0dff5a5174b41988214dbff19d55713f8bd97bf926e6R84

Oh, the way I did it, I did not need to populate the folders.... I have no idea why though!

@topmask
Copy link

topmask commented Jun 14, 2024

Problem solving

@le-patenteux
Copy link

le-patenteux commented Jun 14, 2024

I'm also using nginx reverse proxy, but I have been unable to successfully reverse proxy. I don't know what the problem is. Do I need to install this swag-network?"

@topmask

Your question is completely off-topic with this issue...
Here is what I see though: it seems like you are complicating things for very little... I used the default templates provided by "swag" and "swag-network" is the docker network I created for all services to communicate with the swag service.

## Version 2023/06/27
# make sure that your dns has a cname set for linkstack and that your linkstack container is not using a base url

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name links.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app linkstack;
        set $upstream_port 443;
        set $upstream_proto https;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }
}

Also, in your compose, you need to set the container name if you want to call it by its name in the proxy...

container_name: linkstack

EDIT:

One last note, when using swag, don't edit the master nginx proxy.conf... you simply make a copy of the example file linkstack.subdomain.conf.sample in the proxy-confs folder and remove the .sample at the end of the file

@topmask
Copy link

topmask commented Jun 15, 2024

I'm also using nginx reverse proxy, but I have been unable to successfully reverse proxy. I don't know what the problem is. Do I need to install this swag-network?"

@topmask

Your question is completely off-topic with this issue... Here is what I see though: it seems like you are complicating things for very little... I used the default templates provided by "swag" and "swag-network" is the docker network I created for all services to communicate with the swag service.

## Version 2023/06/27
# make sure that your dns has a cname set for linkstack and that your linkstack container is not using a base url

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name links.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app linkstack;
        set $upstream_port 443;
        set $upstream_proto https;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }
}

Also, in your compose, you need to set the container name if you want to call it by its name in the proxy...

container_name: linkstack

EDIT:

One last note, when using swag, don't edit the master nginx proxy.conf... you simply make a copy of the example file linkstack.subdomain.conf.sample in the proxy-confs folder and remove the .sample at the end of the file

Thank you, I just want to use Nginx as a reverse proxy, but I haven't found a suitable method to handle it. I have tried all configurations but none of them work.

@pixelrazor
Copy link

What's the possibility of having the docker image either fetch or include everything? Is there an argument against either option?

@JulianPrieber
Copy link
Member

What's the possibility of having the docker image either fetch or include everything? Is there an argument against either option?

The docker image includes all files required to run LinkStack.
We recommend using a volume for persistent storage.

@pixelrazor
Copy link

What's the possibility of having the docker image either fetch or include everything? Is there an argument against either option?

The docker image includes all files required to run LinkStack.
We recommend using a volume for persistent storage.

Sorry, I didn't specify - in particular, I meant when using a bind mount

@michaeltieso
Copy link

I'm running into this issue as well on Unraid. I tried to run a second instance of Linkstack. The first instance was created some time ago and works fine. The second instance is having an issue generating the necessary files in /htdocs. Same settings as the one that works with the same folder permissions (except for ports). I had to download the files and put them in the folder to make this work.

@lastsamurai26
Copy link
Member

For custom mounts that are not based on volumes, you must place the files in this folder yourself because the Docker itself has no right to do so.

@trashken
Copy link

trashken commented Mar 9, 2025

I have copied the files manually into /htdocs but it still complains missing permissions.

[Sun Mar 09 13:35:35.925124 2025] [php:error] [pid 37] [client 127.0.0.1:42930] PHP Fatal error: Uncaught ErrorException: file_put_contents(/htdocs/storage/framework/views/ad546639aec97f004fa1afd1e049a146a4a7f17e.php): Failed to open stream: Permission denied in /htdocs/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:190

@lastsamurai26
Copy link
Member

did you used
chown -R 100:101 httpdocs/ ?

@developersteve
Copy link

Also having the same problem,

If anyone needs it this works to copy what you need into the mounted volume, im still getting the 500 error even after setting the permissions and chown.

docker run --rm \
  -v /var/www/linkstack:/target \
  linkstackorg/linkstack:latest \
  sh -c "cp -r /htdocs/* /target && chown -R 33:33 /target"

@developersteve
Copy link

Ok i fixed it!

I think its related to the .env file not existing in the mounted location, even after you do the docker run to copy the files i did above. Id have assumed that the env vars set either in the compose or the container would have populated that with the respective values, but it does not look like that happens.

Heres what id set in the manually created .env with to start:

APP_KEY=
APP_ENV=production
APP_DEBUG=false
APP_URL=https://domain.com

Then i had to trigger the following to generate the key

php82 /htdocs/artisan key:generate

However I was then getting some errors and it turns out it needed a database, so heres the compose im using with mariaDB:

services:
  linkstack:
    image: linkstackorg/linkstack:latest
    ports:
      - "8190:80"
    depends_on:
      - mariadb
    environment:
      TZ: 'Australia/Brisbane'
      SERVER_ADMIN: '[email protected]'
      HTTP_SERVER_NAME: 'URL'
      HTTPS_SERVER_NAME: 'URL'
      LOG_LEVEL: 'info'
      PHP_MEMORY_LIMIT: '256M'
      UPLOAD_MAX_FILESIZE: '8M'
      DB_HOST: mariadb
      DB_PORT: 3306
      DB_DATABASE: linkstack
      DB_USERNAME: linkstack
      DB_PASSWORD: password
    volumes:
      - '/var/www/linkstack:/htdocs'

  mariadb:
    image: mariadb:10.6
    restart: always
    environment:
      MYSQL_DATABASE: linkstack
      MYSQL_USER: linkstack
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: password
    volumes:
      - mariadb-data:/var/lib/mysql

A sidenote here is im using nginx to do a proxy pass and letting it handle the SSL.

Lastly, a database migrate:

docker exec -it linkstack-linkstack-1 php82 /htdocs/artisan migrate

... and its working! Hope that helps someone else.

@developersteve
Copy link

Updated note: youll also need a .htaccess in that htdocs location populated with the contents of the one from the main repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests