diff --git a/Bastillefile b/Bastillefile index 912ceb3..b6a3d4f 100644 --- a/Bastillefile +++ b/Bastillefile @@ -3,6 +3,9 @@ PKG py39-pip py39-pikepdf py39-scikit-learn liberation-fonts-ttf imagemagick7 zb SYSRC redis_enable="YES" SERVICE redis start +CP usr / +CP tmp / + CMD mkdir /opt CMD curl -L https://github.com/paperless-ngx/paperless-ngx/releases/download/v1.9.2/paperless-ngx-v1.9.2.tar.xz --output paperless-ngx-v1.9.2.tar.xz CMD tar -zxf paperless-ngx-v1.9.2.tar.xz @@ -17,12 +20,12 @@ CMD sed -i "" -e 's/#PAPERLESS_DATA_DIR/PAPERLESS_DATA_DIR/' /opt/paperless/pape CMD sed -i "" -e 's/#PAPERLESS_MEDIA_ROOT/PAPERLESS_MEDIA_ROOT/' /opt/paperless/paperless.conf CMD sed -i "" -e 's/#PAPERLESS_CONSUMPTION_DIR/PAPERLESS_CONSUMPTION_DIR/' /opt/paperless/paperless.conf CMD sed -i "" -e 's/#PAPERLESS_REDIS/PAPERLESS_REDIS/' /opt/paperless/paperless.conf -CMD sed -i "" -e "/PAPERLESS_REDIS/ a\PAPERLESS_DBENGINE=sqlite" /opt/paperless/paperless.conf +CMD sed -i "" -e "/PAPERLESS_REDIS/ a\ PAPERLESS_DBENGINE=sqlite" /opt/paperless/paperless.conf CMD sed -i "" -e '/PDF/s/rights="none"/rights="read|write"/' /usr/local/etc/ImageMagick-7/policy.xml - +CMD cd /opt/paperless CMD su paperless -c /tmp/paperless_install SYSRC paperlessconsumer_enable="YES" SYSRC paperlesswebserver_enable="YES" diff --git a/README.md b/README.md index 82743b7..6a7b66e 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,5 @@ -## Status -[![pipeline status](https://gitlab.com/bastillebsd-templates/minecraft-server/badges/master/pipeline.svg)](https://gitlab.com/bastillebsd-templates/minecraft-server/commits/master) +# iocage-plugin-paperless-ngx +Artifact file(s) for Paperless NGX iocage plugin -## minecraft-server -Bastille template for a minecraft server. -Note: by installing this template you agree to the terms of the [Minecraft EULA](https://aka.ms/MinecraftEULA). - -This template includes the `eula=true` acceptance and `LICENSES_ACCEPTED+= minecraft` -settings. If you cannot abide the terms of the Minecraft EULA *do not* apply this template. - -### requirements -Due to license restrictions (see above Minecraft EULA), redistribution of -Minecraft server is prohibited. This means you must build the package manually -from the FreeBSD ports tree. - -This template will automate all the build steps but depends on `/usr/ports` -existing on the host system. - -To install (or update) `/usr/ports` on the host system use `portsnap` as seen here: - -```shell -ishmael ~ # portsnap fetch auto -``` - -Note: the ports tree is mounted read-only within the container. - -## Bootstrap template - -```shell -ishmael ~ # bastille bootstrap https://gitlab.com/bastillebsd-templates/minecraft-server -``` - -## Apply template - -```shell -ishmael ~ # bastille template TARGET bastillebsd-templates/minecraft-server -``` - -## Access server console - -The minecraft server will run in `STANDALONE` mode meaning the service execution -will happen within a `tmux` session. To access this session use this command: - -```shell -ishmael ~ # bastille service TARGET minecraft console -``` - -Tip: `tmux` session management is handled using `ctrl-b` prefix. To exit the -session press `ctrl-b d`. \ No newline at end of file +After install, the admin username and password are both "admin". Please change at first login for security reasons. The web portal for paperless-ngx will be the jail ip address and port 8000. More information on paperless-ngx can be found at https://paperless-ngx.readthedocs.io/en/latest/index.html. \ No newline at end of file diff --git a/tmp/paperless_install b/tmp/paperless_install new file mode 100644 index 0000000..0378442 --- /dev/null +++ b/tmp/paperless_install @@ -0,0 +1,16 @@ +#!/bin/sh + + +mkdir -p /opt/paperless/consume +mkdir -p /opt/paperless/media +cd /opt/paperless +python3.9 -m venv venv +sed -i "" -e '/scikit-learn/d;/pikepdf/d;/scipy/d;/numpy/d' /opt/paperless/requirements.txt +. venv/bin/activate +pip install -q -q --upgrade pip +pip install -q -q -r requirements.txt +cd src +python3.9 manage.py migrate +DJANGO_SUPERUSER_PASSWORD=admin +python3.9 manage.py createsuperuser --noinput --email=root@localhost --username=admin +deactivate diff --git a/usr/local/etc/rc.d/paperlessconsumer b/usr/local/etc/rc.d/paperlessconsumer new file mode 100644 index 0000000..ac6cab0 --- /dev/null +++ b/usr/local/etc/rc.d/paperlessconsumer @@ -0,0 +1,18 @@ +#!/bin/sh + +. /etc/rc.subr + + +name="paperlessconsumer" +rcvar="${name}_enable" +procname="daemon" + +pidfile="/var/run/${name}.pid" + + +command="/usr/sbin/daemon" +command_args="-f -P ${pidfile} -u paperless /usr/local/sbin/${name}" + + +load_rc_config $name +run_rc_command "$1" diff --git a/usr/local/etc/rc.d/paperlessscheduler b/usr/local/etc/rc.d/paperlessscheduler new file mode 100644 index 0000000..4c8a95e --- /dev/null +++ b/usr/local/etc/rc.d/paperlessscheduler @@ -0,0 +1,18 @@ +#!/bin/sh + +. /etc/rc.subr + + +name="paperlessscheduler" +rcvar="${name}_enable" +procname="daemon" + +pidfile="/var/run/${name}.pid" + + +command="/usr/sbin/daemon" +command_args="-f -P ${pidfile} -u paperless /usr/local/sbin/${name}" + + +load_rc_config $name +run_rc_command "$1" diff --git a/usr/local/etc/rc.d/paperlesswebserver b/usr/local/etc/rc.d/paperlesswebserver new file mode 100644 index 0000000..80bd415 --- /dev/null +++ b/usr/local/etc/rc.d/paperlesswebserver @@ -0,0 +1,18 @@ +#!/bin/sh + +. /etc/rc.subr + + +name="paperlesswebserver" +rcvar="${name}_enable" +procname="daemon" + +pidfile="/var/run/${name}.pid" + + +command="/usr/sbin/daemon" +command_args="-f -P ${pidfile} -u paperless /usr/local/sbin/${name}" + + +load_rc_config $name +run_rc_command "$1" diff --git a/usr/local/sbin/paperlessconsumer b/usr/local/sbin/paperlessconsumer new file mode 100644 index 0000000..0568e4b --- /dev/null +++ b/usr/local/sbin/paperlessconsumer @@ -0,0 +1,5 @@ +#!/bin/sh + +. /opt/paperless/venv/bin/activate +cd /opt/paperless/src +exec python3.9 manage.py document_consumer diff --git a/usr/local/sbin/paperlessscheduler b/usr/local/sbin/paperlessscheduler new file mode 100644 index 0000000..98767aa --- /dev/null +++ b/usr/local/sbin/paperlessscheduler @@ -0,0 +1,5 @@ +#!/bin/sh + +. /opt/paperless/venv/bin/activate +cd /opt/paperless/src +exec python3.9 /opt/paperless/src/manage.py qcluster diff --git a/usr/local/sbin/paperlesswebserver b/usr/local/sbin/paperlesswebserver new file mode 100644 index 0000000..f0e84f7 --- /dev/null +++ b/usr/local/sbin/paperlesswebserver @@ -0,0 +1,5 @@ +#!/bin/sh + +. /opt/paperless/venv/bin/activate +cd /opt/paperless/src +exec python3.9 manage.py runserver 0.0.0.0:8000 \ No newline at end of file