From 1aa03e5992c57f0dc92dd2a48eb2c727f4f312f6 Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Mon, 3 Jun 2024 15:53:37 +0200 Subject: [PATCH] paperless-ngs: update to 2.9.0 - pipenv: 2023.10.24 to 2023.12.1 - README: explain migration - sqlite: 3.45.03 to 3.46.0 - redis: 7.2.4 to 7.2.5 - node: 20.13.0 to 20.14.0 - nginx: 1.26.1 to chicken 1.26.2, fixes, cert location --- Python.build.sh | 2 +- README.md | 35 ++++++++++++++++++++++++++++++++++- build.profile | 12 ++++++------ buildall.sh | 5 +++++ nginx.build.sh | 9 ++++----- nginx.chicken.patch | 4 ++-- nginx.conf.build.sh | 2 +- node.build.sh | 4 ++-- redis.build.sh | 11 +++++------ sqlite.build.sh | 28 +++++++++++++++------------- 10 files changed, 75 insertions(+), 37 deletions(-) diff --git a/Python.build.sh b/Python.build.sh index 1bc9701..106f14f 100755 --- a/Python.build.sh +++ b/Python.build.sh @@ -56,7 +56,7 @@ ln -vfs pip3 "${PREFIX}/bin/pip" . "${PREFIX}/profile" pip3 install --prefix="${PREFIX}" --upgrade pip -python3 -m pip install --no-cache-dir --upgrade pipenv==2023.10.24 +python3 -m pip install --no-cache-dir --upgrade pipenv==2023.12.1 pip3 install meson pip3 install sphinx diff --git a/README.md b/README.md index 11fbd33..5c0fa0f 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,44 @@ cd paperless-baremetal ./buildall . build.profile cd $PREFIX -./startstop-paperless.sh install ./startstop-paperless.sh start echo "URL: ${PAPERLESS_URL}:${PAPERLESS_PORT}" ``` +## updating/data migration from older versions + +after successfully building: + +``` +OLD="${HOME}/paperless-server/2.8.6" +NEW="${HOME}/paperless-server/2.9.0" + +# stop running instance +cd "$OLD" +./startstop.sh stop + +# remove empty database and media +rm -rf "$NEW/data" "$NEW/media" + +# change to new installation folder +cd "$NEW" + +# copy old data to new location ( $PREFIX ) +cp -ax "$OLD/data" "$NEW/" +cp -ax "$OLD/media" "$NEW/" + +# migrate +( . profile; cd "$NEW/paperless-ngx/src"; ./manage.py migrate ) + +# start +./startstop.sh start + +# check status +./startstop.sh status +``` + +## build + Overall, this script automates the setup of a local development environment for the paperless project, handling configuration, directory creation, and the building of dependencies. It also sets up logging to keep track of the build process. ## Explanation of `buildall.sh` diff --git a/build.profile b/build.profile index c9323cc..193a1ed 100644 --- a/build.profile +++ b/build.profile @@ -1,4 +1,4 @@ -BUILD_TAG=2.8.6 +BUILD_TAG=2.9.0 . build.local @@ -10,10 +10,10 @@ XDG_CACHE_HOME=${PREFIX}/cache TMPDIR=${TMPDIR:-/tmp/${USER}/${BUILD_TAG}} LOGDIR=${PROJECT}/log -BUILD_sqlite=sqlite-3.45.3 -BUILD_redis=redis-7.2.4 +BUILD_sqlite=sqlite-3.46.0 +BUILD_redis=redis-7.2.5 BUILD_python=Python-3.11.9 -BUILD_node=node-20.13.1 +BUILD_node=node-20.14.0 BUILD_ffmpeg=ffmpeg-7.0 BUILD_pngquant=pngquant-3.0.3-3-gdbb78b1 BUILD_unpaper=unpaper-7.0.0-125-gfe89949 @@ -21,9 +21,9 @@ BUILD_zbar=zbar-0.23.93 BUILD_leptonica=leptonica-1.84.1 BUILD_tesseract=tesseract-5.3.4 BUILD_tessdata=tessdata_best-4.1.0 -BUILD_nginx=nginx-1.26.0 +BUILD_nginx=nginx-1.26.1 BUILD_jbig2enc=jbig2enc-0.28-17-gea05019 BUILD_jbig2dec=jbig2dec-0.20 BUILD_libfontttf=liberation-fonts-ttf-2.1.5 -BUILD_paperless=paperless-ngx-2.8.6 +BUILD_paperless=paperless-ngx-2.9.0 diff --git a/buildall.sh b/buildall.sh index d8a9c51..cf42802 100755 --- a/buildall.sh +++ b/buildall.sh @@ -19,6 +19,11 @@ PAPERLESS_PORT=8880 # PAPERLESS_HTTPS=8443 PAPERLESS_URL=https://localhost PAPERLESS_CSRF_TRUSTED_ORIGINS=http://localhost:\${PAPERLESS_PORT} + +NGINX_SSL_DHPARAM=\${PROJECT}/certs/dhparam.pem +NGINX_SSL_CERTIFICATE=\${PROJECT}/certs/fullchain.pem +NGINX_SSL_CERTIFICATE_KEY=\${PROJECT}/certs/privkey.pem + _EOP_ ) ${BUILD_LOCAL} cat ${BUILD_LOCAL} diff --git a/nginx.build.sh b/nginx.build.sh index 80c95af..b614fc7 100755 --- a/nginx.build.sh +++ b/nginx.build.sh @@ -12,8 +12,8 @@ set -u function B_NGINX { -# SRCURL[0]="https://nginx.org/download/nginx-1.26.0.tar.gz" -SRCURL[0]="https://beehive.molgen.mpg.de/bb1b92cf7d72efcc0da343b057f23516/nginx-1.26.0.tar.gz" +# SRCURL[0]="https://nginx.org/download/nginx-1.26.1.tar.gz" +SRCURL[0]="https://beehive.molgen.mpg.de/56b83c172c7f2fd09d59123bc28ff2b1/nginx-1.26.1.tar.gz" BUILD_PKG=${BUILD_nginx} BUILD_EXT=${SRCURL/${SRCURL%.*.*}/} @@ -28,9 +28,8 @@ EOF . ${PREFIX}/profile -mkdir -p ${PREFIX}/conf -DHPARAM=${PREFIX}/conf/dhparam.pem -test -e ${DHPARAM} || openssl dhparam -dsaparam -out ${DHPARAM} 2048 +mkdir -p "${NGINX_SSL_DHPARAM%/*}" +test -e "${NGINX_SSL_DHPARAM}" || openssl dhparam -dsaparam -out "${NGINX_SSL_DHPARAM}" 2048 test -e ${BUILD_PKG}${BUILD_EXT} || wget -nv ${SRCURL} -O ${BUILD_PKG}${BUILD_EXT} diff --git a/nginx.chicken.patch b/nginx.chicken.patch index 27e50cd..b5f0271 100644 --- a/nginx.chicken.patch +++ b/nginx.chicken.patch @@ -59,9 +59,9 @@ index 088aa1e..0e1632f 100644 #define nginx_version 1025003 --#define NGINX_VERSION "1.26.0" +-#define NGINX_VERSION "1.26.1" -#define NGINX_VER "nginx/" NGINX_VERSION -+#define NGINX_VERSION "1.26.1" ++#define NGINX_VERSION "1.26.2" +#define NGINX_VER "chicken/" NGINX_VERSION #ifdef NGX_BUILD diff --git a/nginx.conf.build.sh b/nginx.conf.build.sh index 9a8713e..a0ee91e 100755 --- a/nginx.conf.build.sh +++ b/nginx.conf.build.sh @@ -41,7 +41,7 @@ tee -a ${CONF} <<_EOP_ listen ${PAPERLESS_BIND_ADDR}:${PAPERLESS_HTTPS} ssl; ssl_certificate ${NGINX_SSL_CERTIFICATE}; # from build.local ssl_certificate_key ${NGINX_SSL_CERTIFICATE_KEY}; # from build.local - ssl_dhparam dhparam.pem; # src/nginx.build.sh + ssl_dhparam ${NGINX_SSL_DHPARAM}; # src/nginx.build.sh ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; ssl_session_tickets off; diff --git a/node.build.sh b/node.build.sh index 500e84c..39bcb88 100755 --- a/node.build.sh +++ b/node.build.sh @@ -13,8 +13,8 @@ function B_NODEJS { [ -d "$PREFIX" ] || { echo "PREFIX unset or not a directory";exit; } -# wget "https://nodejs.org/download/release/v20.13.0/node-v20.13.0.tar.gz" -SRCURL="https://beehive.molgen.mpg.de/070f7b2fbcfa095db0ae7887da1fe55e/node-v20.13.0.tar.gz" +# wget "https://nodejs.org/download/release/v20.14.0/node-v20.14.0.tar.gz" +SRCURL="https://beehive.molgen.mpg.de/42e1625ee90c170a0e44882033392b99/node-v20.14.0.tar.gz" PREFIX=${PREFIX}/${BUILD_node} diff --git a/redis.build.sh b/redis.build.sh index 26312cc..e603638 100755 --- a/redis.build.sh +++ b/redis.build.sh @@ -8,20 +8,19 @@ set -u function B_REDIS { -SRCURL="https://download.redis.io/releases/redis-7.2.4.tar.gz" +# SRCURL="https://download.redis.io/releases/redis-7.2.5.tar.gz" +SRCURL="https://beehive.molgen.mpg.de/b2a5dde2024516d431fc1e4f360020b3/redis-7.2.5.tar.gz" BUILD_PKG=${BUILD_redis} PREFIX=${PREFIX}/${BUILD_PKG} -mkdir -p $PREFIX +mkdir -p ${PREFIX} -cat >$PREFIX/profile <<-EOF -PATH=$PREFIX/bin:\$PATH -# PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\$PKG_CONFIG_PATH +cat >${PREFIX}/profile <<-EOF +PATH=${PREFIX}/bin:\${PATH} EOF - test -e ${BUILD_PKG}.tar.gz || wget -nv ${SRCURL} -O ${BUILD_PKG}.tar.gz test -d ${BUILD_PKG} || mkdir -pv ${BUILD_PKG} && tar -xf ${BUILD_PKG}.tar.gz --strip-components=1 -C ${BUILD_PKG} diff --git a/sqlite.build.sh b/sqlite.build.sh index d8a02ba..850e44e 100755 --- a/sqlite.build.sh +++ b/sqlite.build.sh @@ -8,26 +8,26 @@ set -u function B_SQLITE { -SRCURL[0]="https://sqlite.org/2024/sqlite-autoconf-3450300.tar.gz" -SRCURL[0]="https://beehive.molgen.mpg.de/f418272ba1d588747dcd4201018ed912/sqlite-autoconf-3450300.tar.gz" +# wget "https://sqlite.org/2024/sqlite-autoconf-3460000.tar.gz" +SRCURL[0]="https://beehive.molgen.mpg.de/ff687dfc7483196420a4f16a6f53702d/sqlite-autoconf-3460000.tar.gz" -PKGARC=${SRCURL##*.*/} -PKGVER=${PKGARC%.*.*} +BUILD_PKG=${BUILD_sqlite} +BUILD_EXT=${SRCURL/${SRCURL%.*.*}/} -PREFIX=${PREFIX}/${BUILD_sqlite} +PREFIX=${PREFIX}/${BUILD_PKG} -mkdir -p $PREFIX +mkdir -p ${TMPDIR} +mkdir -p ${PREFIX} -cat >$PREFIX/profile <<-EOF -PATH=$PREFIX/bin:\$PATH -PKG_CONFIG_PATH=${PROJECT}/${BUILD_sqlite}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} +cat >${PREFIX}/profile <<-EOF +PATH=${PREFIX}/bin:\${PATH} +PKG_CONFIG_PATH=${PROJECT}/${BUILD_PKG}/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH:-} EOF +test -e ${BUILD_PKG}${BUILD_EXT} || wget -nv ${SRCURL} -O ${BUILD_PKG}${BUILD_EXT} +test -d ${BUILD_PKG} || mkdir -pv ${BUILD_PKG} && tar -xf ${BUILD_PKG}${BUILD_EXT} --strip-components=1 -C ${BUILD_PKG} -test -e ${BUILD_sqlite}.tar.gz || wget -nv ${SRCURL} -O ${BUILD_sqlite}.tar.gz -test -d ${BUILD_sqlite} || mkdir -pv ${BUILD_sqlite} && tar -xf ${BUILD_sqlite}.tar.gz --strip-components=1 -C ${BUILD_sqlite} - -cd ${BUILD_sqlite} +pushd ${BUILD_PKG} local _conf=( --prefix ${PREFIX} @@ -47,6 +47,8 @@ local _conf=( make -j $NPROC make install +popd + } B_SQLITE