Skip to content

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

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

Merged
merged 1 commit into from
Mar 14, 2022
Merged

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

merged 1 commit into from
Mar 14, 2022

Conversation

rjmidau
Copy link
Contributor

@rjmidau rjmidau commented Oct 9, 2021

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

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:

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! Be sure to follow the pull request template!

@LinuxServer-CI
Copy link
Collaborator

@Sazzels
Copy link

Sazzels commented Nov 3, 2021

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
Copy link
Member

j0nnymoe commented Nov 3, 2021

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
Copy link
Member

j0nnymoe commented Nov 3, 2021

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

@Sazzels
Copy link

Sazzels commented Nov 3, 2021

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

@Sazzels
Copy link

Sazzels commented Nov 3, 2021

@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
Copy link
Member

j0nnymoe commented Nov 3, 2021

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

@Sazzels
Copy link

Sazzels commented Nov 3, 2021

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
Copy link
Member

j0nnymoe commented Nov 3, 2021

Post your docker-compose please

@Sazzels
Copy link

Sazzels commented Nov 3, 2021

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
Copy link

Sazzels commented Nov 3, 2021

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
Copy link

Sazzels commented Nov 3, 2021

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
Copy link

github-actions bot commented Dec 4, 2021

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
Copy link

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
Copy link

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
Copy link

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!

Copy link

@ffranchina ffranchina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are completely safe and useful to fully use the Bookstack application.

@thespad
Copy link
Member

thespad commented Mar 14, 2022

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
Copy link
Collaborator

Copy link
Member

@thespad thespad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thespad thespad merged commit 139c220 into linuxserver:master Mar 14, 2022
thespad added a commit that referenced this pull request Mar 14, 2022
@rjmidau rjmidau deleted the custom-themes-folder branch June 4, 2022 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to use custom template changes
8 participants