Stirling-Tools / Stirling-PDF

#1 Locally hosted web application that allows you to perform various operations on PDF files
https://stirlingpdf.com
MIT License
44.09k stars 3.6k forks source link

BUG: `DOCKER_ENABLE_SECURITY=true` will cause the service to fail to start #1040

Closed Czj1997-02 closed 6 months ago

Czj1997-02 commented 6 months ago

I use the following configuration for installation,Found that the ./configs is not mapped outside the container and the service cannot access it

version: '3.3'
services:
  stirling-pdf:
    image: frooodle/s-pdf:latest
    container_name: pdf
    restart: always
    ports:
      - '9998:8080'
    volumes:
      - /opt/pdf/trainingData:/usr/share/tessdata #Required for extra OCR languages
      - /opt/pdf/extraConfigs:/configs
      - /opt/pdf/customFiles:/customFiles/
      - /opt/pdf/logs:/logs/
    environment:
      - DOCKER_ENABLE_SECURITY=true
      - INSTALL_BOOK_AND_ADVANCED_HTML_OPS=true
      - SYSTEM_DEFAULTLOCALE=zh_CN
      - SECURITY_ENABLE_LOGIN=true
      - SECURITY_INITIALLOGIN_USERNAME=username
      - SECURITY_INITIALLOGIN_PASSWORD=password
xavier-GitHub76 commented 6 months ago

Hello, the documentation (https://hub.docker.com/r/frooodle/s-pdf or https://github.com/Stirling-Tools/Stirling-PDF) has a mistake for the SECURITY_ENABLE_LOGIN parameter. The good name is SECURITY_ENABLELOGIN Best regards

Czj1997-02 commented 6 months ago

@xavier-GitHub76 Thank for your advice,but in Readme.md is that:

User must have the folder ./configs volumed within docker so that it is retained during updates.
Docker uses must download the security jar version by setting DOCKER_ENABLE_SECURITY to true in environment variables.
Then either enable login via the settings.yml file or via setting SECURITY_ENABLE_LOGIN to true
Now the initial user will be generated with username admin and password stirling. On login you will be forced to change the password to a new one. You can also use the environment variables SECURITY_INITIALLOGIN_USERNAME and SECURITY_INITIALLOGIN_PASSWORD to set your own straight away (Recommended to remove them after user creation).

and I try your advice was error too. I think the problem is in DOCKER_ENABLE_SECURITY=true ,There is an issue with the corresponding pulled image resources.

xavier-GitHub76 commented 6 months ago

I install Stirling this morning (with SECURITY_ENABLE_LOGIN). Having mistake during authentification, I search a similar installation : https://www.youtube.com/watch?v=ZQKRAeM9kDM&t=533s

We could see the SECURITY_ENABLELOGIN parameter : image

I change SECURITY_ENABLE_LOGIN in SECURITY_ENABLELOGIN and I succedd to login.

My docker-compose :

with version: '3.8'

services:

L'application

stirling-pdf: image: frooodle/s-pdf:latest container_name: stirling-pdf deploy: restart_policy: condition: on-failure delay: 5s # Délai d'attente avant une nouvelle tentative max_attempts: 3 # Nombre maximal de redémarrages window: 30s # Durée après laquelle un démarrage est considéré OK si aucune erreur n'est survenue ports:

The result : image image

Frooodle commented 6 months ago

I have tested SECURITY_ENABLELOGIN and SECURITY_ENABLE_LOGIN Both function the same on my machine and both enable the login functionality

in regards to the initial OP post if the docker can not access configs than it wont be able to start as it is a requirement. This is not a bug

Czj1997-02 commented 6 months ago

@Frooodle Thank !!!That's success, but need to wait for a certain amount of time

version: '3.3'
services:
  stirling-pdf:
    image: frooodle/s-pdf:latest
    container_name: pdf
    restart: always
    ports:
      - '9998:8080'
    volumes:
      - /opt/pdf/trainingData:/usr/share/tessdata
      - /opt/pdf/customFiles:/customFiles/
      - /opt/pdf/logs:/logs/
      - /opt/pdf/ocr:/usr/share/tesseract-ocr/5/tessdata
      - /opt/pdf/config:/configs
    environment:
      - DOCKER_ENABLE_SECURITY=true
      - SECURITY_ENABLELOGIN=true
      - SECURITY_INITIALLOGIN_USERNAME=username
      - SECURITY_INITIALLOGIN_PASSWORD=password
      - SYSTEM_DEFAULTLOCALE=zh_CN
yggcwx commented 5 months ago

I install Stirling this morning (with SECURITY_ENABLE_LOGIN). Having mistake during authentification, I search a similar installation : https://www.youtube.com/watch?v=ZQKRAeM9kDM&t=533s

We could see the SECURITY_ENABLELOGIN parameter : image

I change SECURITY_ENABLE_LOGIN in SECURITY_ENABLELOGIN and I succedd to login.

My docker-compose :

with version: '3.8'

services:

L'application

stirling-pdf: image: frooodle/s-pdf:latest container_name: stirling-pdf deploy: restart_policy: condition: on-failure delay: 5s # Délai d'attente avant une nouvelle tentative max_attempts: 3 # Nombre maximal de redémarrages window: 30s # Durée après laquelle un démarrage est considéré OK si aucune erreur n'est survenue ports: - "16928:8080" volumes: - /volume1/docker/stirling-pdf/ocr:/usr/share/tesseract-ocr/5/tessdata - /volume1/docker/stirling-pdf/config:/configs environment: - DOCKER_ENABLE_SECURITY=true - SECURITY_ENABLELOGIN=true - SECURITY_INITIALLOGIN_USERNAME=username - SECURITY_INITIALLOGIN_PASSWORD=password - SYSTEM_DEFAULTLOCALE=fr-FR

The result : image image

Even though I set the variable parameters you mentioned, the web page of the project still does not appear the login button or login form, and I cannot log in.

我即使设置了您提到的变量参数,项目的web页面仍然不出现登录按钮或登录表格,无法登录。 `environment:

yggcwx commented 5 months ago

很神奇,换了台主机,我的问题就解决了。