Skip to content

Commit 4244560

Browse files
authored
Revert "Revert "Updated file paths and security environment variable" (#81)" (#82)
This reverts commit dc91e0c.
1 parent dc91e0c commit 4244560

File tree

8 files changed

+87
-43
lines changed

8 files changed

+87
-43
lines changed

docs/Advanced Configuration/External Database.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PostgreSQL is currently the only supported variant, others will be added on requ
1818
You can configure the new `Datasource` property in your `settings.yml` to connect to your external database:
1919

2020
> #### ⚠️ Note
21-
> _To use the external database feature, you will need to have a valid enterprise license and set the environment variable `DOCKER_ENABLE_SECURITY` to `true`._
21+
> _To use the external database feature, you will need to have a valid enterprise license and set the environment variable `DISABLE_ADDITIONAL_FEATURES` to `false`._
2222
2323
<Tabs groupId="external-db-config">
2424
<TabItem value="settings" label="Settings File">
@@ -78,7 +78,7 @@ services:
7878
depends_on:
7979
- db
8080
environment:
81-
DOCKER_ENABLE_SECURITY: "true"
81+
DISABLE_ADDITIONAL_FEATURES: "false" "true"
8282
SYSTEM_DATASOURCE_ENABLECUSTOMDATABASE: "true"
8383
SYSTEM_DATASOURCE_CUSTOMDATABASEURL: "jdbc:postgresql://db:5432/stirling_pdf"
8484
SYSTEM_DATASOURCE_USERNAME: "admin"
@@ -87,7 +87,7 @@ services:
8787
```
8888

8989
- `depends_on`: This specifies any services that your app will need in order to run. Ensure the name matches the container name for your database
90-
- `DOCKER_ENABLE_SECURITY`: Set this to `true` to enable security features
90+
- `DISABLE_ADDITIONAL_FEATURES`: Set this to `false` to enable security features
9191
- `SYSTEM_DATASOURCE_ENABLECUSTOMDATABASE`: An environment variable to connect to the database container. Set this to `true` to enable use of the external database
9292
- `SYSTEM_DATASOURCE_CUSTOMDATABASEURL`: An environment variable to connect to the database container. Set the connection url for the database here. **Note: If you set this url you do not need to set the type, hostName, port and name (namely `SYSTEM_DATASOURCE_TYPE`, `SYSTEM_DATASOURCE_HOSTNAME`, `SYSTEM_DATASOURCE_PORT`, `SYSTEM_DATASOURCE_NAME`), they will all be automatically derived from the url.**
9393
- `SYSTEM_DATASOURCE_USERNAME`: An environment variable to connect to the database container. Set the username for the database. Ensure this matches the corresponding property in your database container
@@ -101,7 +101,7 @@ services:
101101
depends_on:
102102
- db
103103
environment:
104-
DOCKER_ENABLE_SECURITY: "true"
104+
DISABLE_ADDITIONAL_FEATURES: "false" "true"
105105
SYSTEM_DATASOURCE_ENABLECUSTOMDATABASE: "true"
106106
SYSTEM_DATASOURCE_CUSTOMDATABASEURL: "jdbc:postgresql://db:5432/stirling_pdf"
107107
SYSTEM_DATASOURCE_USERNAME: "admin"

docs/Advanced Configuration/How to add configurations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ There is an additional config file ``/configs/custom_settings.yml`` where users
175175
176176
- ``SYSTEM_ROOTURIPATH`` ie set to ``/pdf-app`` to Set the application's root URI to ``localhost:8080/pdf-app``
177177
- ``SYSTEM_CONNECTIONTIMEOUTMINUTES`` to set custom connection timeout values
178-
- ``DOCKER_ENABLE_SECURITY`` to tell docker to download security jar (required as true for auth login)
178+
- ``DISABLE_ADDITIONAL_FEATURES`` to tell docker to download security jar (required as false for auth login)
179179
- ``LANGS`` to define custom font libraries to install for use for document conversions
180180
181181
### Local

docs/Advanced Configuration/Single Sign-On Configuration.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ Assertion Consumer Service (ACS) URL The default is `stirling`
151151
- `security.saml2.idpSingleLoginUrl`: The URL given by your Provider to initiate the SSO flow
152152
- `security.saml2.idpSingleLogoutUrl`: The URL given by your Provider to initiate the SLO flow
153153
- `security.saml2.idpIssuer`: The name of your Provider
154-
- `security.saml2.idpCert`: The signing certificate given by your Provider in `.pem` format. Place in `src/main/resources`
155-
- `security.saml2.privateKey`: Your private key from your keypair in `.key` format. Place in `src/main/resources`
156-
- `security.saml2.spCert`: classpath:certificate.crt from your keypair in `.crt` format. Place in `src/main/resources`
154+
- `security.saml2.idpCert`: The signing certificate given by your Provider in `.pem` format. Place in `stirling-pdf/src/main/resources`
155+
- `security.saml2.privateKey`: Your private key from your keypair in `.key` format. Place in `stirling-pdf/src/main/resources`
156+
- `security.saml2.spCert`: classpath:certificate.crt from your keypair in `.crt` format. Place in `stirling-pdf/src/main/resources`
157157

158158
### Generating a Keypair
159159

@@ -174,7 +174,7 @@ A self-signed certificate is not verified by a Certificate Authority (CA), which
174174
- `out certificate.crt`: Specifies the output file where the self-signed certificate will be saved
175175

176176
After generating the keypair, the `.key` and `.crt` files should be located in the directory you executed the above command in.
177-
Move the files to `src/main/resources`.
177+
Move the files to `stirling-pdf/src/main/resources`.
178178

179179
Once you have added your configuration, you should see the button for your chosen Provider on the login page prompting you to log in:
180180

@@ -222,7 +222,7 @@ Below are examples of the full configuration for both OAuth 2 and SAML 2:
222222
</TabItem>
223223
<TabItem value="local" label="Local Environment">
224224
```bash
225-
export DOCKER_ENABLE_SECURITY=true
225+
export DISABLE_ADDITIONAL_FEATURES=false
226226
export SECURITY_ENABLELOGIN=true
227227
export SECURITY_OAUTH2_ENABLED=true
228228
export SECURITY_OAUTH2_AUTOCREATEUSER=false
@@ -249,7 +249,7 @@ Below are examples of the full configuration for both OAuth 2 and SAML 2:
249249
</TabItem>
250250
<TabItem value="docker-run" label="Docker Run">
251251
```bash
252-
-e DOCKER_ENABLE_SECURITY=true \
252+
-e DISABLE_ADDITIONAL_FEATURES=false \
253253
-e SECURITY_ENABLELOGIN=true \
254254
-e SECURITY_OAUTH2_ENABLED=true \
255255
-e SECURITY_OAUTH2_AUTOCREATEUSER=false \
@@ -276,7 +276,7 @@ Below are examples of the full configuration for both OAuth 2 and SAML 2:
276276
<TabItem value="docker-compose" label="Docker Compose">
277277
```yaml
278278
environment:
279-
DOCKER_ENABLE_SECURITY=true
279+
DISABLE_ADDITIONAL_FEATURES=false
280280
SECURITY_ENABLELOGIN=true
281281
SECURITY_OAUTH2_ENABLED=true
282282
SECURITY_OAUTH2_AUTOCREATEUSER=false

docs/Advanced Configuration/System and Security.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import TabItem from '@theme/TabItem';
66

77
# Login, System and Security
88

9-
Stirling PDF allows customization of system and security settings. For security features to be enabled, you must use the security jar. For Docker users, this means setting `DOCKER_ENABLE_SECURITY` to `true` via an environment variable.
9+
Stirling PDF allows customization of system and security settings. For security features to be enabled, you must use the security jar. For Docker users, this means setting `DISABLE_ADDITIONAL_FEATURES` to `false` via an environment variable.
1010

1111
## Basic Security Settings
1212

@@ -19,7 +19,7 @@ Stirling PDF allows customization of system and security settings. For security
1919

2020
### Prerequisites
2121
1. Ensure the `/configs` directory is mounted as a volume in Docker for persistence across updates
22-
2. For Docker users: Set `DOCKER_ENABLE_SECURITY=true` in environment variables
22+
2. For Docker users: Set `DISABLE_ADDITIONAL_FEATURES=false` in environment variables
2323
3. Enable login either via `settings.yml` or set `SECURITY_ENABLELOGIN=true`
2424

2525
### Initial Login Credentials
@@ -76,25 +76,25 @@ When using the API:
7676

7777
**Option 1: Using Java Properties**
7878
```bash
79-
java -jar Stirling-PDF.jar -DDOCKER_ENABLE_SECURITY=true -DSECURITY_ENABLELOGIN=true
79+
java -jar Stirling-PDF.jar -DDISABLE_ADDITIONAL_FEATURES=false -DSECURITY_ENABLELOGIN=true
8080
```
8181

8282
**Option 2: Using Environment Variables**
8383
```bash
84-
export DOCKER_ENABLE_SECURITY=true
84+
export DISABLE_ADDITIONAL_FEATURES=false
8585
export SECURITY_ENABLELOGIN=true
8686
```
8787
</TabItem>
8888
<TabItem value="docker-run" label="Docker Run">
8989
```bash
90-
-e DOCKER_ENABLE_SECURITY=true \
90+
-e DISABLE_ADDITIONAL_FEATURES=false \
9191
-e SECURITY_ENABLELOGIN=true \
9292
```
9393
</TabItem>
9494
<TabItem value="docker-compose" label="Docker Compose">
9595
```yaml
9696
environment:
97-
DOCKER_ENABLE_SECURITY: true
97+
DISABLE_ADDITIONAL_FEATURES: false true
9898
SECURITY_ENABLELOGIN: true
9999
```
100100
</TabItem>

docs/Advanced Configuration/UI Customisation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,29 @@ To override a file:
5050
3. Create the same file path under your `customFiles` directory following the same directory structure
5151
4. Paste and modify the contents as needed
5252

53-
Note: When overriding templates, first copy the existing template from the [source repository](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/templates) to maintain the base structure.
53+
Note: When overriding templates, first copy the existing template from the [source repository](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/stirling-pdf/src/main/resources/templates) to maintain the base structure.
5454

5555
1. To replace the favicon:
5656
```
5757
customFiles/static/favicon.svg
5858
```
59-
Original file: [src/main/resources/static/favicon.svg](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/static/favicon.svg)
59+
Original file: [stirling-pdf/src/main/resources/static/favicon.svg](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/static/favicon.svg)
6060

6161
2. To override a Bootstrap icon font:
6262
```
6363
customFiles/static/css/fonts/bootstrap-icons.woff
6464
```
65-
Original file: [src/main/resources/static/css/fonts/bootstrap-icons.woff](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/static/css/fonts/bootstrap-icons.woff)
65+
Original file: [stirling-pdf/src/main/resources/static/css/fonts/bootstrap-icons.woff](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/static/css/fonts/bootstrap-icons.woff)
6666

6767
3. To modify a template:
6868
```
6969
customFiles/templates/fragments/common.html
7070
```
71-
Original file: [src/main/resources/templates/fragments/common.html](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/templates/fragments/common.html)
71+
Original file: [stirling-pdf/src/main/resources/templates/fragments/common.html](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/templates/fragments/common.html)
7272

7373
The original files can be found in the GitHub repository under:
74-
- Static files: [src/main/resources/static/](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/static)
75-
- Templates (HTML files): [src/main/resources/templates/](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/templates)
74+
- Static files: [stirling-pdf/src/main/resources/static/](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/stirling-pdf/src/main/resources/static)
75+
- Templates (HTML files): [stirling-pdf/src/main/resources/templates/](https://github.com/Stirling-Tools/Stirling-PDF/tree/main/stirling-pdf/src/main/resources/templates)
7676

7777

7878

docs/Installation/Docker Install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ docker run -d \
2727
-v "./StirlingPDF/customFiles:/customFiles/" \
2828
-v "./StirlingPDF/logs:/logs/" \
2929
-v "./StirlingPDF/pipeline:/pipeline/" \
30-
-e DOCKER_ENABLE_SECURITY=false \
30+
-e DISABLE_ADDITIONAL_FEATURES=true \
3131
-e LANGS=en_GB \
3232
docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest
3333
```
@@ -49,7 +49,7 @@ services:
4949
- ./StirlingPDF/logs:/logs/
5050
- ./StirlingPDF/pipeline:/pipeline/
5151
environment:
52-
- DOCKER_ENABLE_SECURITY=false
52+
- DISABLE_ADDITIONAL_FEATURES=false
5353
- LANGS=en_GB
5454
```
5555

docs/Installation/Unix.md

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sidebar_position: 2
33
id: Unix Installation
44
title: Unix Installation Guide
55
---
6+
67
import Tabs from '@theme/Tabs';
78
import TabItem from '@theme/TabItem';
89

@@ -66,7 +67,19 @@ Install the following software, if not already installed:
6667
### Step 2: Clone and Build jbig2enc (Only required for certain OCR functionality)
6768

6869
<Tabs groupId="unix-systems">
69-
<TabItem value="debian-fedora" label="Debian/Fedora">
70+
<TabItem value="debian" label="Debian">
71+
```bash
72+
mkdir ~/.git
73+
cd ~/.git &&\
74+
git clone https://github.com/agl/jbig2enc.git &&\
75+
cd jbig2enc &&\
76+
./autogen.sh &&\
77+
./configure &&\
78+
make &&\
79+
sudo make install
80+
```
81+
</TabItem>
82+
<TabItem value="fedora" label="Fedora">
7083
```bash
7184
mkdir ~/.git
7285
cd ~/.git &&\
@@ -90,6 +103,7 @@ Install the following software, if not already installed:
90103
Next we need to install LibreOffice for conversions, tesseract for OCR, and opencv for pattern recognition functionality.
91104

92105
Install the following software:
106+
93107
- libreoffice (libreoffice-core libreoffice-common libreoffice-writer libreoffice-calc libreoffice-impress)
94108
- python3-uno
95109
- unoserver
@@ -119,23 +133,33 @@ Install the following software:
119133
</Tabs>
120134

121135
### Step 4: Grab latest Stirling-PDF Jar
122-
The JAR can be downloaded in two versions, [normal](https://files.stirlingpdf.com/Stirling-PDF.jar) and [security](https://files.stirlingpdf.com/Stirling-PDF-with-login.jar)
136+
137+
The JAR can be downloaded in two versions, [normal](https://files.stirlingpdf.com/Stirling-PDF.jar) and [security](https://files.stirlingpdf.com/Stirling-PDF-with-login.jar)
123138

124139
### Step 5: Move jar to desired location
140+
125141
You can move this file to a desired location, for example, `/opt/Stirling-PDF/`.
126142
You must also move the Script folder within the Stirling-PDF repo that you have downloaded to this directory.
127143
This folder is required for the python scripts using OpenCV.
128144

129145
<Tabs groupId="user-type">
130-
<TabItem value="root" label="Root User">
146+
<TabItem value="debian" label="Debian (Root)">
147+
```bash
148+
sudo mkdir /opt/Stirling-PDF &&\
149+
sudo mv ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/ &&\
150+
sudo mv scripts /opt/Stirling-PDF/ &&\
151+
echo "Scripts installed."
152+
```
153+
</TabItem>
154+
<TabItem value="fedora" label="Fedora (Root)">
131155
```bash
132156
sudo mkdir /opt/Stirling-PDF &&\
133157
sudo mv ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/ &&\
134158
sudo mv scripts /opt/Stirling-PDF/ &&\
135159
echo "Scripts installed."
136160
```
137161
</TabItem>
138-
<TabItem value="non-root" label="Non-root User">
162+
<TabItem value="nix" label="Nix (Non-root)">
139163
```bash
140164
mv ./build/libs/Stirling-PDF-*.jar ./Stirling-PDF-*.jar
141165
```
@@ -152,7 +176,7 @@ If you plan to use the OCR (Optical Character Recognition) functionality, you mi
152176
sudo apt update &&\
153177
# All languages
154178
# sudo apt install -y 'tesseract-ocr-*'
155-
179+
156180
# Find languages:
157181
apt search tesseract-ocr-
158182

@@ -164,7 +188,7 @@ If you plan to use the OCR (Optical Character Recognition) functionality, you mi
164188
```bash
165189
# All languages
166190
# sudo dnf install -y tesseract-langpack-*
167-
191+
168192
# Find languages:
169193
dnf search -C tesseract-langpack-
170194

@@ -184,28 +208,41 @@ If you plan to use the OCR (Optical Character Recognition) functionality, you mi
184208
3. Please view [tesseract install guide](https://tesseract.readthedocs.io/en/latest/installation.html) for more info.
185209

186210
**IMPORTANT:** DO NOT REMOVE EXISTING `eng.traineddata`, IT'S REQUIRED.
211+
187212
</TabItem>
188213
</Tabs>
189214

190215
### Step 7: Run Stirling-PDF
191216

217+
<Tabs groupId="unix-systems">
218+
<TabItem value="debian" label="Debian-based Systems">
192219
```bash
193220
java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar
194221
```
195-
196-
Since libreoffice, soffice, and conversion tools have their dbus_tmp_dir set as `dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus"`, you might get the following error:
197-
```
198-
[Thread-7] INFO s.s.SPDF.utils.ProcessExecutor - mkdir: cannot create directory '/run/user/1501': Permission denied
222+
</TabItem>
223+
<TabItem value="fedora" label="Fedora-based Systems">
224+
```bash
225+
java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar
199226
```
200-
To resolve this, use:
227+
</TabItem>
228+
<TabItem value="nix" label="Nix Package Manager">
201229
```bash
202-
mkdir temp
203-
export DBUS_SESSION_BUS_ADDRESS="unix:path=./temp"
204-
```
230+
java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar
231+
```
232+
Since libreoffice, soffice, and conversion tools have their dbus_tmp_dir set as `dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus"`, you get the following error:
233+
`[Thread-7] INFO s.s.SPDF.utils.ProcessExecutor - mkdir: cannot create directory '/run/user/1501': Permission denied`
234+
To resolve this, use:
235+
`bash
236+
mkdir temp
237+
export DBUS_SESSION_BUS_ADDRESS="unix:path=./temp"
238+
`
239+
</TabItem>
240+
</Tabs>
205241

206242
### Step 8: Adding a Desktop Icon
207243

208244
This will add a modified Appstarter to your Appmenu.
245+
209246
```bash
210247
location=$(pwd)/gradlew
211248
image=$(pwd)/docs/stirling-transparent.svg
@@ -248,17 +285,21 @@ SERVER_PORT="3000"
248285
### Optional: Run Stirling-PDF as a service (requires root).
249286

250287
First create a .env file, where you can store environment variables:
288+
251289
```
252290
touch /opt/Stirling-PDF/.env
253291
```
292+
254293
In this file you can add all variables, one variable per line, as stated in the main readme (for example SYSTEM_DEFAULTLOCALE="de-DE").
255294

256295
Create a new file where we store our service settings and open it with nano editor:
296+
257297
```
258298
nano /etc/systemd/system/stirlingpdf.service
259299
```
260300

261301
Paste this content, make sure to update the filename of the jar-file. Press Ctrl+S and Ctrl+X to save and exit the nano editor:
302+
262303
```
263304
[Unit]
264305
Description=Stirling-PDF service
@@ -288,16 +329,19 @@ sudo systemctl daemon-reload
288329
```
289330

290331
Enable the service to tell the service to start it automatically:
332+
291333
```
292334
sudo systemctl enable stirlingpdf.service
293335
```
294336

295337
See the status of the service:
338+
296339
```
297340
sudo systemctl status stirlingpdf.service
298341
```
299342

300343
Manually start/stop/restart the service:
344+
301345
```
302346
sudo systemctl start stirlingpdf.service
303347
sudo systemctl stop stirlingpdf.service
@@ -327,4 +371,4 @@ system:
327371
operations:
328372
weasyprint: "" #Defaults to /opt/venv/bin/weasyprint
329373
unoconvert: "" #Defaults to /opt/venv/bin/unoconvert
330-
```
374+
```

0 commit comments

Comments
 (0)