linuxserver / docker-bookstack

A Docker container for the BookStack documentation wiki
GNU General Public License v3.0
797 stars 109 forks source link

Create themes folder in config folder and symlink to it #111

Closed rjmidau closed 2 years ago

rjmidau commented 3 years ago

linuxserver.io



Description:

Following #106 it is no longer possible to mount a custom themes folder into the container - doing so causes the container to fail to load. This PR extends the existing config symlink mechanism to link /var/www/html/themes to /config/www/themes, enabling custom themes to be used again

Benefits of this PR and context:

Closes #108

How Has This Been Tested?

Tested locally with existing install

Source / References:

LinuxServer-CI commented 3 years ago

I am a bot, here are the test results for this PR: https://ci-tests.linuxserver.io/lspipepr/bookstack/v21.08.5-pkg-83d95818-pr-111/index.html https://ci-tests.linuxserver.io/lspipepr/bookstack/v21.08.5-pkg-83d95818-pr-111/shellcheck-result.xml

Sazzels commented 2 years ago

This still persists and results in a blocking error when updating to the latest version. Will this be resolved or should i consider removing my custom theme?

j0nnymoe commented 2 years ago

If you could test the docker this image: lspipepr/bookstack:v21.08.5-pkg-83d95818-pr-111 and let us know if it works, that would help get this over the line. Though you'll need to backup your custom image first before applying this update.

j0nnymoe commented 2 years ago

@rjmidau Please could you update the changelog in the readme-vars.yml to reflect the changes? Thanks

Sazzels commented 2 years ago

@j0nnymoe absolutely! i will use the provided image and feedback this afternoon.

Sazzels commented 2 years ago

@j0nnymoe unfortunately this did not work. I have updated to the default image and still get "File not found.

Pulling bookstack (lspipepr/bookstack:v21.08.5-pkg-83d95818-pr-111)...

image

bookstack       | -------------------------------------
bookstack       |           _         ()
bookstack       |          | |  ___   _    __
bookstack       |          | | / __| | |  /  \ 
bookstack       |          | | \__ \ | | | () |
bookstack       |          |_| |___/ |_|  \__/
bookstack       | 
bookstack       | 
bookstack       | Brought to you by linuxserver.io
bookstack       | -------------------------------------
bookstack       | 
bookstack       | To support LSIO projects visit:
bookstack       | https://www.linuxserver.io/donate/
bookstack       | -------------------------------------
bookstack       | GID/UID
bookstack       | -------------------------------------
bookstack       | 
bookstack       | User uid:    911
bookstack       | User gid:    911
bookstack       | -------------------------------------
bookstack       | 
bookstack       | [cont-init.d] 10-adduser: exited 0.
bookstack       | [cont-init.d] 20-config: executing... 
bookstack       | [cont-init.d] 20-config: exited 0.
bookstack       | [cont-init.d] 30-keygen: executing... 
bookstack       | using keys found in /config/keys
bookstack       | [cont-init.d] 30-keygen: exited 0.
bookstack       | [cont-init.d] 50-config: executing... 
bookstack       | New container detected. Setting up app folder and fixing permissions.
bookstack       | rm: cannot remove '/var/www/html/themes/XXX/lang/de': Resource busy
bookstack       | rm: cannot remove '/var/www/html/themes/XXX/lang/de_informal': Resource busy
bookstack       | ln: failed to create symbolic link '/var/www/html/storage/uploads/files': No such file or directory
bookstack       | ln: failed to create symbolic link '/var/www/html/storage/uploads/images': No such file or directory
bookstack       | ln: failed to create symbolic link '/var/www/html/public/uploads': No such file or directory
bookstack       | ln: failed to create symbolic link '/var/www/html/storage/logs/laravel.log': No such file or directory
bookstack       | App Key found - setting variable for seds
bookstack       | Running config - db_user set
bookstack       | /var/run/s6/etc/cont-init.d/50-config: line 98: warning: command substitution: ignored null byte in input
bookstack       | /var/run/s6/etc/cont-init.d/50-config: line 98: warning: command substitution: ignored null byte in input
bookstack       | Could not open input file: /var/www/html/artisan
bookstack       | [cont-init.d] 50-config: exited 0.
bookstack       | [cont-init.d] 90-custom-folders: executing... 
bookstack       | [cont-init.d] 90-custom-folders: exited 0.
bookstack       | [cont-init.d] 99-custom-files: executing... 
bookstack       | [custom-init] no custom files found exiting...
bookstack       | [cont-init.d] 99-custom-files: exited 0.
bookstack       | [cont-init.d] done.
bookstack       | [services.d] starting services
bookstack       | [services.d] done.
Resource busy

I have not stopped/deleted the container before performing this update

j0nnymoe commented 2 years ago

You're running the container with incorrect permissions it seems as our test doesn't show that error.

Sazzels commented 2 years ago

created test env all set to root:root, started container as root, same error.

Edit: nevermind, "Resource busy" is gone, but "File not found" persists.

j0nnymoe commented 2 years ago

Post your docker-compose please

Sazzels commented 2 years ago

docker-compose.yml

version: '3'
services:
  bookstack:
    image: 'lspipepr/bookstack:v21.08.5-pkg-83d95818-pr-111'
    container_name: bookstack
    hostname: DOMAIN
    restart: unless-stopped
    depends_on:
      - bookstack_db
    environment:
      # APP URL
      - APP_URL=https://DOMAIN
      # Theme
      - APP_THEME='NAME'
      # DATABASE
      - DB_HOST=bookstack_db
      - DB_USER=bookstack
      - DB_PASS={{BOOKSTACK_MYSQL_PASSWORD}}
      - DB_DATABASE=bookstack_db
      # SMTP
      - MAIL_HOST=DOMAIN
      - MAIL_PORT=587
      - MAIL_ENCRYPTION=tls
      - MAIL_USERNAME=MAIL_USERNAME
      - MAIL_PASSWORD={{SMTP_PASSWORD}}
      - MAIL_FROM=MAIL_FROM
      - MAIL_FROM_NAME=MAIL_FROM_NAME
    volumes:
      - '/home/bookstack/data:/config'
      - '/home/bookstack/themes-data/de:/var/www/html/themes/NAME/lang/de'
      - '/home/bookstack/themes-data/de_informal:/var/www/html/themes/NAME/lang/de_informal'
    ports:
      - '127.0.0.1:PORT:80'
  bookstack_db:
    image: 'linuxserver/mariadb:10.5.12'
    container_name: mariadb_bookstack
    hostname: DOMAIN
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD={{BOOKSTACK_MYSQL_ROOT_PASSWORD}}
      - TZ=Europe/Berlin
      - MYSQL_DATABASE=bookstack_db
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD={{BOOKSTACK_MYSQL_PASSWORD}}
    volumes:
      - '/home/bookstack/mariadb:/config'
      - '/home/bookstack/mariadb-dumps:/var/lib/mysql-dumps'

directory

drwxr-xr-x 9  911  911  4096 Jun 17 23:20 data
-rw-r--r-- 1 root root  1503 Nov  3 20:49 docker-compose.yml
drwx------ 2 root root 16384 Aug  3  2020 lost+found
drwxr-xr-x 6  911  911  4096 Jun 25 09:05 mariadb
drwxr-xr-x 2 root root  4096 Aug  5  2020 mariadb-dumps
drwxr-xr-x 4 root root  4096 Aug  3  2020 themes-data
Sazzels commented 2 years ago

Ouh...wait, he did remove all content, but could not remove the folders.

root@host:/home/bookstack# ls -laR themes-data/
themes-data/:
total 16
drwxrwxrwx 4 root root 4096 Aug  3  2020 .
drwxr-xr-x 7 root root 4096 Nov  3 20:49 ..
drwxrwxrwx 2 root root 4096 Nov  3 20:07 de
drwxrwxrwx 2 root root 4096 Nov  3 20:07 de_informal

themes-data/de:
total 8
drwxrwxrwx 2 root root 4096 Nov  3 20:07 .
drwxrwxrwx 4 root root 4096 Aug  3  2020 ..

themes-data/de_informal:
total 8
drwxrwxrwx 2 root root 4096 Nov  3 20:07 .
drwxrwxrwx 4 root root 4096 Aug  3  2020 ..

but i need the themes data in that folders, if it clears them after each update that would be bad.

Edit: Just checked in the Backup, normaly the customized theme data is there, now its empty. So maybe, file not found is not that wrong :/

image

Sazzels commented 2 years ago

Ok, so basically the contents of my mounted volume are wiped every time i restart the container.

before

root@host:/home/bookstack# ll themes-data/de
total 80
-rwxr--r-- 1 root root  2408 Nov  3 21:27 activities.php
-rwxr--r-- 1 root root  4754 Nov  3 21:27 auth.php
-rwxr--r-- 1 root root  2404 Nov  3 21:27 common.php
-rwxr--r-- 1 root root  1406 Nov  3 21:27 components.php
-rwxr--r-- 1 root root 17997 Nov  3 21:27 entities.php
-rwxr--r-- 1 root root  7988 Nov  3 21:27 errors.php
-rwxr--r-- 1 root root   241 Nov  3 21:27 pagination.php
-rwxr--r-- 1 root root   681 Nov  3 21:27 passwords.php
-rwxr--r-- 1 root root 15747 Nov  3 21:27 settings.php
-rwxr--r-- 1 root root  6720 Nov  3 21:27 validation.php

after

root@host:/home/bookstack# ll themes-data/de
total 0

sure "File not found!" makes totally sence then...

github-actions[bot] commented 2 years ago

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

DarthDestroyer commented 2 years ago

I made these changes per hand and not via docker image - it shouldnt break anything!

The Links are created and you can access the themes folder via host!

But it does not get the theme i had declared in env... No idea why, but this PR should be accepted!

ffranchina commented 2 years ago

Hello, I wanted exactly to open this very simple and much needed PR. Is there any news on when it will be merged? Without this PR there's no way of making use of the Visual Theme System integrated in BookStack. Thanks in advance!

ffranchina commented 2 years ago

Hi @aptalca, @alex-phillips, @TheSpad, @homerr. Sorry for bothering you but no answer is coming otherwise. Do you have any idea on why this PR is staled? Is there anything we can do for having it merged? Thanks in advance for your patience!

thespad commented 2 years ago

I've just triggered a rebuild of the PR image so I can test it against an up to date install and make sure it works as expected. Barring any disasters I don't see an issue with merging it.

LinuxServer-CI commented 2 years ago

I am a bot, here are the test results for this PR: https://ci-tests.linuxserver.io/lspipepr/bookstack/v22.02.3-pkg-83d95818-pr-111/index.html https://ci-tests.linuxserver.io/lspipepr/bookstack/v22.02.3-pkg-83d95818-pr-111/shellcheck-result.xml