Skip to content

Commit 2adb768

Browse files
committed
Cleanup & DOC Update
1 parent 686f492 commit 2adb768

4 files changed

Lines changed: 28 additions & 9 deletions

File tree

paperless-ngx/DOCS.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ consumer_subdirs_as_tags: false
7070
ssl: false
7171
certfile: fullchain.pem
7272
keyfile: privkey.pem
73+
backup_enabled: false
74+
backup_path: /share/paperless/exports
75+
backup_cron: "0 3 * * *"
76+
backup_keep_count: 3
7377
```
7478
7579
### Option: `url`
@@ -152,6 +156,22 @@ The private key file to use for SSL.
152156

153157
Let you set `client_max_body_size` of _nginx_ manually
154158

159+
### Option: `backup_enabled`
160+
161+
Enables or disables automatic backups of your Paperless data. Set to `true` to enable scheduled backups. `false` ist default.
162+
163+
### Option: `backup_path`
164+
165+
Specifies the directory where backup files will be stored. The default path is `/share/paperless/exports`.
166+
167+
### Option: `backup_cron`
168+
169+
Defines the cron schedule for automatic backups. The default value `"0 3 * * *"` runs backups daily at 3:00 AM. Use standard cron syntax to customize the backup schedule.
170+
171+
### Option: `backup_keep_count`
172+
173+
Sets the number of most recent backups to retain. Older backups beyond this count will be automatically deleted. The default is `3` backups.
174+
155175
### More personalisation
156176

157177
You can add more configurations options in `/addon_config/paperless_ngx/paperless.conf`

paperless-ngx/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,12 @@ RUN --mount=type=cache,target=/root/.cache/uv/,id=uv-cache \
133133
&& echo "Download Paperless-ngx" \
134134
&& curl -J -L -s -o paperless.tar.xz https://github.com/paperless-ngx/paperless-ngx/releases/download/${PAPERLESS_VERSION}/paperless-ngx-${PAPERLESS_VERSION}.tar.xz \
135135
&& tar -xf paperless.tar.xz \
136-
&& mv paperless-ngx /usr/src/paperless \
137-
&& apt-get update && apt-get install -y
136+
&& mv paperless-ngx /usr/src/paperless
138137

139138
WORKDIR /usr/src/paperless
140139

141140
# Packages needed only for building a few quick Python
142-
# dependencies & running a backup script
141+
# dependencies
143142
ARG BUILD_PACKAGES="\
144143
build-essential \
145144
git \
@@ -205,8 +204,7 @@ RUN set -eux \
205204
&& useradd --uid 1000 --gid paperless --home-dir /usr/src/paperless paperless \
206205
&& chown -R paperless:paperless /usr/src/paperless \
207206
&& gosu paperless python3 manage.py collectstatic --clear --no-input --link \
208-
&& gosu paperless python3 manage.py compilemessages \
209-
&& chmod +x /usr/local/bin/paperless_backup.sh
207+
&& gosu paperless python3 manage.py compilemessages
210208

211209
ENV PAPERLESS_REDIS="redis://localhost:6379"
212210
ENV PAPERLESS_DATA_DIR="/config/data"
@@ -222,7 +220,8 @@ VOLUME ["/usr/src/paperless/data", \
222220
# Copy root filesystem
223221
COPY rootfs/ /
224222

225-
RUN chmod +x /usr/local/bin/paperless_backup.sh
223+
RUN chmod +x /usr/local/bin/paperless_backup.sh \
224+
&& chmod +x /etc/cont-init.d/90-cron-backup.sh
226225

227226
# Build arguments
228227
ARG BUILD_ARCH

paperless-ngx/rootfs/etc/cont-init.d/90-cron-backup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if type bashio >/dev/null 2>&1; then
99
BACKUP_ENABLED="$(bashio::config 'backup_enabled')"
1010
BACKUP_KEEP_COUNT="$(bashio::config 'backup_keep_count')"
1111
else
12-
CRON_SCHEDULE="${BACKUP_CRON:-0 2 * * *}"
12+
CRON_SCHEDULE="0 2 * * *"
1313
BACKUP_ENABLED="false"
1414
BACKUP_KEEP_COUNT=-1
1515
fi
@@ -21,7 +21,7 @@ fi
2121

2222
mkdir -p /etc/cron.d
2323

24-
echo "${CRON_SCHEDULE:-0 3 * * *} /usr/local/bin/paperless_backup.sh" > /etc/cron.d/paperless-backup
24+
echo "${CRON_SCHEDULE} /usr/local/bin/paperless_backup.sh" > /etc/cron.d/paperless-backup
2525

2626
chmod 0644 /etc/cron.d/paperless-backup
2727

paperless-ngx/scripts/paperless_backup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ else
1010
BACKUP_PATH="/share/paperless/exports"
1111
fi
1212

13-
NOW=$(date '+%Y-%m-%d %H:%M:%S')
13+
NOW=$(date '+%Y-%m-%d-%H:%M:%S')
1414
echo "[INFO] Backup started: $NOW"
1515

1616
mkdir -p $BACKUP_PATH/temp

0 commit comments

Comments
 (0)