1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/paperless-ngx_ynh.git synced 2024-09-03 19:56:33 +02:00

Merge pull request #77 from YunoHost-Apps/testing

Build Ghostscript, fix Imagemagick, fix services, upgrade to v2.5.3
This commit is contained in:
OniriCorpe 2024-02-16 21:15:41 +01:00 committed by GitHub
commit 295776eeb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 105 additions and 10 deletions

View file

@ -1,5 +1,5 @@
<!-- <!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
It shall NOT be edited by hand. It shall NOT be edited by hand.
--> -->
@ -33,7 +33,7 @@ Paperless-ngx is a document management system that transforms your physical docu
* [More screenshots are available in the documentation](https://paperless-ngx.readthedocs.io/en/latest/screenshots.html). * [More screenshots are available in the documentation](https://paperless-ngx.readthedocs.io/en/latest/screenshots.html).
**Shipped version:** 2.5.0~ynh1 **Shipped version:** 2.5.3~ynh1
**Demo:** https://demo.paperless-ngx.com/ **Demo:** https://demo.paperless-ngx.com/
@ -62,4 +62,4 @@ or
sudo yunohost app upgrade paperless-ngx -u https://github.com/YunoHost-Apps/paperless-ngx_ynh/tree/testing --debug sudo yunohost app upgrade paperless-ngx -u https://github.com/YunoHost-Apps/paperless-ngx_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps> **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,5 +1,5 @@
<!-- <!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
It shall NOT be edited by hand. It shall NOT be edited by hand.
--> -->
@ -33,7 +33,7 @@ Paperless-ngx is a document management system that transforms your physical docu
* [More screenshots are available in the documentation](https://paperless-ngx.readthedocs.io/en/latest/screenshots.html). * [More screenshots are available in the documentation](https://paperless-ngx.readthedocs.io/en/latest/screenshots.html).
**Version incluse :** 2.5.0~ynh1 **Version incluse :** 2.5.3~ynh1
**Démo :** https://demo.paperless-ngx.com/ **Démo :** https://demo.paperless-ngx.com/

View file

@ -81,7 +81,7 @@ PAPERLESS_CONSUMER_IGNORE_PATTERNS=[".DS_STORE/*", "._*", ".stfolder/*", ".*"]
# Binaries # Binaries
#PAPERLESS_CONVERT_BINARY=/usr/bin/convert #PAPERLESS_CONVERT_BINARY=/usr/bin/convert
#PAPERLESS_GS_BINARY=/usr/bin/gs PAPERLESS_GS_BINARY=__INSTALL_DIR__/bin/gs
#PAPERLESS_OPTIPNG_BINARY=/usr/bin/optipng #PAPERLESS_OPTIPNG_BINARY=/usr/bin/optipng
# YunoHost tweaks # YunoHost tweaks

23
conf/policy.xml Normal file
View file

@ -0,0 +1,23 @@
<policymap>
<!-- temporary path must be a preexisting writable directory -->
<policy domain="resource" name="temporary-path" value="__DATA_DIR__/imagemagick"/>
<policy domain="resource" name="memory" value="256MiB"/>
<policy domain="resource" name="list-length" value="32"/>
<policy domain="resource" name="width" value="8KP"/>
<policy domain="resource" name="height" value="8KP"/>
<policy domain="resource" name="map" value="512MiB"/>
<policy domain="resource" name="area" value="16KP"/>
<policy domain="resource" name="disk" value="1GiB"/>
<policy domain="resource" name="file" value="768"/>
<policy domain="resource" name="thread" value="2"/>
<policy domain="resource" name="time" value="120"/>
<policy domain="module" rights="none" pattern="URL" />
<policy domain="coder" rights="read | write" pattern="{MSVG,MVG,PS,PDF,RSVG,SVG,XPS}" />
<policy domain="filter" rights="none" pattern="*" />
<policy domain="path" rights="none" pattern="-"/> <!-- don't read/write from/to stdin/stdout -->
<policy domain="path" rights="none" pattern="/etc/*"/> <!-- don't read sensitive paths -->
<policy domain="path" rights="none" pattern="@*"/> <!-- indirect reads not permitted -->
<policy domain="cache" name="memory-map" value="anonymous"/>
<policy domain="cache" name="synchronize" value="true"/>
<policy domain="system" name="shred" value="1"/>
</policymap>

View file

@ -1,11 +1,14 @@
[Unit] [Unit]
Description=Paperless consumer Description=Paperless consumer
After=network.target
Wants=network.target
Requires=redis.service Requires=redis.service
[Service] [Service]
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment=PATH=__LOCAL_PATH__
WorkingDirectory=__INSTALL_DIR__/src/ WorkingDirectory=__INSTALL_DIR__/src/
ExecStart=__INSTALL_DIR__/venv/bin/python3 manage.py document_consumer ExecStart=__INSTALL_DIR__/venv/bin/python3 manage.py document_consumer
StandardOutput=append:/var/log/__APP__/__APP__-consumer.log StandardOutput=append:/var/log/__APP__/__APP__-consumer.log

View file

@ -1,11 +1,14 @@
[Unit] [Unit]
Description=Paperless scheduler Description=Paperless scheduler
After=network.target
Wants=network.target
Requires=redis.service Requires=redis.service
[Service] [Service]
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment=PATH=__LOCAL_PATH__
WorkingDirectory=__INSTALL_DIR__/src/ WorkingDirectory=__INSTALL_DIR__/src/
ExecStart=__INSTALL_DIR__/venv/bin/celery --app paperless beat --loglevel INFO ExecStart=__INSTALL_DIR__/venv/bin/celery --app paperless beat --loglevel INFO
StandardOutput=append:/var/log/__APP__/__APP__-scheduler.log StandardOutput=append:/var/log/__APP__/__APP__-scheduler.log

View file

@ -1,11 +1,14 @@
[Unit] [Unit]
Description=Paperless task-queue Description=Paperless task-queue
After=network.target
Wants=network.target
Requires=redis.service Requires=redis.service
[Service] [Service]
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment=PATH=__LOCAL_PATH__
WorkingDirectory=__INSTALL_DIR__/src/ WorkingDirectory=__INSTALL_DIR__/src/
ExecStart=__INSTALL_DIR__/venv/bin/celery --app paperless worker --loglevel INFO ExecStart=__INSTALL_DIR__/venv/bin/celery --app paperless worker --loglevel INFO
StandardOutput=append:/var/log/__APP__/__APP__-task-queue.log StandardOutput=append:/var/log/__APP__/__APP__-task-queue.log

View file

@ -8,6 +8,7 @@ Requires=redis.service
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment=PATH=__LOCAL_PATH__
WorkingDirectory=__INSTALL_DIR__/src/ WorkingDirectory=__INSTALL_DIR__/src/
ExecStart=__INSTALL_DIR__/venv/bin/uvicorn --port=__PORT__ --log-level=warning paperless.asgi:application ExecStart=__INSTALL_DIR__/venv/bin/uvicorn --port=__PORT__ --log-level=warning paperless.asgi:application
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log

View file

@ -0,0 +1,3 @@
Starting 2.4.3~ynh2, and while YunoHost 12 is yet to be released, Paperless-NGX will require to build its Ghostscript dependency to be able to process documents.
Expect a longer upgrade !

View file

@ -5,7 +5,7 @@ name = "Paperless-ngx"
description.en = "Scan, index and archive all your physical documents" description.en = "Scan, index and archive all your physical documents"
description.fr = "Scannez, triez et archivez tous vos documents papiers" description.fr = "Scannez, triez et archivez tous vos documents papiers"
version = "2.5.0~ynh1" version = "2.5.3~ynh1"
maintainers = ["Tagada"] maintainers = ["Tagada"]
@ -55,18 +55,22 @@ ram.runtime = "350M"
[resources.sources] [resources.sources]
[resources.sources.main] [resources.sources.main]
url = "https://github.com/paperless-ngx/paperless-ngx/releases/download/v2.5.0/paperless-ngx-v2.5.0.tar.xz" url = "https://github.com/paperless-ngx/paperless-ngx/releases/download/v2.5.3/paperless-ngx-v2.5.3.tar.xz"
sha256 = "fa0b90cf9203d1aa89dbf687c43ea103cd616eb7725ae2c6cb6d2ead4d66de6a" sha256 = "61b2c4a44663ac414994b0b0ce02938ec102c14c3f63d1e3259cb2f24ca9bda8"
autoupdate.strategy = "latest_github_release" autoupdate.strategy = "latest_github_release"
autoupdate.asset = "paperless-ngx-.*.tar.xz" autoupdate.asset = "paperless-ngx-.*.tar.xz"
[resources.sources.gs]
url = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10021/ghostpdl-10.02.1.tar.gz"
sha256 = "25399af0ef5bb94f2a13c91dc785c128d14f16744c4c92fa7c86e011c23151d8"
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]
[resources.data_dir] [resources.data_dir]
subdirs = ["consume", "data", "media"] subdirs = ["consume", "data", "media", "imagemagick"]
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"

View file

@ -17,6 +17,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/ghostscript" --source_id="gs"
chmod 750 "$install_dir" chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir" chown -R $app:$app "$install_dir"
@ -55,6 +57,24 @@ pushd $install_dir
) )
popd popd
#=================================================
# BUILD GHOSTCRIPT SPECIFIC VERSION
#=================================================
ynh_script_progression --message="Building Ghostscript dependency... (this will take a long time!)"
pushd $install_dir/ghostscript
ynh_exec_warn_less ./configure
ynh_exec_warn_less make
mv bin/ $install_dir/
popd
ynh_secure_remove --file="$install_dir/ghostscript"
chmod -R o-rwx "$install_dir/bin"
chown -R $app:$app "$install_dir/bin"
chmod 550 $install_dir/bin/gs
local_path=$install_dir/bin/:$PATH
#================================================= #=================================================
# CREATE DATA DIRECTORY # CREATE DATA DIRECTORY
#================================================= #=================================================
@ -83,6 +103,12 @@ ynh_add_config --template="paperless.conf.example" --destination="$install_dir/p
chmod 400 "$install_dir/paperless.conf" chmod 400 "$install_dir/paperless.conf"
chown $app:$app "$install_dir/paperless.conf" chown $app:$app "$install_dir/paperless.conf"
# ImageMagick configuration
mkdir -p "$install_dir/.config/ImageMagick"
ynh_add_config --template="policy.xml" --destination="$install_dir/.config/ImageMagick/policy.xml"
chmod 400 "$install_dir/.config/ImageMagick/policy.xml"
chown -R $app:$app "$install_dir/.config"
#================================================= #=================================================
# SETUP THE DATABASE # SETUP THE DATABASE
#================================================= #=================================================

View file

@ -95,6 +95,29 @@ pushd $install_dir
) )
popd popd
#=================================================
# BUILD GHOSTCRIPT SPECIFIC VERSION
#=================================================
if ! dpkg --compare-versions "$($install_dir/bin/gs --version 2>/dev/null)" ge "10.02.1"
then
ynh_script_progression --message="Building Ghostscript dependency... (this will take a long time!)"
ynh_setup_source --dest_dir="$install_dir/ghostscript" --source_id="gs" --full_replace
pushd $install_dir/ghostscript
ynh_exec_warn_less ./configure
ynh_exec_warn_less make
mv bin/ $install_dir/
popd
ynh_secure_remove --file="$install_dir/ghostscript"
chmod -R o-rwx "$install_dir/bin"
chown -R $app:$app "$install_dir/bin"
chmod 550 $install_dir/bin/gs
fi
local_path=$install_dir/bin/:$PATH
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
@ -105,6 +128,12 @@ ynh_add_config --template="paperless.conf.example" --destination="$install_dir/p
chmod 400 "$install_dir/paperless.conf" chmod 400 "$install_dir/paperless.conf"
chown $app:$app "$install_dir/paperless.conf" chown $app:$app "$install_dir/paperless.conf"
# ImageMagick configuration
mkdir -p "$install_dir/.config/ImageMagick"
ynh_add_config --template="policy.xml" --destination="$install_dir/.config/ImageMagick/policy.xml"
chmod 400 "$install_dir/.config/ImageMagick/policy.xml"
chown -R $app:$app "$install_dir/.config"
#================================================= #=================================================
# SETUP THE DATABASE # SETUP THE DATABASE
#================================================= #=================================================